You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/12/17 02:31:30 UTC

[GitHub] [hive] sunchao opened a new pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

sunchao opened a new pull request #1792:
URL: https://github.com/apache/hive/pull/1792


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This includes `calcite-core`'s transitive dependencies:
   - net.hydromatic:eigenbase-properties
   - org.codehaus.janino:janino
   - org.codehaus.janino:commons-compiler
   - org.pentaho:pentaho-aggdesigner-algorithm
   
    in the fat `hive-exec` jar. 
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   Currently as part of effort of shading Guava from Hive, we shade Calcite and exclude all its artifacts from the binary distribution. However, this also removes all its transitive dependencies which will still needed at runtime. Without these, Hive queries will fail with error like:
   
   ```
   Exception in thread "main" java.lang.NoClassDefFoundError: org/eigenbase/util/property/BooleanProperty
           at org.apache.calcite.util.SaffronProperties.<init>(SaffronProperties.java:66)
           at org.apache.calcite.util.SaffronProperties.instance(SaffronProperties.java:134)
           at org.apache.calcite.util.Util.getDefaultCharset(Util.java:769)
           at org.apache.calcite.rel.type.RelDataTypeFactoryImpl.getDefaultCharset(RelDataTypeFactoryImpl.java:565)
           at org.apache.calcite.sql.type.SqlTypeUtil.addCharsetAndCollation(SqlTypeUtil.java:1070)
           at org.apache.calcite.sql.type.SqlTypeFactoryImpl.createSqlType(SqlTypeFactoryImpl.java:65)
           at org.apache.calcite.rex.RexBuilder.<init>(RexBuilder.java:114)
           at org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:991)
           at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:149)
           at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:106)
           at org.apache.hadoop.hive.ql.parse.CalcitePlanner.logicalPlan(CalcitePlanner.java:1069)
           at org.apache.hadoop.hive.ql.parse.CalcitePlanner.getOptimizedAST(CalcitePlanner.java:1085)
           at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:364)
           at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:11138)
           at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:286)
           at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:258)
           at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:512)
           at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1317)
           at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1457)
           at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237)
           at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227)
           at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:233)
           at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:184)
           at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
           at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821)
           at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759)
           at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.apache.hadoop.util.RunJar.run(RunJar.java:234)
           at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
   Caused by: java.lang.ClassNotFoundException: org.eigenbase.util.property.BooleanProperty
           at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
           at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
           ... 33 more
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   
   Verified that the classes are included in the `hive-exec` jars with the change. I also manually tested this by launching a HS2 and run a simple query against it. It passed while previous was failing due to the above error.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] dongjoon-hyun commented on pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1792:
URL: https://github.com/apache/hive/pull/1792#issuecomment-747210561


   Thank you for pinging me, @sunchao .


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] viirya commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r545478347



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       BTW, I remember in the latest branch, the shading guava PR doesn't include transitive dependencies like that. Do we also need to do it for the branch?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r545480880



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       I still need to verify whether there is issue in master/4.0.0 as well - it uses calcite 1.21 which no longer depend on eigenbase which causes the issue in our case, but I think it might be good to always include transitive dependencies anyway.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r545480880



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       I still need to verify whether there is issue in master/4.0.0 as well - it uses calcite 1.21 which no longer depend on eigenbase that is causing the issue in our case, but I think it might be good to always include transitive dependencies anyway.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on pull request #1792:
URL: https://github.com/apache/hive/pull/1792#issuecomment-747165626


   cc @viirya @dongjoon-hyun @szehon-ho 


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] viirya commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r544772225



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       One question. Will this be flaky? Once calcite changes transitive dependencies, seems we also need to update this.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao merged pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao merged pull request #1792:
URL: https://github.com/apache/hive/pull/1792


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r545534404



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       Oh actually in master we already handles this [here](https://github.com/apache/hive/blob/master/pom.xml#L1052), as part of [HIVE-22126](https://issues.apache.org/jira/browse/HIVE-22126). I think we should follow the same approach and explicitly add the transitive dependency in Hive's top-level pom. I think this is also how Spark manages its transitive dependencies? it might be better than pulling out the classes and putting them in the fat jar.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r545531261



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       So I tried master branch and didn't hit the issue. However I think I may still open another PR for it since we don't really when the transitive dependencies will be needed at runtime.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on a change in pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #1792:
URL: https://github.com/apache/hive/pull/1792#discussion_r544779939



##########
File path: ql/pom.xml
##########
@@ -880,6 +880,12 @@
                   <include>joda-time:joda-time</include>
                   <include>org.apache.calcite:*</include>
                   <include>org.apache.calcite.avatica:avatica</include>
+                  <!-- include all of calcite's transitive dependencies as well since
+                    otherwise they'll be removed in assembly packaging -->
+                  <include>net.hydromatic:eigenbase-properties</include>
+                  <include>org.codehaus.janino:janino</include>
+                  <include>org.codehaus.janino:commons-compiler</include>
+                  <include>org.pentaho:pentaho-aggdesigner-algorithm</include>

Review comment:
       Yeah that's the downside of it - whenever we upgrade calcite we should check its dependencies and update here as well. I'm not sure if there is an easy way to include an artifact and all its transitive dependencies in the maven-shade-plugin 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] sunchao commented on pull request #1792: HIVE-24551: Hive should include transitive dependencies from calcite after shading it

Posted by GitBox <gi...@apache.org>.
sunchao commented on pull request #1792:
URL: https://github.com/apache/hive/pull/1792#issuecomment-748700076


   Updated the PR to fix a hanging issue when testing `org.apache.hadoop.hive.cli.TestAccumuloCliDriver`. Right now Hive is using Accumulo version 1.6.0 which depends on Thrift 0.9.0. However Hive uses Thrift 0.9.3 and because of this Accumulo TabletServer may fail with the following exception:
   ```
   2020-12-20T12:02:18,577 ERROR [ClientPool 1[]] util.NamingThreadFactory: Thread "ClientPool 1" died tried to access field org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.trans_     from class org.apache.accumulo.server.util.TServerUtils$THsHaServer$Invocation
   java.lang.IllegalAccessError: tried to access field org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.trans_ from class org.apache.accumulo.server.util.                               TServerUtils$THsHaServer$Invocation
   ```
   which caused the test to hang. After upgrading Accumulo version to 1.7.3 (which is the same version used by Hive 3.0+) the issue is resolved.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org