Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The order of metadata handler methods is inconsistent in different java versions. The effect is that if you add a new metadata class with two or more methods (such as BuiltInMetadata.Measure in julianhyde/4496-measure.16), you may get assertion failures when running under JDK 8 or 11 but not running under JDK 17:
$ ./gradlew :babel:test --tests BabelTest.testInfixCast JAVA_HOME is /usr/lib/jvm/jdk-11 java version "11.0.18" 2023-01-17 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.18+9-LTS-195) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.18+9-LTS-195, mixed mode) > Configure project : Building Apache Calcite 1.35.0-SNAPSHOT > Task :core:compileJava Could not load entry 6c654d63a2c430f60f4f91733541df12 from remote build cache: Bucket 'calcite-gradle-cache' not found Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. > Task :babel:test FAILED FAILURE 0.8sec, org.apache.calcite.test.BabelTest > testInfixCast() java.lang.AssertionError at org.apache.calcite.rel.metadata.MetadataDef.<init>(MetadataDef.java:53) at org.apache.calcite.rel.metadata.MetadataDef.of(MetadataDef.java:63) at org.apache.calcite.rel.metadata.BuiltInMetadata$Measure.<clinit>(BuiltInMetadata.java:842) at org.apache.calcite.rel.metadata.RelMdMeasure.getDef(RelMdMeasure.java:43) at org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider.reflectiveSource(ReflectiveRelMetadataProvider.java:134) at org.apache.calcite.rel.metadata.RelMdMeasure.<clinit>(RelMdMeasure.java:40) at org.apache.calcite.rel.metadata.DefaultRelMetadataProvider.<init>(DefaultRelMetadataProvider.java:42) at org.apache.calcite.rel.metadata.DefaultRelMetadataProvider.<clinit>(DefaultRelMetadataProvider.java:28) at org.apache.calcite.plan.RelOptCluster.<init>(RelOptCluster.java:97) at org.apache.calcite.plan.RelOptCluster.create(RelOptCluster.java:106) at org.apache.calcite.prepare.CalcitePrepareImpl.createCluster(CalcitePrepareImpl.java:414) at org.apache.calcite.prepare.CalcitePrepareImpl.getPreparingStmt(CalcitePrepareImpl.java:554) at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:523) at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:492) at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:236) at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:630) at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:677) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:157) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228) at org.apache.calcite.test.BabelTest.checkInfixCast(BabelTest.java:104) at org.apache.calcite.test.BabelTest.testInfixCast(BabelTest.java:92)