[ 
https://issues.apache.org/jira/browse/HIVE-16888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064966#comment-16064966
 ] 

Jesus Camacho Rodriguez edited comment on HIVE-16888 at 6/27/17 3:33 PM:
-------------------------------------------------------------------------

.07 picks up the final Calcite 1.13 release.

A couple of notes on the patch:
- Fixed the issues with new version of timestamp. Internal representation in 
Calcite has changed in Calcite 1.13 to support larger precision than millis, 
thus we needed to adapt to it.
- Set VARCHAR max precision to Integer.MAX_VALUE. Otherwise, Calcite will 
reduce the precision of a VARCHAR when we translate the STRING type, as we 
represent it in Calcite as VARCHAR(Integer.MAX_VALUE). The change was 
introduced as part of the work on timestamp representation with nano precision.
https://github.com/apache/calcite/blob/205af8134857ba312415b9a5b4a48020fe0ce888/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java#L59
- Includes workaround for an issue in the {{validate}} method of the 
VolcanoPlanner that causes a NPE (recall that VolcanoPlanner is used in MV 
rewriting).
As part of CALCITE-1812, there were some changes in the planner and the 
RelMetadataQuery object is taken from the cluster of the root in the 
{{validate}} method:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java#L891
However, when we register the first expression, the root of the VolcanoPlanner 
is null. Thus, we get the NPE.
Instead, we should take the RelMetadataQuery from the cluster of the 
subexpressions:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java#L905
The workaround is setting the LOG level to INFO for the Calcite planner in the 
tests, since the {{validate}} method is only called at DEBUG level. I created 
CALCITE-1859 to fix this issue.



was (Author: jcamachorodriguez):
.07 picks up the final Calcite 1.13 release.

A couple of notes on the patch:
- Fixed the issues with new version of timestamp. Internal representation in 
Calcite has changed in Calcite 1.13 to support larger precision than millis, 
thus we needed to adapt to it.
- Set VARCHAR max precision to Integer.MAX_VALUE. Otherwise, Calcite will 
reduce the precision of a VARCHAR when we translate the STRING type, as we 
represent it in Calcite as VARCHAR(Integer.MAX_VALUE). The change was 
introduced as part of the work on timestamp representation with nano precision.
https://github.com/apache/calcite/blob/205af8134857ba312415b9a5b4a48020fe0ce888/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java#L59
- Includes workaround for an issue in the {{validate}} method of the 
VolcanoPlanner that causes a NPE (recall that VolcanoPlanner is used in MV 
rewriting).
As part of CALCITE-1812, there were some changes in the planner and the 
RelMetadataQuery object is taken from the cluster of the root in the 
{{validate}} method:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java#L891
However, when we register the first expression, the root of the VolcanoPlanner 
is null. Thus, we get the NPE.
Instead, we should take the RelMetadataQuery from the cluster of the 
subexpressions:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java#L905
The workaround is setting the LOG level to INFO for the Calcite planner in the 
tests, since the {{validate}} method is only called at DEBUG level. I will 
create a Calcite JIRA to fix this issue.


> Upgrade Calcite to 1.13 and Avatica to 1.10
> -------------------------------------------
>
>                 Key: HIVE-16888
>                 URL: https://issues.apache.org/jira/browse/HIVE-16888
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 3.0.0
>            Reporter: Remus Rusanu
>            Assignee: Jesus Camacho Rodriguez
>         Attachments: HIVE-16888.01.patch, HIVE-16888.02.patch, 
> HIVE-16888.03.patch, HIVE-16888.04.patch, HIVE-16888.05.patch, 
> HIVE-16888.06.patch, HIVE-16888.07.patch
>
>
> I'm creating this early to be able to ptest the current Calcite 
> 1.13.0-SNAPSHOT



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to