本文整理汇总了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);
}
示例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);
}
示例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);
}
}
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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()]));
}
示例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()]));
}
示例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);
}
示例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;
}