Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-4642

Let RexBuilder.ensureType() mechanism take place during Rex conversion.

    XMLWordPrintableJSON

Details

    Description

      In DRILL-4372, the logic of ensuring same type is removed since, in some case such as below, undesirable cast function will be added and cause failure.

      SELECT * 
      FROM T 
      WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'YYYY-MM-dd HH:mm:ss') < interval 'X XX:XX:XX' day to second)
      

      The fundamental reason for this behavior roots in Drill-Calcite [1], where SqlNode WHERE is expanded to a new object but is not passed into validation step.
      [1] https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362

      Attachments

        Issue Links

          Activity

            People

              jni Jinfeng Ni
              seanhychu Sean Hsuan-Yi Chu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: