Yonatan Graber created CALCITE-6341:
---------------------------------------

             Summary: DynamicRecordType join query will generate uncompailable 
code
                 Key: CALCITE-6341
                 URL: https://issues.apache.org/jira/browse/CALCITE-6341
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.36.0, 1.35.0, 1.34.0, 1.33.0, 1.32.0, 1.31.0, 1.30.0, 
1.29.0, 1.28.0, 1.27.0, 1.26.0, 1.25.0, 1.24.0, 1.23.0
            Reporter: Yonatan Graber


See full minimal reproduction in 
[https://github.com/yonatang/calcite-join-issue/|https://github.com/yonatang/calcite-join-issue/tree/main]
—

When creating a table with {{DynamicRecordType}} rowType, a joined query will 
generate a code that won't get compiled.

For example, with the relevant schema, this query:

{{SELECT d1.a ,d2.a FROM static_table d1 join static_table d2 on d1.a=d2.a}}

Will not execute, because the generated code will contain a Baz class with the 
following Comparator class:
{code:java}
new java.util.Comparator(){
  public int compare(Object v0, Object v1) {
    final int c;
    c = 
org.apache.calcite.runtime.Utilities.compareNullsLastForMergeJoin((Comparable) 
v0, (Comparable) v1);
    if (c != 0) {
      return c;
    }
    return 0;
  }

  public int compare(Object o0, Object o1) {
    return this.compare(o0, o1);
  }
} {code}
This fails because it has two {{int compare(Object o0, Object o1)}} methods.

Notice this issue was introduced at Calcite 1.23.0. The query will work as 
expected in versions 1.22 and below.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to