public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType( SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); }
public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType( SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); }
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType(SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); } }
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType(SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); } }
public RexNode convertAggregateFunction( SqlRexContext cx, SqlAggFunction fun, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final List<RexNode> exprs; if (call.isCountStar()) { exprs = ImmutableList.of(); } else { exprs = convertExpressionList(cx, operands, SqlOperandTypeChecker.Consistency.NONE); } RelDataType returnType = cx.getValidator().getValidatedNodeTypeIfKnown(call); final int groupCount = cx.getGroupCount(); if (returnType == null) { RexCallBinding binding = new RexCallBinding(cx.getTypeFactory(), fun, exprs, ImmutableList.of()) { @Override public int getGroupCount() { return groupCount; } }; returnType = fun.inferReturnType(binding); } return cx.getRexBuilder().makeCall(returnType, fun, exprs); }
public RexNode convertAggregateFunction( SqlRexContext cx, SqlAggFunction fun, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final List<RexNode> exprs; if (call.isCountStar()) { exprs = ImmutableList.of(); } else { exprs = convertExpressionList(cx, operands, SqlOperandTypeChecker.Consistency.NONE); } RelDataType returnType = cx.getValidator().getValidatedNodeTypeIfKnown(call); final int groupCount = cx.getGroupCount(); if (returnType == null) { RexCallBinding binding = new RexCallBinding(cx.getTypeFactory(), fun, exprs, ImmutableList.of()) { @Override public int getGroupCount() { return groupCount; } }; returnType = fun.inferReturnType(binding); } return cx.getRexBuilder().makeCall(returnType, fun, exprs); }