org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCount Java Examples
The following examples show how to use
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCount.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveGenericUDAFTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testUDAFCount() throws Exception { Object[] constantArgs = new Object[] { null }; DataType[] argTypes = new DataType[] { DataTypes.DOUBLE() }; HiveGenericUDAF udf = init(GenericUDAFCount.class, constantArgs, argTypes); GenericUDAFEvaluator.AggregationBuffer acc = udf.createAccumulator(); udf.accumulate(acc, 0.5d); udf.accumulate(acc, 0.3d); udf.accumulate(acc, 5.3d); udf.merge(acc, Arrays.asList()); assertEquals(3L, udf.getValue(acc)); }
Example #2
Source File: HiveGenericUDAFTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testUDAFCount() throws Exception { Object[] constantArgs = new Object[] { null }; DataType[] argTypes = new DataType[] { DataTypes.DOUBLE() }; HiveGenericUDAF udf = init(GenericUDAFCount.class, constantArgs, argTypes); GenericUDAFEvaluator.AggregationBuffer acc = udf.createAccumulator(); udf.accumulate(acc, 0.5d); udf.accumulate(acc, 0.3d); udf.accumulate(acc, 5.3d); udf.merge(acc, Arrays.asList()); assertEquals(3L, udf.getValue(acc)); }