org.apache.asterix.lang.common.statement.Query.setSourceLocation()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.asterix.lang.common.statement.Query.setSourceLocation方法的一些代码示例,展示了Query.setSourceLocation的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setSourceLocation方法的具体详情如下:
包路径:org.apache.asterix.lang.common.statement.Query
类名称:Query
方法名:setSourceLocation

Query.setSourceLocation介绍

暂无

代码示例

代码示例来源:origin: apache/asterixdb

/**
   * Substitutes expression with replacement expressions according to the exprMap.
   *
   * @param expression
   *            ,
   *            an input expression.
   * @param exprMap
   *            a map that maps expressions to their corresponding replacement expressions.
   * @return an expression, where sub-expressions of the input expression (including the input expression itself)
   *         are replaced with deep copies with their mapped replacements in the exprMap if there exists such a
   *         replacement expression.
   * @throws CompilationException
   */
  public static Expression substituteExpression(Expression expression, Map<Expression, Expression> exprMap,
      LangRewritingContext context) throws CompilationException {
    if (exprMap.isEmpty()) {
      return expression;
    }
    // Creates a wrapper query for the expression so that if the expression itself
    // is the key, it can also be replaced.
    Query wrapper = new Query(false);
    wrapper.setSourceLocation(expression.getSourceLocation());
    wrapper.setBody(expression);
    // Creates a substitution visitor.
    SqlppSubstituteExpressionVisitor visitor = new SqlppSubstituteExpressionVisitor(context, exprMap);
    wrapper.accept(visitor, wrapper);
    return wrapper.getBody();
  }
}

代码示例来源:origin: apache/asterixdb

@Override
public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(Query q, VariableSubstitutionEnvironment env)
    throws CompilationException {
  Query newQ = new Query(q.isExplain());
  Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = q.getBody().accept(this, env);
  newQ.setBody((Expression) p1.first);
  newQ.setSourceLocation(q.getSourceLocation());
  return new Pair<>(newQ, p1.second);
}

代码示例来源:origin: apache/asterixdb

@Override
public Query visit(Query q, Void arg) throws CompilationException {
  Query copy =
      new Query(q.isExplain(), q.isTopLevel(), (Expression) q.getBody().accept(this, arg), q.getVarCounter());
  copy.setSourceLocation(q.getSourceLocation());
  return copy;
}

代码示例来源:origin: apache/asterixdb

query.setSourceLocation(expr.getSourceLocation());
{if (true) return query;}
throw new Error("Missing return statement in function");

代码示例来源:origin: apache/asterixdb

private Expression rewriteFunctionBody(FunctionDecl fnDecl) throws CompilationException {
  SourceLocation sourceLoc = fnDecl.getSourceLocation();
  Query wrappedQuery = new Query(false);
  wrappedQuery.setSourceLocation(sourceLoc);
  wrappedQuery.setBody(fnDecl.getFuncBody());
  wrappedQuery.setTopLevel(false);
  String fnNamespace = fnDecl.getSignature().getNamespace();
  Dataverse defaultDataverse = metadataProvider.getDefaultDataverse();
  Dataverse fnDataverse;
  if (fnNamespace == null || fnNamespace.equals(defaultDataverse.getDataverseName())) {
    fnDataverse = defaultDataverse;
  } else {
    try {
      fnDataverse = metadataProvider.findDataverse(fnNamespace);
    } catch (AlgebricksException e) {
      throw new CompilationException(ErrorCode.UNKNOWN_DATAVERSE, e, sourceLoc, fnNamespace);
    }
  }
  metadataProvider.setDefaultDataverse(fnDataverse);
  try {
    IQueryRewriter queryRewriter = rewriterFactory.createQueryRewriter();
    queryRewriter.rewrite(declaredFunctions, wrappedQuery, metadataProvider, context, true,
        fnDecl.getParamList());
    return wrappedQuery.getBody();
  } finally {
    metadataProvider.setDefaultDataverse(defaultDataverse);
  }
}

代码示例来源:origin: apache/asterixdb

wrappedQuery.setSourceLocation(sourceLoc);
wrappedQuery.setBody(cfs.getFunctionBodyExpression());
wrappedQuery.setTopLevel(false);

代码示例来源:origin: apache/asterixdb

Query query = new Query(false, false, selectExpression, 0);
query.setBody(selectExpression);
query.setSourceLocation(deleteStmt.getSourceLocation());

相关文章