本文整理汇总了Java中org.apache.tajo.engine.function.AggFunction类的典型用法代码示例。如果您正苦于以下问题:Java AggFunction类的具体用法?Java AggFunction怎么用?Java AggFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AggFunction类属于org.apache.tajo.engine.function包,在下文中一共展示了AggFunction类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitCountRowsFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
@Override
public EvalNode visitCountRowsFunction(Context ctx, Stack<Expr> stack, CountRowsFunctionExpr expr)
throws PlanningException {
FunctionDesc countRows = catalog.getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
new TajoDataTypes.DataType[] {});
if (countRows == null) {
throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
}
try {
ctx.currentBlock.setAggregationRequire();
return new AggregationFunctionCallEval(countRows, (AggFunction) countRows.newInstance(),
new EvalNode[] {});
} catch (InternalException e) {
throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
}
}
示例2: visitGeneralSetFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
@Override
public EvalNode visitGeneralSetFunction(Context ctx, Stack<Expr> stack, GeneralSetFunctionExpr setFunction)
throws PlanningException {
Expr[] params = setFunction.getParams();
EvalNode[] givenArgs = new EvalNode[params.length];
TajoDataTypes.DataType[] paramTypes = new TajoDataTypes.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].getValueType();
}
if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) {
throw new NoSuchFunctionException(setFunction.getSignature(), paramTypes);
}
FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes);
if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) {
ctx.currentBlock.setAggregationRequire();
}
try {
return new AggregationFunctionCallEval(funcDesc, (AggFunction) funcDesc.newInstance(), givenArgs);
} catch (InternalException e) {
throw new PlanningException(e);
}
}
示例3: registerAdapters
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private static Map<Type, GsonSerDerAdapter> registerAdapters() {
Map<Type, GsonSerDerAdapter> adapters = TUtil.newHashMap();
adapters.put(Path.class, new PathSerializer());
adapters.put(Class.class, new ClassNameSerializer());
adapters.put(LogicalNode.class, new LogicalNodeAdapter());
adapters.put(EvalNode.class, new EvalNodeAdapter());
adapters.put(TableMeta.class, new TableMetaAdapter());
adapters.put(Function.class, new FunctionAdapter());
adapters.put(GeneralFunction.class, new FunctionAdapter());
adapters.put(AggFunction.class, new FunctionAdapter());
adapters.put(Datum.class, new DatumAdapter());
adapters.put(DataType.class, new DataTypeAdapter());
return adapters;
}
示例4: createSumFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private AggregationFunctionCallEval createSumFunction(EvalNode [] args) throws InternalException {
FunctionDesc functionDesc = getCatalog().getFunction("sum", CatalogProtos.FunctionType.AGGREGATION,
args[0].getValueType());
return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
示例5: createCountFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private AggregationFunctionCallEval createCountFunction(EvalNode [] args) throws InternalException {
FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
args[0].getValueType());
return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
示例6: createCountRowFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private AggregationFunctionCallEval createCountRowFunction(EvalNode[] args) throws InternalException {
FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
new TajoDataTypes.DataType[]{});
return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
示例7: createMaxFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private AggregationFunctionCallEval createMaxFunction(EvalNode [] args) throws InternalException {
FunctionDesc functionDesc = getCatalog().getFunction("max", CatalogProtos.FunctionType.AGGREGATION,
args[0].getValueType());
return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
示例8: createMinFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
private AggregationFunctionCallEval createMinFunction(EvalNode [] args) throws InternalException {
FunctionDesc functionDesc = getCatalog().getFunction("min", CatalogProtos.FunctionType.AGGREGATION,
args[0].getValueType());
return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
示例9: visitFunction
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
@Override
public EvalNode visitFunction(Context ctx, Stack<Expr> stack, FunctionExpr expr) throws PlanningException {
stack.push(expr); // <--- Push
// Given parameters
Expr[] params = expr.getParams();
if (params == null) {
params = new Expr[0];
}
EvalNode[] givenArgs = new EvalNode[params.length];
TajoDataTypes.DataType[] paramTypes = new TajoDataTypes.DataType[params.length];
for (int i = 0; i < params.length; i++) {
givenArgs[i] = visit(ctx, stack, params[i]);
paramTypes[i] = givenArgs[i].getValueType();
}
stack.pop(); // <--- Pop
if (!catalog.containFunction(expr.getSignature(), paramTypes)) {
throw new NoSuchFunctionException(expr.getSignature(), paramTypes);
}
FunctionDesc funcDesc = catalog.getFunction(expr.getSignature(), paramTypes);
try {
CatalogProtos.FunctionType functionType = funcDesc.getFuncType();
if (functionType == CatalogProtos.FunctionType.GENERAL
|| functionType == CatalogProtos.FunctionType.UDF) {
return new GeneralFunctionEval(funcDesc, (GeneralFunction) funcDesc.newInstance(), givenArgs);
} else if (functionType == CatalogProtos.FunctionType.AGGREGATION
|| functionType == CatalogProtos.FunctionType.UDA) {
if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) {
ctx.currentBlock.setAggregationRequire();
}
return new AggregationFunctionCallEval(funcDesc, (AggFunction) funcDesc.newInstance(), givenArgs);
} else if (functionType == CatalogProtos.FunctionType.DISTINCT_AGGREGATION
|| functionType == CatalogProtos.FunctionType.DISTINCT_UDA) {
throw new PlanningException("Unsupported function: " + funcDesc.toString());
} else {
throw new PlanningException("Unsupported Function Type: " + functionType.name());
}
} catch (InternalException e) {
throw new PlanningException(e);
}
}
示例10: AggregationFunctionCallEval
import org.apache.tajo.engine.function.AggFunction; //导入依赖的package包/类
public AggregationFunctionCallEval(FunctionDesc desc, AggFunction instance, EvalNode[] givenArgs) {
super(EvalType.AGG_FUNCTION, desc, givenArgs);
this.instance = instance;
}