@Override public DataType visitCountRowsFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) throws TajoException { FunctionDesc countRows = catalog.getFunction("count", CatalogProtos.FunctionType.AGGREGATION, new DataType[] {}); return countRows.getReturnType(); }
@Override public DataType visitCountRowsFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) throws TajoException { FunctionDesc countRows = catalog.getFunction("count", CatalogProtos.FunctionType.AGGREGATION, new DataType[] {}); return countRows.getReturnType(); }
private AggregationFunctionCallEval createCountRowFunction(EvalNode[] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION, new TajoDataTypes.DataType[]{}); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createCountRowFunction(EvalNode[] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION, new TajoDataTypes.DataType[]{}); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createMinFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("min", CatalogProtos.FunctionType.AGGREGATION, args[0].getValueType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createSumFunction(EvalNode[] args) throws TajoException { FunctionDesc functionDesc = null; functionDesc = getCatalog().getFunction("sum", CatalogProtos.FunctionType.AGGREGATION, args[0].getValueType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createCountFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION, args[0].getValueType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createMaxFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("max", CatalogProtos.FunctionType.AGGREGATION, args[0].getValueType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createSumFunction(EvalNode[] args) throws TajoException { FunctionDesc functionDesc = null; functionDesc = getCatalog().getFunction("sum", CatalogProtos.FunctionType.AGGREGATION, TypeConverter.convert(args[0].getValueType()).getDataType()); return new AggregationFunctionCallEval(functionDesc, args); }
@Override public EvalNode visitCountRowsFunction(Context ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) throws TajoException { FunctionDesc countRows = catalog.getFunction("count", FunctionType.AGGREGATION, new DataType[] {}); if (countRows == null) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(expr.getSignature(), new DataType[]{})); } ctx.currentBlock.setAggregationRequire(); return new AggregationFunctionCallEval(countRows, new EvalNode[] {}); }
@Override public EvalNode visitCountRowsFunction(Context ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) throws TajoException { FunctionDesc countRows = catalog.getFunction("count", FunctionType.AGGREGATION, new DataType[] {}); if (countRows == null) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(expr.getSignature(), new DataType[]{})); } ctx.currentBlock.setAggregationRequire(); return new AggregationFunctionCallEval(countRows, new EvalNode[] {}); }
private AggregationFunctionCallEval createCountFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION, TypeConverter.convert(args[0].getValueType()).getDataType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createMaxFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("max", CatalogProtos.FunctionType.AGGREGATION, TypeConverter.convert(args[0].getValueType()).getDataType()); return new AggregationFunctionCallEval(functionDesc, args); }
private AggregationFunctionCallEval createMinFunction(EvalNode [] args) throws TajoException { FunctionDesc functionDesc = getCatalog().getFunction("min", CatalogProtos.FunctionType.AGGREGATION, TypeConverter.convert(args[0].getValueType()).getDataType()); return new AggregationFunctionCallEval(functionDesc, args); }
@Override public DataType visitFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, FunctionExpr expr) throws TajoException { stack.push(expr); // <--- Push // Given parameters Expr[] params = expr.getParams(); if (params == null) { params = new Expr[0]; } DataType[] givenArgs = new DataType[params.length]; DataType[] paramTypes = new DataType[params.length]; for (int i = 0; i < params.length; i++) { givenArgs[i] = visit(ctx, stack, params[i]); paramTypes[i] = givenArgs[i]; } stack.pop(); // <--- Pop if (!catalog.containFunction(expr.getSignature(), paramTypes)) { throw new UndefinedFunctionException(FunctionUtil.buildSimpleFunctionSignature(expr.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(expr.getSignature(), paramTypes); return funcDesc.getReturnType(); }
@Override public DataType visitFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, FunctionExpr expr) throws TajoException { stack.push(expr); // <--- Push // Given parameters Expr[] params = expr.getParams(); if (params == null) { params = new Expr[0]; } DataType[] givenArgs = new DataType[params.length]; DataType[] paramTypes = new DataType[params.length]; for (int i = 0; i < params.length; i++) { givenArgs[i] = visit(ctx, stack, params[i]); paramTypes[i] = givenArgs[i]; } stack.pop(); // <--- Pop if (!catalog.containFunction(expr.getSignature(), paramTypes)) { throw new UndefinedFunctionException(FunctionUtil.buildSimpleFunctionSignature(expr.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(expr.getSignature(), paramTypes); return funcDesc.getReturnType(); }
@Override public DataType visitGeneralSetFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, GeneralSetFunctionExpr setFunction) throws TajoException { stack.push(setFunction); Expr[] params = setFunction.getParams(); DataType[] givenArgs = new DataType[params.length]; DataType[] paramTypes = new DataType[params.length]; CatalogProtos.FunctionType functionType = setFunction.isDistinct() ? CatalogProtos.FunctionType.DISTINCT_AGGREGATION : CatalogProtos.FunctionType.AGGREGATION; givenArgs[0] = visit(ctx, stack, params[0]); if (setFunction.getSignature().equalsIgnoreCase("count")) { paramTypes[0] = CatalogUtil.newSimpleDataType(TajoDataTypes.Type.ANY); } else { paramTypes[0] = givenArgs[0]; } stack.pop(); // <-- pop if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(setFunction.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes); return funcDesc.getReturnType(); }
@Override public DataType visitGeneralSetFunction(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, GeneralSetFunctionExpr setFunction) throws TajoException { stack.push(setFunction); Expr[] params = setFunction.getParams(); DataType[] givenArgs = new DataType[params.length]; DataType[] paramTypes = new DataType[params.length]; CatalogProtos.FunctionType functionType = setFunction.isDistinct() ? CatalogProtos.FunctionType.DISTINCT_AGGREGATION : CatalogProtos.FunctionType.AGGREGATION; givenArgs[0] = visit(ctx, stack, params[0]); if (setFunction.getSignature().equalsIgnoreCase("count")) { paramTypes[0] = CatalogUtil.newSimpleDataType(TajoDataTypes.Type.ANY); } else { paramTypes[0] = givenArgs[0]; } stack.pop(); // <-- pop if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(setFunction.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes); return funcDesc.getReturnType(); }
@Override public EvalNode visitGeneralSetFunction(Context ctx, Stack<Expr> stack, GeneralSetFunctionExpr setFunction) throws TajoException { Expr[] params = setFunction.getParams(); EvalNode[] givenArgs = new EvalNode[params.length]; DataType[] paramTypes = new DataType[params.length]; FunctionType functionType = setFunction.isDistinct() ? FunctionType.DISTINCT_AGGREGATION : FunctionType.AGGREGATION; givenArgs[0] = visit(ctx, stack, params[0]); if (setFunction.getSignature().equalsIgnoreCase("count")) { paramTypes[0] = CatalogUtil.newSimpleDataType(Type.ANY); } else { paramTypes[0] = givenArgs[0].getValueType(); } if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(setFunction.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes); if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) { ctx.currentBlock.setAggregationRequire(); } return new AggregationFunctionCallEval(funcDesc, givenArgs); }
@Override public EvalNode visitGeneralSetFunction(Context ctx, Stack<Expr> stack, GeneralSetFunctionExpr setFunction) throws TajoException { Expr[] params = setFunction.getParams(); EvalNode[] givenArgs = new EvalNode[params.length]; DataType[] paramTypes = new DataType[params.length]; FunctionType functionType = setFunction.isDistinct() ? FunctionType.DISTINCT_AGGREGATION : FunctionType.AGGREGATION; givenArgs[0] = visit(ctx, stack, params[0]); if (setFunction.getSignature().equalsIgnoreCase("count")) { paramTypes[0] = CatalogUtil.newSimpleDataType(TajoDataTypes.Type.ANY); } else { paramTypes[0] = convert(givenArgs[0].getValueType()).getDataType(); } if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) { throw new UndefinedFunctionException(buildSimpleFunctionSignature(setFunction.getSignature(), paramTypes)); } FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes); if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) { ctx.currentBlock.setAggregationRequire(); } return new AggregationFunctionCallEval(funcDesc, givenArgs); }