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


Java AggregateCall.getArgList方法代码示例

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


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

示例1: toDrill

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
protected LogicalExpression toDrill(AggregateCall call, List<String> fn) {
  DrillParseContext context = new DrillParseContext(PrelUtil.getSettings(getCluster()));

  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    final int indexInConstants = i - fn.size();
    if (i < fn.size()) {
      args.add(new FieldReference(fn.get(i)));
    } else {
      final RexLiteral constant = constants.get(indexInConstants);
      LogicalExpression expr = DrillOptiq.toDrill(context, getInput(), constant);
      args.add(expr);
    }
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }

  return new FunctionCall(call.getAggregation().getName().toLowerCase(), args, ExpressionPosition.UNKNOWN);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:WindowPrel.java

示例2: toExpr

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
protected LogicalExpression toExpr(AggregateCall call, List<String> fn) {
  ParseContext context = new ParseContext(PrelUtil.getSettings(getCluster()));

  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    final int indexInConstants = i - fn.size();
    if (i < fn.size()) {
      args.add(new FieldReference(fn.get(i)));
    } else {
      final RexLiteral constant = constants.get(indexInConstants);
      LogicalExpression expr = RexToExpr.toExpr(context, getInput(), constant);
      args.add(expr);
    }
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }

  return new FunctionCall(call.getAggregation().getName().toLowerCase(), args);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:WindowPrel.java

示例3: setAggChildKeys

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
/**
 * Takes a bitmap representing a set of input references and extracts the
 * ones that reference the group by columns in an aggregate.
 *
 * @param groupKey the original bitmap
 * @param aggRel   the aggregate
 * @param childKey sets bits from groupKey corresponding to group by columns
 */
public static void setAggChildKeys(
    ImmutableBitSet groupKey,
    Aggregate aggRel,
    ImmutableBitSet.Builder childKey) {
  List<AggregateCall> aggCalls = aggRel.getAggCallList();
  for (int bit : groupKey) {
    if (bit < aggRel.getGroupCount()) {
      // group by column
      childKey.set(bit);
    } else {
      // aggregate column -- set a bit for each argument being
      // aggregated
      AggregateCall agg = aggCalls.get(bit
          - (aggRel.getGroupCount() + aggRel.getIndicatorCount()));
      for (Integer arg : agg.getArgList()) {
        childKey.set(arg);
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:RelMdUtil.java

示例4: singleton

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * <p>{@code COUNT(*)}, and {@code COUNT} applied to all NOT NULL arguments,
 * become {@code 1}; otherwise
 * {@code CASE WHEN arg0 IS NOT NULL THEN 1 ELSE 0 END}.
 */
public RexNode singleton(RexBuilder rexBuilder, RelDataType inputRowType,
    AggregateCall aggregateCall) {
  final List<RexNode> predicates = new ArrayList<>();
  for (Integer arg : aggregateCall.getArgList()) {
    final RelDataType type = inputRowType.getFieldList().get(arg).getType();
    if (type.isNullable()) {
      predicates.add(
          rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL,
              rexBuilder.makeInputRef(type, arg)));
    }
  }
  final RexNode predicate =
      RexUtil.composeConjunction(rexBuilder, predicates, true);
  if (predicate == null) {
    return rexBuilder.makeExactLiteral(BigDecimal.ONE);
  } else {
    return rexBuilder.makeCall(SqlStdOperatorTable.CASE, predicate,
        rexBuilder.makeExactLiteral(BigDecimal.ONE),
        rexBuilder.makeExactLiteral(BigDecimal.ZERO));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:SqlSplittableAggFunction.java

示例5: addAggCall

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
/**
 * Creates a reference to an aggregate call, checking for repeated calls.
 *
 * <p>Argument types help to optimize for repeated aggregates.
 * For instance count(42) is equivalent to count(*).</p>
 *
 * @param aggCall aggregate call to be added
 * @param groupCount number of groups in the aggregate relation
 * @param indicator Whether the Aggregate has indicator (GROUPING) columns
 * @param aggCalls destination list of aggregate calls
 * @param aggCallMapping the dictionary of already added calls
 * @param aggArgTypes Argument types, not null
 *
 * @return Rex expression for the given aggregate call
 */
public RexNode addAggCall(AggregateCall aggCall, int groupCount,
    boolean indicator, List<AggregateCall> aggCalls,
    Map<AggregateCall, RexNode> aggCallMapping,
    final List<RelDataType> aggArgTypes) {
  if (aggCall.getAggregation() instanceof SqlCountAggFunction
      && !aggCall.isDistinct()) {
    final List<Integer> args = aggCall.getArgList();
    final List<Integer> nullableArgs = nullableArgs(args, aggArgTypes);
    if (!nullableArgs.equals(args)) {
      aggCall = aggCall.copy(nullableArgs, aggCall.filterArg);
    }
  }
  RexNode rex = aggCallMapping.get(aggCall);
  if (rex == null) {
    int index = aggCalls.size() + groupCount * (indicator ? 2 : 1);
    aggCalls.add(aggCall);
    rex = makeInputRef(aggCall.getType(), index);
    aggCallMapping.put(aggCall, rex);
  }
  return rex;
}
 
开发者ID:apache,项目名称:calcite,代码行数:37,代码来源:RexBuilder.java

示例6: toDrill

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
protected LogicalExpression toDrill(AggregateCall call, List<String> fn) {
  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    args.add(new FieldReference(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args, ExpressionPosition.UNKNOWN);
  return expr;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:DrillWindowRel.java

示例7: toDrill

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
public static LogicalExpression toDrill(AggregateCall call, List<String> fn, DrillImplementor implementor) {
  List<LogicalExpression> args = Lists.newArrayList();
  for(Integer i : call.getArgList()) {
    args.add(new FieldReference(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = FunctionCallFactory.createExpression(call.getAggregation().getName().toLowerCase(), ExpressionPosition.UNKNOWN, args);
  return expr;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:DrillAggregateRel.java

示例8: toDrill

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
protected LogicalExpression toDrill(AggregateCall call, List<String> fn) {
  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    args.add(FieldReference.getWithQuotedRef(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args, ExpressionPosition.UNKNOWN );
  return expr;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:AggPrelBase.java

示例9: toExpr

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
public static LogicalExpression toExpr(AggregateCall call, List<String> fn, LogicalPlanImplementor implementor) {
  List<LogicalExpression> args = Lists.newArrayList();
  for(Integer i : call.getArgList()) {
    args.add(new FieldReference(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = FunctionCallFactory.createExpression(call.getAggregation().getName().toLowerCase(), args);
  return expr;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:AggregateRel.java

示例10: toExpr

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
protected LogicalExpression toExpr(AggregateCall call, List<String> fn) {
  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    args.add(new FieldReference(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args);
  return expr;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:WindowRel.java

示例11: toExpr

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
private static LogicalExpression toExpr(AggregateCall call, List<String> fn) {
  List<LogicalExpression> args = Lists.newArrayList();
  for (Integer i : call.getArgList()) {
    args.add(FieldReference.getWithQuotedRef(fn.get(i)));
  }

  // for count(1).
  if (args.isEmpty()) {
    args.add(new ValueExpressions.LongExpression(1l));
  }
  LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args );
  return expr;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:RexToExpr.java

示例12: toSql

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
/**
 * Converts a call to an aggregate function to an expression.
 */
final SqlNode toSql(AggregateCall aggCall) {
    SqlOperator op = aggCall.getAggregation();
    if (op instanceof SqlSumEmptyIsZeroAggFunction) {
        op = SqlStdOperatorTable.SUM;
    }
    final List<SqlNode> operands = Expressions.list();
    for (int arg : aggCall.getArgList()) {
        operands.add(field(arg));
    }
    return op.createCall(
            aggCall.isDistinct() ? SqlSelectKeyword.DISTINCT.symbol(POS) : null,
            POS, operands.toArray(new SqlNode[operands.size()]));
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:17,代码来源:JdbcImplementor.java

示例13: toSql

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
/**
 * Converts a call to an aggregate function to an expression.
 */
public SqlNode toSql(AggregateCall aggCall) {
  SqlOperator op = (SqlAggFunction) aggCall.getAggregation();
  if (op instanceof SqlSumEmptyIsZeroAggFunction) {
    op = SqlStdOperatorTable.SUM;
  }
  final List<SqlNode> operands = Expressions.list();
  for (int arg : aggCall.getArgList()) {
    operands.add(field(arg));
  }
  return op.createCall(
      aggCall.isDistinct() ? SqlSelectKeyword.DISTINCT.symbol(POS) : null,
      POS, operands.toArray(new SqlNode[operands.size()]));
}
 
开发者ID:qubole,项目名称:quark,代码行数:17,代码来源:RelToSqlConverter.java

示例14: toSqlCall

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
SQLCall toSqlCall(AggregateCall aggCall) {
    ColumnRowType inputColumnRowType = ((OLAPRel) getInput()).getColumnRowType();

    String function = getSqlFuncName(aggCall);
    List<Object> args = Lists.newArrayList();
    for (Integer index : aggCall.getArgList()) {
        TblColRef col = inputColumnRowType.getColumnByIndexNullable(index);
        args.add(col);
    }
    return new SQLCall(function, args);
}
 
开发者ID:apache,项目名称:kylin,代码行数:12,代码来源:OLAPAggregateRel.java

示例15: getArgNames

import org.apache.calcite.rel.core.AggregateCall; //导入方法依赖的package包/类
private List<String> getArgNames(String relAlias, AggregateCall aggCall) {
  final List<String> result = new ArrayList<>(aggCall.getArgList().size());
  for (int fieldIndex : aggCall.getArgList()) {
    result.add(getInputFieldNameForAggCall(relAlias, aggCall, fieldIndex));
  }
  return result;
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:PigAggregate.java


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