/** * Returns an array of booleans indicating if any input argument is nullable. * * Nullable arguments are arguments that can receive a null value. For a nullable argument, the user must explicitly * handle null values in their implementation. For a non-nullable argument, the UDF returns null if the argument * is null. The length of the returned array should be equal to the number of input arguments. Defaults to all * arguments being non-nullable. */ public boolean[] getNullableArguments() { return new boolean[numberOfArguments()]; }
switch (args.length) { case 0: requiredFiles = ((StdUDF0) stdUDF).getRequiredFiles(); break; case 1: requiredFiles = ((StdUDF1) stdUDF).getRequiredFiles(args[0]); break; case 2: requiredFiles = ((StdUDF2) stdUDF).getRequiredFiles(args[0], args[1]); break; case 3: requiredFiles = ((StdUDF3) stdUDF).getRequiredFiles(args[0], args[1], args[2]); break; case 4: requiredFiles = ((StdUDF4) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3]); break; case 5: requiredFiles = ((StdUDF5) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4]); break; case 6: requiredFiles = ((StdUDF6) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5]); break; case 7: requiredFiles = ((StdUDF7) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break; case 8: requiredFiles = ((StdUDF8) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
/** Returns an array of booleans indicating if any input argument is nullable and also verifies its length */ public final boolean[] getAndCheckNullableArguments() { boolean[] nullableArguments = getNullableArguments(); if (nullableArguments.length != numberOfArguments()) { throw new RuntimeException( "Unexpected number of nullable arguments. Expected:" + numberOfArguments() + " Received:" + nullableArguments.length); } return nullableArguments; }
switch (args.length) { case 0: result = ((StdUDF0) _stdUdf).eval(); break; case 1: result = ((StdUDF1) _stdUdf).eval(args[0]); break; case 2: result = ((StdUDF2) _stdUdf).eval(args[0], args[1]); break; case 3: result = ((StdUDF3) _stdUdf).eval(args[0], args[1], args[2]); break; case 4: result = ((StdUDF4) _stdUdf).eval(args[0], args[1], args[2], args[3]); break; case 5: result = ((StdUDF5) _stdUdf).eval(args[0], args[1], args[2], args[3], args[4]); break; case 6: result = ((StdUDF6) _stdUdf).eval(args[0], args[1], args[2], args[3], args[4], args[5]); break; case 7: result = ((StdUDF7) _stdUdf).eval(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break; case 8: result = ((StdUDF8) _stdUdf).eval(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); break; default:
@Override public String getDisplayString(String[] children) { return getStandardDisplayString(((TopLevelStdUDF) _stdUdf).getFunctionName(), children); } }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _mapType = getStdFactory().createStdType(getOutputParameterSignature()); }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _mapType = getStdFactory().createStdType(getOutputParameterSignature()); }
private StdData[] wrapArguments(StdUDF stdUDF, Type[] types, Object[] arguments) { StdFactory stdFactory = stdUDF.getStdFactory(); StdData[] stdData = new StdData[arguments.length]; // TODO: Reuse wrapper objects by creating them once upon initialization and reuse them here // along the same lines of what we do in Hive implementation. // JIRA: https://jira01.corp.linkedin.com:8443/browse/LIHADOOP-34894 for (int i = 0; i < stdData.length; i++) { stdData[i] = PrestoWrapper.createStdData(arguments[i], types[i], stdFactory); } return stdData; }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _field1Type = getStdFactory().createStdType("K"); _field2Type = getStdFactory().createStdType("V"); }
switch (args.length) { case 0: requiredFiles = ((StdUDF0) stdUDF).getRequiredFiles(); break; case 1: requiredFiles = ((StdUDF1) stdUDF).getRequiredFiles(args[0]); break; case 2: requiredFiles = ((StdUDF2) stdUDF).getRequiredFiles(args[0], args[1]); break; case 3: requiredFiles = ((StdUDF3) stdUDF).getRequiredFiles(args[0], args[1], args[2]); break; case 4: requiredFiles = ((StdUDF4) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3]); break; case 5: requiredFiles = ((StdUDF5) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4]); break; case 6: requiredFiles = ((StdUDF6) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5]); break; case 7: requiredFiles = ((StdUDF7) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break; case 8: requiredFiles = ((StdUDF8) stdUDF).getRequiredFiles(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
@Override public String getDisplayString(String[] children) { return getStandardDisplayString(((TopLevelStdUDF) _stdUdf).getFunctionName(), children); } }
/** Returns an array of booleans indicating if any input argument is nullable and also verifies its length */ public final boolean[] getAndCheckNullableArguments() { boolean[] nullableArguments = getNullableArguments(); if (nullableArguments.length != numberOfArguments()) { throw new RuntimeException( "Unexpected number of nullable arguments. Expected:" + numberOfArguments() + " Received:" + nullableArguments.length); } return nullableArguments; }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _arrayType = getStdFactory().createStdType(getOutputParameterSignature()); }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _mapType = getStdFactory().createStdType(getOutputParameterSignature()); }
/** * Returns an array of booleans indicating if any input argument is nullable. * * Nullable arguments are arguments that can receive a null value. For a nullable argument, the user must explicitly * handle null values in their implementation. For a non-nullable argument, the UDF returns null if the argument * is null. The length of the returned array should be equal to the number of input arguments. Defaults to all * arguments being non-nullable. */ public boolean[] getNullableArguments() { return new boolean[numberOfArguments()]; }
private StdData[] wrapArguments(StdUDF stdUDF, Type[] types, Object[] arguments) { StdFactory stdFactory = stdUDF.getStdFactory(); StdData[] stdData = new StdData[arguments.length]; // TODO: Reuse wrapper objects by creating them once upon initialization and reuse them here // along the same lines of what we do in Hive implementation. // JIRA: https://jira01.corp.linkedin.com:8443/browse/LIHADOOP-34894 for (int i = 0; i < stdData.length; i++) { stdData[i] = PrestoWrapper.createStdData(arguments[i], types[i], stdFactory); } return stdData; }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _field1Type = getStdFactory().createStdType("K"); _field2Type = getStdFactory().createStdType("V"); }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _arrayType = getStdFactory().createStdType(getOutputParameterSignature()); }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _field1Type = getStdFactory().createStdType("K"); _field2Type = getStdFactory().createStdType("V"); }
@Override public void init(StdFactory stdFactory) { super.init(stdFactory); _field1Type = getStdFactory().createStdType("K"); _field2Type = getStdFactory().createStdType("V"); }