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

JDBC adapter omits FILTER (WHERE ...) expressions when generating SQL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.27.0
    • jdbc-adapter
    • MacOS 10.15, Java 11, PostgreSQL 12

    Description

      I tried out the PIVOT feature added in CALCITE-3752 and found what I think is a bug where the JDBC adapter will not generate `FILTER (WHERE ...)` expressions from relational expressions.

      Initially, I noticed that the SQL that was generated when trying out the pivot featue was missing the filter-where, but even when included directly in the Calcite SQL it's not in the SQL issued by the JDBC adapter.

      For example if I try to execute the following with Calcite:

      select sum(amount) filter (where some_date_column = '2020-10-01') from my_table

      The SQL issued by the adapter will be:

      select sum(amount) from my_table
      

      I have a small change here with a test case and a fix: https://github.com/apache/calcite/pull/2204

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              jeremiahrhall Jeremiah Rhoads Hall
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m