xuefuz commented on a change in pull request #9004: [FLINK-13128][hive] make
HiveGenericUDAF expose accumulator type in order to create its corresponding
AggregateFunctionDefinition
URL: https://github.com/apache/flink/pull/9004#discussion_r301312750
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java
##########
@@ -191,21 +192,12 @@ public void setArgumentTypesAndConstants(Object[]
constantArguments, DataType[]
@Override
public DataType getHiveResultType(Object[] constantArguments,
DataType[] argTypes) {
try {
- ObjectInspector[] inputs =
HiveInspectors.toInspectors(constantArguments, argTypes);
- GenericUDAFEvaluator evaluator =
createEvaluator(inputs);
-
- // The ObjectInspector for the parameters:
- // In PARTIAL1 mode, the parameters are original data;
- // In FINAL mode, the parameters are just partial
aggregations
- // (in that case, the array will always have a single
element).
-
- ObjectInspector partialObjectInspector =
evaluator.init(GenericUDAFEvaluator.Mode.PARTIAL1, inputs);
-
- ObjectInspector finalObjectInspector = evaluator.init(
- GenericUDAFEvaluator.Mode.FINAL,
- new ObjectInspector[]{ partialObjectInspector
});
+ if (!initialized) {
Review comment:
Please note that the logic here depends on the assumption that the arguments
here are the same as those in setArgumentTypesAndConstants(). Otherwise,
unexpected result may occur.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services