当前位置: 首页>>代码示例>>Java>>正文


Java SqlStdOperatorTable.SUM0属性代码示例

本文整理汇总了Java中org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM0属性的典型用法代码示例。如果您正苦于以下问题:Java SqlStdOperatorTable.SUM0属性的具体用法?Java SqlStdOperatorTable.SUM0怎么用?Java SqlStdOperatorTable.SUM0使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.calcite.sql.fun.SqlStdOperatorTable的用法示例。


在下文中一共展示了SqlStdOperatorTable.SUM0属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteAggregateCall

@SuppressWarnings("deprecation")
private AggregateCall rewriteAggregateCall(AggregateCall aggCall, FunctionDesc func) {
    // rebuild function
    String callName = getSqlFuncName(aggCall);
    RelDataType fieldType = aggCall.getType();
    SqlAggFunction newAgg = aggCall.getAggregation();
    
    Map<String, Class<?>> udafMap = func.getMeasureType().getRewriteCalciteAggrFunctions();
    if (func.isCount()) {
        newAgg = SqlStdOperatorTable.SUM0;
    } else if (udafMap != null && udafMap.containsKey(callName)) {
        newAgg = createCustomAggFunction(callName, fieldType, udafMap.get(callName));
    }

    // rebuild parameters
    List<Integer> newArgList = Lists.newArrayList(aggCall.getArgList());
    if (udafMap != null && udafMap.containsKey(callName)) {
        newArgList = truncArgList(newArgList, udafMap.get(callName));
    }
    if (func.needRewriteField()) {
        RelDataTypeField field = getInput().getRowType().getField(func.getRewriteFieldName(), true, false);
        if (newArgList.isEmpty()) {
            newArgList.add(field.getIndex());
        } else {
            // TODO: only the first column got overwritten
            newArgList.set(0, field.getIndex());
        }
    }

    // rebuild aggregate call
    AggregateCall newAggCall = new AggregateCall(newAgg, false, newArgList, fieldType, callName);

    return newAggCall;
}
 
开发者ID:apache,项目名称:kylin,代码行数:34,代码来源:OLAPAggregateRel.java

示例2: transformAggCalls

private List<AggregateCall> transformAggCalls(RelNode input, int groupCount,
    List<AggregateCall> origCalls) {
  final List<AggregateCall> newCalls = Lists.newArrayList();
  for (Ord<AggregateCall> ord : Ord.zip(origCalls)) {
    final AggregateCall origCall = ord.e;
    if (origCall.isDistinct()
        || !SUPPORTED_AGGREGATES.containsKey(origCall.getAggregation()
            .getClass())) {
      return null;
    }
    final SqlAggFunction aggFun;
    final RelDataType aggType;
    if (origCall.getAggregation() == SqlStdOperatorTable.COUNT) {
      aggFun = SqlStdOperatorTable.SUM0;
      // count(any) is always not null, however nullability of sum might
      // depend on the number of columns in GROUP BY.
      // Here we use SUM0 since we are sure we will not face nullable
      // inputs nor we'll face empty set.
      aggType = null;
    } else {
      aggFun = origCall.getAggregation();
      aggType = origCall.getType();
    }
    AggregateCall newCall =
        AggregateCall.create(aggFun, origCall.isDistinct(),
            origCall.isApproximate(),
            ImmutableList.of(groupCount + ord.i), -1, groupCount, input,
            aggType, origCall.getName());
    newCalls.add(newCall);
  }
  return newCalls;
}
 
开发者ID:apache,项目名称:calcite,代码行数:32,代码来源:AggregateUnionTransposeRule.java

示例3: getRollup

public static SqlAggFunction getRollup(SqlAggFunction aggregation) {
  if (aggregation == SqlStdOperatorTable.SUM
      || aggregation == SqlStdOperatorTable.MIN
      || aggregation == SqlStdOperatorTable.MAX
      || aggregation == SqlStdOperatorTable.SUM0) {
    return aggregation;
  } else if (aggregation == SqlStdOperatorTable.COUNT) {
    return SqlStdOperatorTable.SUM0;
  } else {
    return null;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SubstitutionVisitor.java

示例4: getMergeAggFunctionOfTopSplit

@Override public SqlAggFunction getMergeAggFunctionOfTopSplit() {
  return SqlStdOperatorTable.SUM0;
}
 
开发者ID:apache,项目名称:calcite,代码行数:3,代码来源:SqlSplittableAggFunction.java


注:本文中的org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM0属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。