io.prestosql.sql.tree.Query.getQueryBody()方法的使用及代码示例

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

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

Query.getQueryBody介绍

暂无

代码示例

代码示例来源:origin: io.prestosql/presto-main

private PlanBuilder planQueryBody(Query query)
{
  RelationPlan relationPlan = new RelationPlanner(analysis, symbolAllocator, idAllocator, lambdaDeclarationToSymbolMap, metadata, session)
      .process(query.getQueryBody(), null);
  return planBuilderFor(relationPlan);
}

代码示例来源:origin: prestosql/presto

@Override
protected Void visitQuery(Query node, Integer indentLevel)
{
  print(indentLevel, "Query ");
  indentLevel++;
  print(indentLevel, "QueryBody");
  process(node.getQueryBody(), indentLevel);
  if (node.getOrderBy().isPresent()) {
    print(indentLevel, "OrderBy");
    process(node.getOrderBy().get(), indentLevel + 1);
  }
  if (node.getLimit().isPresent()) {
    print(indentLevel, "Limit: " + node.getLimit().get());
  }
  return null;
}

代码示例来源:origin: io.prestosql/presto-parser

@Override
protected R visitQuery(Query node, C context)
{
  if (node.getWith().isPresent()) {
    process(node.getWith().get(), context);
  }
  process(node.getQueryBody(), context);
  if (node.getOrderBy().isPresent()) {
    process(node.getOrderBy().get(), context);
  }
  return null;
}

代码示例来源:origin: prestosql/presto

private PlanBuilder planQueryBody(Query query)
{
  RelationPlan relationPlan = new RelationPlanner(analysis, symbolAllocator, idAllocator, lambdaDeclarationToSymbolMap, metadata, session)
      .process(query.getQueryBody(), null);
  return planBuilderFor(relationPlan);
}

代码示例来源:origin: prestosql/presto

@Override
protected R visitQuery(Query node, C context)
{
  if (node.getWith().isPresent()) {
    process(node.getWith().get(), context);
  }
  process(node.getQueryBody(), context);
  if (node.getOrderBy().isPresent()) {
    process(node.getOrderBy().get(), context);
  }
  return null;
}

代码示例来源:origin: io.prestosql/presto-parser

@Override
protected Void visitQuery(Query node, Integer indentLevel)
{
  print(indentLevel, "Query ");
  indentLevel++;
  print(indentLevel, "QueryBody");
  process(node.getQueryBody(), indentLevel);
  if (node.getOrderBy().isPresent()) {
    print(indentLevel, "OrderBy");
    process(node.getOrderBy().get(), indentLevel + 1);
  }
  if (node.getLimit().isPresent()) {
    print(indentLevel, "Limit: " + node.getLimit().get());
  }
  return null;
}

代码示例来源:origin: prestosql/presto

@Override
protected Node visitShowStats(ShowStats node, Void context)
{
  checkState(queryExplainer.isPresent(), "Query explainer must be provided for SHOW STATS SELECT");
  if (node.getRelation() instanceof TableSubquery) {
    Query query = ((TableSubquery) node.getRelation()).getQuery();
    QuerySpecification specification = (QuerySpecification) query.getQueryBody();
    Plan plan = queryExplainer.get().getLogicalPlan(session, new Query(Optional.empty(), specification, Optional.empty(), Optional.empty()), parameters, warningCollector);
    validateShowStatsSubquery(node, query, specification, plan);
    Table table = (Table) specification.getFrom().get();
    Constraint<ColumnHandle> constraint = getConstraint(plan);
    return rewriteShowStats(node, table, constraint);
  }
  else if (node.getRelation() instanceof Table) {
    Table table = (Table) node.getRelation();
    return rewriteShowStats(node, table, Constraint.alwaysTrue());
  }
  else {
    throw new IllegalArgumentException("Expected either TableSubquery or Table as relation");
  }
}

代码示例来源:origin: io.prestosql/presto-main

@Override
protected Node visitShowStats(ShowStats node, Void context)
{
  checkState(queryExplainer.isPresent(), "Query explainer must be provided for SHOW STATS SELECT");
  if (node.getRelation() instanceof TableSubquery) {
    Query query = ((TableSubquery) node.getRelation()).getQuery();
    QuerySpecification specification = (QuerySpecification) query.getQueryBody();
    Plan plan = queryExplainer.get().getLogicalPlan(session, new Query(Optional.empty(), specification, Optional.empty(), Optional.empty()), parameters, warningCollector);
    validateShowStatsSubquery(node, query, specification, plan);
    Table table = (Table) specification.getFrom().get();
    Constraint<ColumnHandle> constraint = getConstraint(plan);
    return rewriteShowStats(node, table, constraint);
  }
  else if (node.getRelation() instanceof Table) {
    Table table = (Table) node.getRelation();
    return rewriteShowStats(node, table, Constraint.alwaysTrue());
  }
  else {
    throw new IllegalArgumentException("Expected either TableSubquery or Table as relation");
  }
}

代码示例来源:origin: io.prestosql/presto-parser

processRelation(node.getQueryBody(), indent);

代码示例来源:origin: prestosql/presto

processRelation(node.getQueryBody(), indent);

代码示例来源:origin: prestosql/presto

QueryBody innerQuery = createSelectClause.getQueryBody();
io.prestosql.sql.tree.Query zeroRowsQuery;
if (innerQuery instanceof QuerySpecification) {

代码示例来源:origin: io.prestosql/presto-parser

@Override
public Node visitQuery(SqlBaseParser.QueryContext context)
{
  Query body = (Query) visit(context.queryNoWith());
  return new Query(
      getLocation(context),
      visitIfPresent(context.with(), With.class),
      body.getQueryBody(),
      body.getOrderBy(),
      body.getLimit());
}

代码示例来源:origin: prestosql/presto

@Override
public Node visitQuery(SqlBaseParser.QueryContext context)
{
  Query body = (Query) visit(context.queryNoWith());
  return new Query(
      getLocation(context),
      visitIfPresent(context.with(), With.class),
      body.getQueryBody(),
      body.getOrderBy(),
      body.getLimit());
}

代码示例来源:origin: io.prestosql/presto-main

@Override
protected Scope visitQuery(Query node, Optional<Scope> scope)
{
  Scope withScope = analyzeWith(node, scope);
  Scope queryBodyScope = process(node.getQueryBody(), withScope);
  if (node.getOrderBy().isPresent()) {
    analyzeOrderBy(node, queryBodyScope);
  }
  else {
    analysis.setOrderByExpressions(node, emptyList());
  }
  // Input fields == Output fields
  analysis.setOutputExpressions(node, descriptorToFields(queryBodyScope));
  Scope queryScope = Scope.builder()
      .withParent(withScope)
      .withRelationType(RelationId.of(node), queryBodyScope.getRelationType())
      .build();
  analysis.setScope(node, queryScope);
  return queryScope;
}

代码示例来源:origin: prestosql/presto

@Override
protected Scope visitQuery(Query node, Optional<Scope> scope)
{
  Scope withScope = analyzeWith(node, scope);
  Scope queryBodyScope = process(node.getQueryBody(), withScope);
  if (node.getOrderBy().isPresent()) {
    analyzeOrderBy(node, queryBodyScope);
  }
  else {
    analysis.setOrderByExpressions(node, emptyList());
  }
  // Input fields == Output fields
  analysis.setOutputExpressions(node, descriptorToFields(queryBodyScope));
  Scope queryScope = Scope.builder()
      .withParent(withScope)
      .withRelationType(RelationId.of(node), queryBodyScope.getRelationType())
      .build();
  analysis.setScope(node, queryScope);
  return queryScope;
}

相关文章