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

Improve RelMdPredicates to deal with RexLiteral

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      None

      Description

      Right now, Calcite will treat a RexLiteral's ColumnOrigin as an empty set. Rather than dropping the information of RexLiteral, this patch proposes to keep this information in the RelColumnOrigin itself.

      1. CALCITE-953.01.patch
        5 kB
        Pengcheng Xiong
      2. CALCITE-953.02.patch
        5 kB
        Pengcheng Xiong

        Issue Links

          Activity

          Hide
          pxiong Pengcheng Xiong added a comment -

          Thanks Julian Hyde and Josh Elser for helping with the mvn issue. Julian Hyde could you please review the patch and comment? This patch will be helpful for Hive return path to detect whether the source of a column is a constant or not. also ccing Ashutosh Chauhan and Laljo John Pullokkaran.

          Show
          pxiong Pengcheng Xiong added a comment - Thanks Julian Hyde and Josh Elser for helping with the mvn issue. Julian Hyde could you please review the patch and comment? This patch will be helpful for Hive return path to detect whether the source of a column is a constant or not. also ccing Ashutosh Chauhan and Laljo John Pullokkaran .
          Hide
          julianhyde Julian Hyde added a comment -

          It's an interesting idea to use column origins to represent this.

          However what about if you have two equivalent rels and in one the source of DEPTNO is the column DEPT.DEPTNO and in the other the source of DEPTNO is the literal 10? Which origin wins?

          What about using RelMdPredicates?

          Show
          julianhyde Julian Hyde added a comment - It's an interesting idea to use column origins to represent this. However what about if you have two equivalent rels and in one the source of DEPTNO is the column DEPT.DEPTNO and in the other the source of DEPTNO is the literal 10? Which origin wins? What about using RelMdPredicates?
          Hide
          julianhyde Julian Hyde added a comment -

          The big point in favor of using RelMdPredicates: it allows magic to happen. Calcite can deduce predicates in a variety of ways (projects, filters, materialized views) and whenever you can deduce that a column has to be a particular constant, you can safely substitute that constant where the column is used.

          Show
          julianhyde Julian Hyde added a comment - The big point in favor of using RelMdPredicates: it allows magic to happen. Calcite can deduce predicates in a variety of ways (projects, filters, materialized views) and whenever you can deduce that a column has to be a particular constant, you can safely substitute that constant where the column is used.
          Hide
          pxiong Pengcheng Xiong added a comment -

          Address Julian Hyde's comments. Include a new test case. Also improve plans of existing tests.

          Show
          pxiong Pengcheng Xiong added a comment - Address Julian Hyde 's comments. Include a new test case. Also improve plans of existing tests.
          Hide
          julianhyde Julian Hyde added a comment -

          Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/c2059f15. Thanks for the patch Pengcheng Xiong!

          I made a small fix: if NULL is projected, we should create '$x IS NULL' not '$x = NULL'.

          Show
          julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/c2059f15 . Thanks for the patch Pengcheng Xiong ! I made a small fix: if NULL is projected, we should create '$x IS NULL' not '$x = NULL'.
          Hide
          jcamachorodriguez Jesus Camacho Rodriguez added a comment -

          Resolved in release 1.5.0 (2015-11-10)

          Show
          jcamachorodriguez Jesus Camacho Rodriguez added a comment - Resolved in release 1.5.0 (2015-11-10)

            People

            • Assignee:
              pxiong Pengcheng Xiong
              Reporter:
              pxiong Pengcheng Xiong
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development