[
https://issues.apache.org/jira/browse/HIVE-23462?focusedWorklogId=438932&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-438932
]
ASF GitHub Bot logged work on HIVE-23462:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/May/20 20:16
Start Date: 29/May/20 20:16
Worklog Time Spent: 10m
Work Description: jcamachor commented on a change in pull request #1031:
URL: https://github.com/apache/hive/pull/1031#discussion_r432118212
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/DataSketchesFunctions.java
##########
@@ -235,12 +232,21 @@ public String getFunctionName() {
return Optional.empty();
} else {
JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl(new
HiveTypeSystemImpl());
+ Type type = returnType;
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ if (parameterizedType.getRawType() == List.class) {
+ final RelDataType componentRelType =
typeFactory.createType(parameterizedType.getActualTypeArguments()[0]);
+ return Optional
+
.of(typeFactory.createArrayType(typeFactory.createTypeWithNullability(componentRelType,
true), -1));
+ }
+ }
return Optional.of(typeFactory.createType(returnType));
}
Review comment:
I have a general comment about the approach we are taking in these
methods to infer the return type.
I think we should rethink inferring the return type from the Java returned
object from 'evaluate' and we could possibly take a step back.
One option could be create the necessary `SqlReturnTypeInference` strategies
to be able to return the correct type depending on the functions. If the
inference is simple, we could hardcode some of those return types. This is the
general approach taken by Calcite functions. I think that will help simplifying
this code a lot.
What do you think? Do you have any other ideas?
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 438932)
Time Spent: 1.5h (was: 1h 20m)
> Add option to rewrite NTILE to sketch functions
> -----------------------------------------------
>
> Key: HIVE-23462
> URL: https://issues.apache.org/jira/browse/HIVE-23462
> Project: Hive
> Issue Type: Sub-task
> Reporter: Zoltan Haindrich
> Assignee: Zoltan Haindrich
> Priority: Major
> Labels: pull-request-available
> Attachments: HIVE-23462.01.patch, HIVE-23462.02.patch,
> HIVE-23462.03.patch, HIVE-23462.04.patch
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)