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

x33g5p2x  于2022-01-20 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(143)

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

GroupBy介绍

暂无

代码示例

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

append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + formatGroupBy(node.getGroupBy().get().getGroupingElements())).append('\n');

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

@Override
public Node visitGroupBy(SqlBaseParser.GroupByContext context)
{
  return new GroupBy(getLocation(context), isDistinct(context.setQuantifier()), visit(context.groupingElement(), GroupingElement.class));
}

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

@Override
protected R visitGroupBy(GroupBy node, C context)
{
  for (GroupingElement groupingElement : node.getGroupingElements()) {
    process(groupingElement, context);
  }
  return null;
}

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

columnOnlyGroupingSets = enumerateGroupingSets(groupingSetAnalysis);
if (node.getGroupBy().get().isDistinct()) {
  columnOnlyGroupingSets = columnOnlyGroupingSets.stream()
      .distinct()

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

for (GroupingElement element : node.getGroupingElements()) {
  try {
    int product;

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

if (node.getGroupBy().get().isDistinct()) {
  distinct = "[DISTINCT]";
for (GroupingElement groupingElement : node.getGroupBy().get().getGroupingElements()) {
  print(indentLevel, "SimpleGroupBy");
  if (groupingElement instanceof SimpleGroupBy) {

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

for (GroupingElement groupingElement : node.getGroupBy().get().getGroupingElements()) {
  if (groupingElement instanceof SimpleGroupBy) {
    for (Expression column : groupingElement.getExpressions()) {

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

Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new SimpleGroupBy(ImmutableList.of(new Identifier("a")))))),
Optional.empty(),
Optional.empty(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(
    new SimpleGroupBy(ImmutableList.of(new Identifier("a"))),
    new SimpleGroupBy(ImmutableList.of(new Identifier("b")))))),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new SimpleGroupBy(ImmutableList.of())))),
Optional.empty(),
Optional.empty(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new GroupingSets(ImmutableList.of(ImmutableList.of(new Identifier("a"))))))),
Optional.empty(),
Optional.empty(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new GroupingSets(ImmutableList.of(ImmutableList.of(new Identifier("a")), ImmutableList.of(new Identifier("b"))))))),
Optional.empty(),
Optional.empty(),

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

@Override
protected Void visitQuerySpecification(QuerySpecification node, Integer indent) {
  process(node.getSelect(), indent);
  if (node.getFrom().isPresent()) {
    append(indent, "FROM");
    builder.append('\n');
    append(indent, "  ");
    process(node.getFrom().get(), indent);
  }
  builder.append('\n');
  if (node.getWhere().isPresent()) {
    append(indent, "WHERE " + formatExpression(node.getWhere().get(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier))
        .append('\n');
  }
  if (node.getGroupBy().isPresent()) {
    append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + formatGroupBy(node.getGroupBy().get().getGroupingElements())).append('\n');
  }
  if (node.getHaving().isPresent()) {
    append(indent, "HAVING " + formatExpression(node.getHaving().get(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier))
        .append('\n');
  }
  if (node.getOrderBy().isPresent()) {
    process(node.getOrderBy().get(), indent);
  }
  if (node.getLimit().isPresent()) {
    append(indent, "LIMIT " + node.getLimit().get())
        .append('\n');
  }
  return null;
}

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

List<GroupBy> groupBy = queryBody.getGroupBy().map(value -> value.getGroupingElements().stream()
    .map(item -> new GroupBy(mapper.apply(item), item.enumerateGroupingSets().toString()))
    .collect(Collectors.toList())).orElse(ImmutableList.of());

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

@Override
public Node visitGroupBy(SqlBaseParser.GroupByContext context)
{
  return new GroupBy(getLocation(context), isDistinct(context.setQuantifier()), visit(context.groupingElement(), GroupingElement.class));
}

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

private List<List<FieldOrExpression>> analyzeGroupBy(QuerySpecification node, RelationType tupleDescriptor, AnalysisContext context, List<FieldOrExpression> outputExpressions)
{
  List<Set<Expression>> computedGroupingSets = ImmutableList.of(); // empty list = no aggregations
  if (node.getGroupBy().isPresent()) {
    List<List<Set<Expression>>> enumeratedGroupingSets = node.getGroupBy().get().getGroupingElements().stream()
        .map(GroupingElement::enumerateGroupingSets)
        .collect(toImmutableList());
    // compute cross product of enumerated grouping sets, if there are any
    computedGroupingSets = computeGroupingSetsCrossProduct(enumeratedGroupingSets, node.getGroupBy().get().isDistinct());
    checkState(!computedGroupingSets.isEmpty(), "computed grouping sets cannot be empty");
  }
  else if (!extractAggregates(node).isEmpty()) {
    // if there are aggregates, but no group by, create a grand total grouping set (global aggregation)
    computedGroupingSets = ImmutableList.of(ImmutableSet.of());
  }
  List<List<FieldOrExpression>> analyzedGroupingSets = computedGroupingSets.stream()
      .map(groupingSet -> analyzeGroupingColumns(groupingSet, node, tupleDescriptor, context, outputExpressions))
      .collect(toImmutableList());
  analysis.setGroupingSets(node, analyzedGroupingSets);
  return analyzedGroupingSets;
}

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

QuerySpecification node = (QuerySpecification) queryBody;
node.getGroupBy().ifPresent(groupBy -> {
  for (GroupingElement groupingElement : groupBy.getGroupingElements()) {
    for (Set<Expression> expressions : groupingElement.enumerateGroupingSets()) {
      for (Expression expression : expressions) {

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

@Override
public Node visitGroupBy(SqlBaseParser.GroupByContext context)
{
  return new GroupBy(getLocation(context), isDistinct(context.setQuantifier()), visit(context.groupingElement(), GroupingElement.class));
}

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

append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + formatGroupBy(node.getGroupBy().get().getGroupingElements())).append('\n');

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

@Override
protected R visitGroupBy(GroupBy node, C context)
{
  for (GroupingElement groupingElement : node.getGroupingElements()) {
    process(groupingElement, context);
  }
  return null;
}

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

equal(nameReference("table_schema"), new StringLiteral(table.getSchemaName())),
    equal(nameReference("table_name"), new StringLiteral(table.getObjectName())))),
Optional.of(new GroupBy(false, ImmutableList.of(new SimpleGroupBy(ImmutableList.of(nameReference("partition_number")))))),
Optional.empty(),
ImmutableList.of(),

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

append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + formatGroupBy(node.getGroupBy().get().getGroupingElements())).append('\n');

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

@Override
protected R visitQuerySpecification(QuerySpecification node, C context)
{
  process(node.getSelect(), context);
  if (node.getFrom().isPresent()) {
    process(node.getFrom().get(), context);
  }
  if (node.getWhere().isPresent()) {
    process(node.getWhere().get(), context);
  }
  if (node.getGroupBy().isPresent()) {
    for (GroupingElement groupingElement : node.getGroupBy().get().getGroupingElements()) {
      process(groupingElement, context);
    }
  }
  if (node.getHaving().isPresent()) {
    process(node.getHaving().get(), context);
  }
  for (SortItem sortItem : node.getOrderBy()) {
    process(sortItem, context);
  }
  return null;
}

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

Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new SimpleGroupBy(ImmutableList.of(new QualifiedNameReference(QualifiedName.of("a"))))))),
Optional.empty(),
ImmutableList.of(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(
    new SimpleGroupBy(ImmutableList.of(new QualifiedNameReference(QualifiedName.of("a")))),
    new SimpleGroupBy(ImmutableList.of(new QualifiedNameReference(QualifiedName.of("b"))))))),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new SimpleGroupBy(ImmutableList.of())))),
Optional.empty(),
ImmutableList.of(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(new GroupingSets(ImmutableList.of(ImmutableList.of(QualifiedName.of("a"))))))),
Optional.empty(),
ImmutableList.of(),
Optional.of(new Table(QualifiedName.of("table1"))),
Optional.empty(),
Optional.of(new GroupBy(false, ImmutableList.of(
    new GroupingSets(
        ImmutableList.of(ImmutableList.of(QualifiedName.of("a"), QualifiedName.of("b")),

相关文章

微信公众号

最新文章

更多