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

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

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

Query.setBody介绍

暂无

代码示例

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

@Override
public void setBody(Expression body) {
  query.setBody(body);
}

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

@Override
public Expression visit(Query q, ILangExpression arg) throws CompilationException {
  q.setBody(visit(q.getBody(), q));
  return null;
}

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

@Override
public Expression visit(Query q, ILangExpression arg) throws CompilationException {
  q.setBody(visit(q.getBody(), q));
  return null;
}

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

@Override
public Boolean visit(Query q, List<FunctionDecl> arg) throws CompilationException {
  Pair<Boolean, Expression> p = inlineUdfsInExpr(q.getBody(), arg);
  q.setBody(p.second);
  return p.first;
}

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

final public Query Query() throws ParseException, ParseException {
Query query = new Query(false);
Expression expr;
 expr = Expression();
  query.setBody(expr);
  query.setVarCounter(getVarCounter());
  {if (true) return query;}
 throw new Error("Missing return statement in function");
}

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

final public Query Query() throws ParseException, ParseException {
Query query = new Query(false);
Expression expr;
 expr = Expression();
  query.setBody(expr);
  query.setVarCounter(getVarCounter());
  {if (true) return query;}
 throw new Error("Missing return statement in function");
}

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

@Override
public Expression visit(Query q, ILangExpression arg) throws CompilationException {
  q.setBody(visit(q.getBody(), q));
  q.setVarCounter(scopeChecker.getVarCounter());
  return null;
}

代码示例来源: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 Void visit(DeleteStatement deleteStmt, Void visitArg) {
  List<Expression> arguments = new ArrayList<>();
  Identifier dataverseName = deleteStmt.getDataverseName();
  Identifier datasetName = deleteStmt.getDatasetName();
  String arg = dataverseName == null ? datasetName.getValue()
      : dataverseName.getValue() + "." + datasetName.getValue();
  LiteralExpr argumentLiteral = new LiteralExpr(new StringLiteral(arg));
  arguments.add(argumentLiteral);
  CallExpr callExpression = new CallExpr(new FunctionSignature(BuiltinFunctions.DATASET), arguments);
  List<Clause> clauseList = new ArrayList<>();
  VariableExpr var = deleteStmt.getVariableExpr();
  Clause forClause = new ForClause(var, callExpression);
  clauseList.add(forClause);
  Clause whereClause = null;
  Expression condition = deleteStmt.getCondition();
  if (condition != null) {
    whereClause = new WhereClause(condition);
    clauseList.add(whereClause);
  }
  VariableExpr returnExpr = new VariableExpr(var.getVar());
  returnExpr.setIsNewVar(false);
  FLWOGRExpression flowgr = new FLWOGRExpression(clauseList, returnExpr);
  Query query = new Query(false);
  query.setBody(flowgr);
  deleteStmt.setQuery(query);
  return null;
}

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

throw new ParseException();
query.setBody(expr);
query.setSourceLocation(expr.getSourceLocation());
{if (true) return query;}

代码示例来源: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

Query wrappedQuery = new Query(false);
wrappedQuery.setSourceLocation(sourceLoc);
wrappedQuery.setBody(cfs.getFunctionBodyExpression());
wrappedQuery.setTopLevel(false);
List<VarIdentifier> paramVars = new ArrayList<>();

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

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

相关文章