@Test public void testArray() throws Exception { Object[] constantArgs = new Object[] { null }; DataType[] dataTypes = new DataType[] { DataTypes.ARRAY(DataTypes.INT()) }; HiveGenericUDTF udf = init( GenericUDTFPosExplode.class, constantArgs, dataTypes ); udf.eval(new Integer[] { 1, 2, 3}); assertEquals(Arrays.asList(Row.of(0, 1), Row.of(1, 2), Row.of(2, 3)), collector.result); }
public void eval(Object... args) throws HiveException { if (isArgsSingleArray) { args = new Object[] {args}; } checkArgument(args.length == conversions.length); if (!allIdentityConverter) { for (int i = 0; i < args.length; i++) { args[i] = conversions[i].toHiveObject(args[i]); } } function.process(args); }
HiveGenericUDTF extends TableFunction<Row> implements HiveFunction { public void eval(Object... args) throws HiveException { if (isArgsSingleArray) { args = new Object[] {args}; } checkArgument(args.length == conversions.length); if (!allIdentityConverter) { for (int i = 0; i < args.length; i++) { args[i] = conversions[i].toHiveObject(args[i]); } } function.process(args); } }
HiveGenericUDTF extends TableFunction<Row> implements HiveFunction { public void eval(Object... args) throws HiveException { if (isArgsSingleArray) { args = new Object[] {args}; } checkArgument(args.length == conversions.length); if (!allIdentityConverter) { for (int i = 0; i < args.length; i++) { args[i] = conversions[i].toHiveObject(args[i]); } } function.process(args); } HiveGenericUDTF(HiveFunctionWrapper<GenericUDTF> hiveFunctionWrapper); }
HiveGenericUDTF extends TableFunction<Row> implements HiveFunction { public void eval(Object... args) throws HiveException { if (isArgsSingleArray) { args = new Object[] {args}; } checkArgument(args.length == conversions.length); if (!allIdentityConverter) { for (int i = 0; i < args.length; i++) { args[i] = conversions[i].toHiveObject(args[i]); } } function.process(args); } HiveGenericUDTF(HiveFunctionWrapper<GenericUDTF> hiveFunctionWrapper); @Override void open(FunctionContext context); void eval(Object... args); @Override void setArgumentTypesAndConstants(Object[] constantArguments, DataType[] argTypes); @Override DataType getHiveResultType(Object[] constantArguments, DataType[] argTypes); @Override TypeInformation getResultType(); @Override void close(); }
HiveGenericUDTF extends TableFunction<Row> implements HiveFunction { public void eval(Object... args) throws HiveException { if (isArgsSingleArray) { args = new Object[] {args}; } checkArgument(args.length == conversions.length); if (!allIdentityConverter) { for (int i = 0; i < args.length; i++) { args[i] = conversions[i].toHiveObject(args[i]); } } function.process(args); } HiveGenericUDTF(HiveFunctionWrapper<GenericUDTF> hiveFunctionWrapper); @Override void open(FunctionContext context); void eval(Object... args); @Override void setArgumentTypesAndConstants(Object[] constantArguments, DataType[] argTypes); @Override DataType getHiveResultType(Object[] constantArguments, DataType[] argTypes); @Override TypeInformation getResultType(); @Override void close();  }