org.apache.calcite.rel.core.Aggregate.getGroupSets()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(155)

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

Aggregate.getGroupSets介绍

[英]Returns the list of grouping sets computed by this Aggregate.
[中]

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
public boolean matches(final RelOptRuleCall call)
{
 final Aggregate aggregate = call.rel(1);
 return !aggregate.indicator && aggregate.getGroupSets().size() == 1;
}

代码示例来源:origin: apache/incubator-druid

@Override
public boolean matches(final RelOptRuleCall call)
{
 final Aggregate aggregate = call.rel(0);
 final Project project = call.rel(1);
 if (aggregate.indicator || aggregate.getGroupSets().size() != 1) {
  return false;
 }
 for (AggregateCall aggregateCall : aggregate.getAggCallList()) {
  if (isOneArgAggregateCall(aggregateCall)
    && isThreeArgCase(project.getChildExps().get(Iterables.getOnlyElement(aggregateCall.getArgList())))) {
   return true;
  }
 }
 return false;
}

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

/**
 * Do a shallow clone of oldAggRel and update aggCalls. Could be refactored
 * into Aggregate and subclasses - but it's only needed for some
 * subclasses.
 *
 * @param relBuilder Builder of relational expressions; at the top of its
 *                   stack is its input
 * @param oldAggregate LogicalAggregate to clone.
 * @param newCalls  New list of AggregateCalls
 */
protected void newAggregateRel(RelBuilder relBuilder,
  Aggregate oldAggregate, List<AggregateCall> newCalls) {
 relBuilder.aggregate(
   relBuilder.groupKey(oldAggregate.getGroupSet(),
     oldAggregate.getGroupSets()),
   newCalls);
}

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

aggRel.indicator, aggRel.getGroupSet(), aggRel.getGroupSets(),
    newAggCalls);
if (identity) {

代码示例来源:origin: apache/incubator-druid

aggregate.getGroupSets()
);

代码示例来源:origin: apache/incubator-druid

aggregate.indicator,
  aggregate.getGroupSet(),
  aggregate.getGroupSets(),
  newAggregateCalls
);

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

if (aggregate.getGroupSets().size() > 1 || aggregate.getIndicatorCount() > 0
  || fieldsUsed.contains(originalGroupSet)) {

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

relBuilder.aggregate(
  relBuilder.groupKey(Mappings.apply(mapping, aggregate.getGroupSet()),
    Mappings.apply2(mapping, aggregate.getGroupSets())),
  newAggCalls);

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

Mappings.apply2(mapping, aggregate.getGroupSets()), newAggCalls);

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

} else {
 newGroupSets = ImmutableList.copyOf(
   Iterables.transform(aggregate.getGroupSets(),
    input1 -> Mappings.apply(inputMapping, input1)));

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

final MutableRel input = toMutable(aggregate.getInput());
return MutableAggregate.of(input, aggregate.indicator,
  aggregate.getGroupSet(), aggregate.getGroupSets(),
  aggregate.getAggCallList());

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

if (groupBy.indicator) {
 Group aggregateType = Aggregate.Group.induce(groupBy.getGroupSet(),
     groupBy.getGroupSets());
 if (aggregateType == Group.ROLLUP) {
  b = ASTBuilder.construct(HiveParser.TOK_ROLLUP_GROUPBY, "TOK_ROLLUP_GROUPBY");
 for(ImmutableBitSet groupSet: groupBy.getGroupSets()) {
  ASTBuilder expression = ASTBuilder.construct(
      HiveParser.TOK_GROUPING_SETS_EXPRESSION, "TOK_GROUPING_SETS_EXPRESSION");

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

for(ImmutableBitSet groupSet: groupBy.getGroupSets()) {
 ASTBuilder expression = ASTBuilder.construct(
     HiveParser.TOK_GROUPING_SETS_EXPRESSION, "TOK_GROUPING_SETS_EXPRESSION");

代码示例来源:origin: org.apache.druid/druid-sql

@Override
public boolean matches(final RelOptRuleCall call)
{
 final Aggregate aggregate = call.rel(1);
 return !aggregate.indicator && aggregate.getGroupSets().size() == 1;
}

代码示例来源:origin: org.apache.calcite/calcite-core

public Double getMinRowCount(Aggregate rel, RelMetadataQuery mq) {
 if (rel.getGroupSet().isEmpty()) {
  // Aggregate with no GROUP BY always returns 1 row (even on empty table).
  return 1D;
 }
 final Double rowCount = mq.getMinRowCount(rel.getInput());
 if (rowCount != null && rowCount >= 1D) {
  return (double) rel.getGroupSets().size();
 }
 return 0D;
}

代码示例来源:origin: org.apache.calcite/calcite-core

public Double getMaxRowCount(Aggregate rel, RelMetadataQuery mq) {
 if (rel.getGroupSet().isEmpty()) {
  // Aggregate with no GROUP BY always returns 1 row (even on empty table).
  return 1D;
 }
 final Double rowCount = mq.getMaxRowCount(rel.getInput());
 if (rowCount == null) {
  return null;
 }
 return rowCount * rel.getGroupSets().size();
}

代码示例来源:origin: Qihoo360/Quicksql

public Double getMinRowCount(Aggregate rel, RelMetadataQuery mq) {
 if (rel.getGroupSet().isEmpty()) {
  // Aggregate with no GROUP BY always returns 1 row (even on empty table).
  return 1D;
 }
 final Double rowCount = mq.getMinRowCount(rel.getInput());
 if (rowCount != null && rowCount >= 1D) {
  return (double) rel.getGroupSets().size();
 }
 return 0D;
}

代码示例来源:origin: Qihoo360/Quicksql

public Double getMaxRowCount(Aggregate rel, RelMetadataQuery mq) {
 if (rel.getGroupSet().isEmpty()) {
  // Aggregate with no GROUP BY always returns 1 row (even on empty table).
  return 1D;
 }
 final Double rowCount = mq.getMaxRowCount(rel.getInput());
 if (rowCount == null) {
  return null;
 }
 return rowCount * rel.getGroupSets().size();
}

代码示例来源:origin: Qihoo360/Quicksql

public Double getRowCount(Aggregate rel, RelMetadataQuery mq) {
 ImmutableBitSet groupKey = rel.getGroupSet(); // .range(rel.getGroupCount());
 // rowCount is the cardinality of the group by columns
 Double distinctRowCount =
   mq.getDistinctRowCount(rel.getInput(), groupKey, null);
 if (distinctRowCount == null) {
  distinctRowCount = mq.getRowCount(rel.getInput()) / 10;
 }
 // Grouping sets multiply
 distinctRowCount *= rel.getGroupSets().size();
 return distinctRowCount;
}

代码示例来源:origin: org.apache.calcite/calcite-core

public Double getRowCount(Aggregate rel, RelMetadataQuery mq) {
 ImmutableBitSet groupKey = rel.getGroupSet(); // .range(rel.getGroupCount());
 // rowCount is the cardinality of the group by columns
 Double distinctRowCount =
   mq.getDistinctRowCount(rel.getInput(), groupKey, null);
 if (distinctRowCount == null) {
  distinctRowCount = mq.getRowCount(rel.getInput()) / 10;
 }
 // Grouping sets multiply
 distinctRowCount *= rel.getGroupSets().size();
 return distinctRowCount;
}

相关文章