private static Collection<FunctionDesc> buildFunctionDescs(ScalarFunction annotation, Method method) { List<FunctionDesc> functionDescs = Lists.newArrayList(); FunctionInvocation invocation = new FunctionInvocation(); invocation.setScalar(extractStaticMethodInvocation(method)); FunctionSupplement supplement = extractSupplement(annotation); // primary name functionDescs.add(new FunctionDesc(extractSignature(annotation, null), invocation, supplement)); // for multiple aliases for (String alias : annotation.synonyms()) { functionDescs.add(new FunctionDesc(extractSignature(annotation, alias), invocation, supplement)); } return functionDescs; }
private static Collection<FunctionDesc> buildFunctionDescs(ScalarFunction annotation, Method method) { List<FunctionDesc> functionDescs = Lists.newArrayList(); FunctionInvocation invocation = new FunctionInvocation(); invocation.setScalar(extractStaticMethodInvocation(method)); FunctionSupplement supplement = extractSupplement(annotation); // primary name functionDescs.add(new FunctionDesc(extractSignature(annotation, null), invocation, supplement)); // for multiple aliases for (String alias : annotation.synonyms()) { functionDescs.add(new FunctionDesc(extractSignature(annotation, alias), invocation, supplement)); } return functionDescs; }
@Override public final Collection<FunctionDesc> getFunctions() { List<FunctionDesc> list = new ArrayList<FunctionDesc>(); try { final BlockingInterface stub = getStub(); final GetFunctionsResponse response = stub.getFunctions(null, NullProto.newBuilder().build()); ensureOk(response.getState()); for (int i = 0; i < response.getFunctionDescCount(); i++) { try { list.add(new FunctionDesc(response.getFunctionDesc(i))); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } return list; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final Collection<FunctionDesc> getFunctions() { List<FunctionDesc> list = new ArrayList<>(); try { final BlockingInterface stub = getStub(); final GetFunctionsResponse response = stub.getFunctions(null, NullProto.newBuilder().build()); ensureOk(response.getState()); for (int i = 0; i < response.getFunctionDescCount(); i++) { try { list.add(new FunctionDesc(response.getFunctionDesc(i))); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } return list; } catch (ServiceException e) { throw new RuntimeException(e); } }
FunctionDesc functionDesc = new FunctionDesc(eachFunctionName, function.getClass(), function.getFunctionType(), CatalogUtil.newSimpleDataType(returnType),
FunctionDesc functionDesc = new FunctionDesc(eachFunctionName, function.getClass(), function.getFunctionType(), CatalogUtil.newSimpleDataType(returnType),
UDFInvocationDesc invocationDesc = new UDFInvocationDesc(CatalogProtos.UDFtype.PYTHON, scalarFuncInfo.funcName, path.getPath(), true); invocation.setUDF(invocationDesc); functionDescs.add(new FunctionDesc(signature, invocation, supplement)); } else { AggFuncInfo aggFuncInfo = (AggFuncInfo) funcInfo; functionDescs.add(new FunctionDesc(signature, invocation, supplement));
PythonInvocationDesc invocationDesc = new PythonInvocationDesc(scalarFuncInfo.funcName, path.getPath(), true); invocation.setPython(invocationDesc); functionDescs.add(new FunctionDesc(signature, invocation, supplement)); } else { AggFuncInfo aggFuncInfo = (AggFuncInfo) funcInfo; functionDescs.add(new FunctionDesc(signature, invocation, supplement));
public FunctionDesc build() { FunctionInvocation invocation = new FunctionInvocation(); if (funcType == FunctionType.UDF) { invocation.setUDF(udfInvocation); } else { invocation.setLegacy(new ClassBaseInvocationDesc<>(clazz)); } FunctionSupplement supplement = new FunctionSupplement(); if (description != null) { supplement.setShortDescription(description); } if (example != null) { supplement.setExample(example); } FunctionSignature signature = new FunctionSignature(funcType, name, retType, isDeterministic, params); return new FunctionDesc(signature, invocation, supplement); } }
@Override public final FunctionDesc getFunction(final String signature, FunctionType funcType, DataType... paramTypes) throws AmbiguousFunctionException, UndefinedFunctionException { final GetFunctionMetaRequest.Builder builder = GetFunctionMetaRequest.newBuilder(); builder.setSignature(signature); if (funcType != null) { builder.setFunctionType(funcType); } for (DataType type : paramTypes) { builder.addParameterTypes(type); } try { final BlockingInterface stub = getStub(); final FunctionResponse response = stub.getFunctionMeta(null, builder.build()); throwsIfThisError(response.getState(), UndefinedFunctionException.class); ensureOk(response.getState()); return new FunctionDesc(response.getFunction()); } catch (ServiceException se) { throw new RuntimeException(se); } catch (ClassNotFoundException e) { throw new TajoInternalError(e); } }
@Override public final FunctionDesc getFunction(final String signature, FunctionType funcType, DataType... paramTypes) throws AmbiguousFunctionException, UndefinedFunctionException { final GetFunctionMetaRequest.Builder builder = GetFunctionMetaRequest.newBuilder(); builder.setSignature(signature); if (funcType != null) { builder.setFunctionType(funcType); } for (DataType type : paramTypes) { builder.addParameterTypes(type); } try { final BlockingInterface stub = getStub(); final FunctionResponse response = stub.getFunctionMeta(null, builder.build()); throwsIfThisError(response.getState(), UndefinedFunctionException.class); ensureOk(response.getState()); return new FunctionDesc(response.getFunction()); } catch (ServiceException se) { throw new RuntimeException(se); } catch (ClassNotFoundException e) { throw new TajoInternalError(e); } }
funcDesc = new FunctionDesc(funcProto.getFuncion()); if (type == EvalType.FUNCTION) { current = new GeneralFunctionEval(context, funcDesc, params); if (type == EvalType.AGG_FUNCTION) { AggregationFunctionCallEval aggFunc = new AggregationFunctionCallEval(new FunctionDesc(funcProto.getFuncion()), params); new WindowFunctionEval(new FunctionDesc(funcProto.getFuncion()), params, convertWindowFrame(windowFuncProto.getWindowFrame()));
funcDesc = new FunctionDesc(funcProto.getFuncion()); if (type == EvalType.FUNCTION) { current = new GeneralFunctionEval(context, funcDesc, params); if (type == EvalType.AGG_FUNCTION) { AggregationFunctionCallEval aggFunc = new AggregationFunctionCallEval(new FunctionDesc(funcProto.getFuncion()), params); new WindowFunctionEval(new FunctionDesc(funcProto.getFuncion()), params, convertWindowFrame(windowFuncProto.getWindowFrame()));
catalog.createTable(score); FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.AGGREGATION, CatalogUtil.newSimpleDataType(Type.INT4), CatalogUtil.newSimpleDataTypeArray(Type.INT4));
catalog.createTable(desc); FunctionDesc funcMeta = new FunctionDesc("test_sum", TestSum.class, FunctionType.GENERAL, CatalogUtil.newSimpleDataType(TajoDataTypes.Type.INT4),
catalog.createTable(score); FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.AGGREGATION, CatalogUtil.newSimpleDataType(Type.INT4), CatalogUtil.newSimpleDataTypeArray(Type.INT4));
catalog.createTable(score); FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.GENERAL, CatalogUtil.newSimpleDataType(Type.INT4), CatalogUtil.newSimpleDataTypeArray(Type.INT4));