Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6341

DynamicRecordType join query will generate uncompailable code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 1.29.0, 1.30.0, 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0
    • None
    • core
    • None

    Description

      See full minimal reproduction in https://github.com/yonatang/calcite-join-issue/

      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:

      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);
        }
      } 

      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            yonatan Yonatan Graber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: