com.facebook.presto.sql.tree.Union类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(146)

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

Union介绍

暂无

代码示例

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

@Override
protected Void visitUnion(Union node, Integer indent)
{
  Iterator<Relation> relations = node.getRelations().iterator();
  while (relations.hasNext()) {
    processRelation(relations.next(), indent);
    if (relations.hasNext()) {
      builder.append("UNION ");
      if (!node.isDistinct()) {
        builder.append("ALL ");
      }
    }
  }
  return null;
}

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

@Test
public void testUnion()
{
  assertStatement("SELECT 123 UNION DISTINCT SELECT 123 UNION ALL SELECT 123",
      new Query(
          Optional.empty(),
          new Union(ImmutableList.of(
              new Union(ImmutableList.of(createSelect123(), createSelect123()), true),
              createSelect123()
          ), false),
          Optional.empty(),
          Optional.empty()));
}

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

@Override
  public int hashCode()
  {
    return Objects.hash(relations, isDistinct());
  }
}

代码示例来源:origin: rakam-io/rakam

statement.getLimit(), statement.getOrderBy().map(v -> v.getSortItems()).orElse(null), map);
} else if (statement.getQueryBody() instanceof Union) {
  Relation relation = ((Union) statement.getQueryBody()).getRelations().get(0);
  while (relation instanceof Union) {
    relation = ((Union) relation).getRelations().get(0);

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

@Override
public boolean equals(Object obj)
{
  if (this == obj) {
    return true;
  }
  if ((obj == null) || (getClass() != obj.getClass())) {
    return false;
  }
  Union o = (Union) obj;
  return Objects.equals(relations, o.relations) &&
      Objects.equals(isDistinct(), o.isDistinct());
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

@Override
protected R visitUnion(Union node, C context)
{
  for (Relation relation : node.getRelations()) {
    process(relation, context);
  }
  return null;
}

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

@Override
protected RelationPlan visitUnion(Union node, Void context)
{
  checkArgument(!node.getRelations().isEmpty(), "No relations specified for UNION");
  SetOperationPlan setOperationPlan = process(node);
  PlanNode planNode = new UnionNode(idAllocator.getNextId(), setOperationPlan.getSources(), setOperationPlan.getSymbolMapping(), ImmutableList.copyOf(setOperationPlan.getSymbolMapping().keySet()));
  if (node.isDistinct()) {
    planNode = distinct(planNode);
  }
  return new RelationPlan(planNode, analysis.getScope(node), planNode.getOutputSymbols());
}

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

@Override
public String toString()
{
  return toStringHelper(this)
      .add("relations", relations)
      .add("distinct", isDistinct())
      .toString();
}

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

@Override
public Node visitSetOperation(SqlBaseParser.SetOperationContext context)
{
  QueryBody left = (QueryBody) visit(context.left);
  QueryBody right = (QueryBody) visit(context.right);
  boolean distinct = context.setQuantifier() == null || context.setQuantifier().DISTINCT() != null;
  switch (context.operator.getType()) {
    case SqlBaseLexer.UNION:
      return new Union(getLocation(context.UNION()), ImmutableList.of(left, right), distinct);
    case SqlBaseLexer.INTERSECT:
      return new Intersect(getLocation(context.INTERSECT()), ImmutableList.of(left, right), distinct);
    case SqlBaseLexer.EXCEPT:
      return new Except(getLocation(context.EXCEPT()), left, right, distinct);
  }
  throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText());
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

@Override
protected RelationType visitUnion(Union node, AnalysisContext context)
  checkState(node.getRelations().size() >= 2);
  RelationType[] descriptors = node.getRelations().stream()
      .map(relation -> process(relation, context).withOnlyVisibleFields())
      .toArray(RelationType[]::new);
  analysis.setOutputDescriptor(node, outputDescriptor);
  for (int i = 0; i < node.getRelations().size(); i++) {
    Relation relation = node.getRelations().get(i);
    RelationType descriptor = descriptors[i];
    for (int j = 0; j < descriptor.getVisibleFields().size(); j++) {

代码示例来源:origin: rakam-io/rakam

@Override
protected Void visitUnion(Union node, Integer indent) {
  Iterator<Relation> relations = node.getRelations().iterator();
  while (relations.hasNext()) {
    processRelation(relations.next(), indent);
    if (relations.hasNext()) {
      builder.append("UNION ");
      if (!node.isDistinct()) {
        builder.append("ALL ");
      }
    }
  }
  return null;
}

代码示例来源:origin: com.facebook.presto/presto-parser

@Override
  public int hashCode()
  {
    return Objects.hash(relations, isDistinct());
  }
}

代码示例来源:origin: stackoverflow.com

@Test
public void Test() throws Exception {
  Union u = new Union("Sindacate", 80);
  UnionController.add(u);
  ServiceCharge charge1 = 
       new ServiceCharge(60,"service for employee","27/11/2016 20:35:00", u); // uncomment your parameter here that accepts Union class type.
  ServiceController.add(charge1, u);
}

代码示例来源:origin: com.facebook.presto/presto-parser

@Override
protected Void visitUnion(Union node, Integer indent)
{
  Iterator<Relation> relations = node.getRelations().iterator();
  while (relations.hasNext()) {
    processRelation(relations.next(), indent);
    if (relations.hasNext()) {
      builder.append("UNION ");
      if (!node.isDistinct()) {
        builder.append("ALL ");
      }
    }
  }
  return null;
}

代码示例来源:origin: com.facebook.presto/presto-parser

@Override
public boolean equals(Object obj)
{
  if (this == obj) {
    return true;
  }
  if ((obj == null) || (getClass() != obj.getClass())) {
    return false;
  }
  Union o = (Union) obj;
  return Objects.equals(relations, o.relations) &&
      Objects.equals(isDistinct(), o.isDistinct());
}

代码示例来源:origin: com.facebook.presto/presto-parser

@Test
public void testUnion()
{
  assertStatement("SELECT 123 UNION DISTINCT SELECT 123 UNION ALL SELECT 123",
      new Query(
          Optional.empty(),
          new Union(ImmutableList.of(
              new Union(ImmutableList.of(createSelect123(), createSelect123()), true),
              createSelect123()
          ), false),
          Optional.empty(),
          Optional.empty()));
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

@Override
protected Void visitUnion(Union node, Integer indent)
{
  Iterator<Relation> relations = node.getRelations().iterator();
  while (relations.hasNext()) {
    processRelation(relations.next(), indent);
    if (relations.hasNext()) {
      builder.append("UNION ");
      if (!node.isDistinct()) {
        builder.append("ALL ");
      }
    }
  }
  return null;
}

代码示例来源:origin: com.facebook.presto/presto-parser

@Override
public String toString()
{
  return toStringHelper(this)
      .add("relations", relations)
      .add("distinct", isDistinct())
      .toString();
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

@Test
public void testUnion()
{
  assertStatement("SELECT 123 UNION DISTINCT SELECT 123 UNION ALL SELECT 123",
      new Query(
          Optional.empty(),
          new Union(ImmutableList.of(
              new Union(ImmutableList.of(createSelect123(), createSelect123()), true),
              createSelect123()
          ), false),
          ImmutableList.<SortItem>of(),
          Optional.empty(),
          Optional.empty()));
}

代码示例来源:origin: vqtran/EchoQuery

@Override
protected Void visitUnion(Union node, Integer indent)
{
  Iterator<Relation> relations = node.getRelations().iterator();
  while (relations.hasNext()) {
    processRelation(relations.next(), indent);
    if (relations.hasNext()) {
      builder.append("UNION ");
      if (!node.isDistinct()) {
        builder.append("ALL ");
      }
    }
  }
  return null;
}

相关文章