harmeeksinghbedi opened a new issue, #25981:
URL: https://github.com/apache/beam/issues/25981

   ### What happened?
   
   Running SQL query : SELECT t1.productname, t1.price, t1.inventorycount , 
t2.customerid , t2.customername, t2.customeraddress, t2.cdate from FACT_TABLE 
t1 JOIN LOOKUP_TABLE t2 on t1.productname=t2.productname WHERE t1.productname 
IS NOT NULL  Where LOOKUP_TABLE is using BeamSqlSeekableTable  results in a 
crash in "apache calcite" JaninoRelMetadataProvider class (This issue is 
reproducible in apache calicite 0.28 and below , and does not exisit above 
0.28). 
   
   All apache beam releases are using apache calcite 0.28 and lower. The reason 
for this bug is as follows 
   JaninoRelMetadataProvider in branch calcite 0.28.0 in function has following 
code 
   
   static  <MH extends MetadataHandler<?>> MH compile(String className,
         String classBody, Class<MH> handlerClass,
         List<Object> argList) throws CompileException, IOException {
       final ICompilerFactory compilerFactory;
       ClassLoader classLoader =
           
Objects.requireNonNull(JaninoRelMetadataProvider.class.getClassLoader(), 
"classLoader");
       try {
         compilerFactory = 
CompilerFactoryFactory.getDefaultCompilerFactory(classLoader);
       } catch (Exception e) {
         throw new IllegalStateException(
             "Unable to instantiate java compiler", e);
       }
   
       final ISimpleCompiler compiler = compilerFactory.newSimpleCompiler();
       compiler.setParentClassLoader(JaninoRexCompiler.class.getClassLoader());
   
       final String s = "public final class " + className
           + " implements " + **handlerClass.getCanonicalName()** + " {\n"
           + classBody
           + "\n"
           + "}";
    
   The problamatic line is handlerClass.getCanonicalName() where nested java 
classes such as 
"org.apache.calcite.rel.metadata.BuiltInMetadata$NonCumulativeCost$Handler 
would wrongly be written as. 
"org.apache.calcite.rel.metadata.BuiltInMetadata.NonCumulativeCost.Handler" 
leading to classloader loading issues  . 
   
   Version of Beam : 2.46.0 used for tests ,  Java beam sdk was used . Other 
queries also failed with similar results. 
   Apache calcite 0.29.0 addresses this issue . 
   
    
   
   ### Issue Priority
   
   Priority: 2 (default / most bugs should be filed as P2)
   
   ### Issue Components
   
   - [ ] Component: Python SDK
   - [X] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to