本文整理汇总了Java中org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java GenericUDTF.initialize方法的具体用法?Java GenericUDTF.initialize怎么用?Java GenericUDTF.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.ql.udf.generic.GenericUDTF
的用法示例。
在下文中一共展示了GenericUDTF.initialize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalCase
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings({ "deprecation", "unchecked" })
@Test
public void normalCase() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { binaryInspector };
GenericUDTF func = new ArrayOfDoublesSketchToValuesUDTF();
ObjectInspector resultInspector = func.initialize(inspectors);
checkResultInspector(resultInspector);
ArrayOfDoublesUpdatableSketch sketch = new ArrayOfDoublesUpdatableSketchBuilder().setNumberOfValues(2).build();
sketch.update(1, new double[] {1, 2});
sketch.update(2, new double[] {1, 2});
MockCollector collector = new MockCollector();
func.setCollector(collector);
func.process(new Object[] {new BytesWritable(sketch.toByteArray())});
Assert.assertEquals(collector.list.size(), 2);
Assert.assertEquals(((Object[]) collector.list.get(0)).length, 1);
Assert.assertEquals(((List<Double>) ((Object[]) collector.list.get(0))[0]), Arrays.asList(1.0, 2.0));
Assert.assertEquals(((List<Double>) ((Object[]) collector.list.get(1))[0]), Arrays.asList(1.0, 2.0));
}
示例2: initializeTooFewInspectors
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeTooFewInspectors() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例3: initializeTooManyInspectors
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeTooManyInspectors() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { binaryInspector, stringInspector, stringInspector };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例4: initializeWrongCategoryArg1
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeWrongCategoryArg1() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { structInspector };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例5: initializeWrongCategoryArg2
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeWrongCategoryArg2() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { binaryInspector, structInspector };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例6: initializeWrongTypeArg1
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeWrongTypeArg1() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { stringInspector, stringInspector };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例7: initializeWrongTypeArg2
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeWrongTypeArg2() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { binaryInspector, binaryInspector };
GenericUDTF func = new GetFrequentItemsFromStringsSketchUDTF();
func.initialize(inspectors);
}
示例8: initializeNoInspectors
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeNoInspectors() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { };
GenericUDTF func = new ArrayOfDoublesSketchToValuesUDTF();
func.initialize(inspectors);
}
示例9: initializeTooManyInspectors
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentException.class)
public void initializeTooManyInspectors() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { binaryInspector, binaryInspector };
GenericUDTF func = new ArrayOfDoublesSketchToValuesUDTF();
func.initialize(inspectors);
}
示例10: initializeWrongCategory
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentTypeException.class)
public void initializeWrongCategory() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { structInspector };
GenericUDTF func = new ArrayOfDoublesSketchToValuesUDTF();
func.initialize(inspectors);
}
示例11: initializeWrongType
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test(expectedExceptions = UDFArgumentTypeException.class)
public void initializeWrongType() throws Exception {
ObjectInspector[] inspectors = new ObjectInspector[] { stringInspector };
GenericUDTF func = new ArrayOfDoublesSketchToValuesUDTF();
func.initialize(inspectors);
}