You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ku...@apache.org on 2019/08/07 15:51:20 UTC

[flink] 04/05: [FLINK-13225][hive] Fix getAccumulatorType of HiveGenericUDAF

This is an automated email from the ASF dual-hosted git repository.

kurt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 81d0889c96fd1445425e5af7f1e8a0fefd59f4f0
Author: JingsongLi <lz...@aliyun.com>
AuthorDate: Sun Jul 28 20:24:50 2019 +0800

    [FLINK-13225][hive] Fix getAccumulatorType of HiveGenericUDAF
---
 .../flink/table/functions/hive/HiveGenericUDAF.java       | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java
index 6015ef6..b2f2fe5 100644
--- a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java
+++ b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java
@@ -20,6 +20,7 @@ package org.apache.flink.table.functions.hive;
 
 import org.apache.flink.annotation.Internal;
 import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.java.typeutils.GenericTypeInfo;
 import org.apache.flink.table.catalog.hive.client.HiveShim;
 import org.apache.flink.table.catalog.hive.client.HiveShimLoader;
 import org.apache.flink.table.catalog.hive.util.HiveTypeUtil;
@@ -211,17 +212,7 @@ public class HiveGenericUDAF
 	}
 
 	@Override
-	public TypeInformation getAccumulatorType() {
-		try {
-			if (!initialized) {
-				init();
-			}
-
-			return LegacyTypeInfoDataTypeConverter.toLegacyTypeInfo(
-				HiveTypeUtil.toFlinkType(partialResultObjectInspector));
-		} catch (Exception e) {
-			throw new FlinkHiveUDFException(
-				String.format("Failed to get Hive accumulator type from %s", hiveFunctionWrapper.getClassName()), e);
-		}
+	public TypeInformation<GenericUDAFEvaluator.AggregationBuffer> getAccumulatorType() {
+		return new GenericTypeInfo<>(GenericUDAFEvaluator.AggregationBuffer.class);
 	}
 }