@Override public String getDisplayString(String[] children) { return getStandardDisplayString(((TopLevelStdUDF) _stdUdf).getFunctionName(), children); } }
@Override public String getDisplayString(String[] children) { return getStandardDisplayString(((TopLevelStdUDF) _stdUdf).getFunctionName(), children); } }
@Override public void setup( Map<Class<? extends TopLevelStdUDF>, List<Class<? extends StdUDF>>> topLevelStdUDFClassesAndImplementations) { topLevelStdUDFClassesAndImplementations.forEach((topLevelStdUDF, stdUDFImplementations) -> { HiveTestStdUDFWrapper wrapper = new HiveTestStdUDFWrapper(topLevelStdUDF, stdUDFImplementations); try { String functionName = ((TopLevelStdUDF) stdUDFImplementations.get(0).getConstructor().newInstance()).getFunctionName(); _functionRegistryAddFunctionMethod.invoke(_functionRegistry, functionName, new FunctionInfo(false, functionName, wrapper)); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException e) { throw new RuntimeException("Error registering UDF " + topLevelStdUDF.getName() + " with Hive Server", e); } }); }
@Override public void setup( Map<Class<? extends TopLevelStdUDF>, List<Class<? extends StdUDF>>> topLevelStdUDFClassesAndImplementations) { _boundVariables = new GenericBoundVariables(); _typeFactory = new GenericTypeFactory(); Map<String, GenericStdUDFWrapper> functionNameToWrapperMap = new HashMap<>(); topLevelStdUDFClassesAndImplementations.forEach((topLevelStdUDF, stdUDFImplementations) -> { GenericStdUDFWrapper wrapper = new GenericStdUDFWrapper(topLevelStdUDF, stdUDFImplementations); try { String functionName = ((TopLevelStdUDF) stdUDFImplementations.get(0).getConstructor().newInstance()).getFunctionName(); functionNameToWrapperMap.put(functionName, wrapper); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException e) { throw new RuntimeException("Error registering UDF " + topLevelStdUDF.getName(), e); } }); _executor = new GenericQueryExecutor(functionNameToWrapperMap); }
protected StdUdfWrapper(StdUDF stdUDF) { super(new Signature(((TopLevelStdUDF) stdUDF).getFunctionName(), FunctionKind.SCALAR, getTypeVariableConstraintsForStdUdf(stdUDF), ImmutableList.of(), parseTypeSignature(stdUDF.getOutputParameterSignature()), stdUDF.getInputParameterSignatures() .stream() .map(TypeSignature::parseTypeSignature) .collect(Collectors.toList()), false)); _functionDescription = ((TopLevelStdUDF) stdUDF).getFunctionDescription(); }
protected StdUdfWrapper(StdUDF stdUDF) { super(new Signature(((TopLevelStdUDF) stdUDF).getFunctionName(), FunctionKind.SCALAR, getTypeVariableConstraintsForStdUdf(stdUDF), ImmutableList.of(), parseTypeSignature(stdUDF.getOutputParameterSignature()), stdUDF.getInputParameterSignatures() .stream() .map(TypeSignature::parseTypeSignature) .collect(Collectors.toList()), false)); _functionDescription = ((TopLevelStdUDF) stdUDF).getFunctionDescription(); }