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

JDBC adapter generates incorrect query when ORDER BY alias collides with field in SELECT ITEM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • 1.29.0
    • None
    • core
    • jdk8

    Description

      I reproduce with the following query.

       

      SELECT sum(shelf_width) as shelf_width FROM product ORDER BY shelf_width

      you must have noticed that the shelf_width alias is same with field 'shelf_width' in sum.

      I expected the query hasn't changed when I test in RelToSqlConverterTest. But I get unexpected query is 

      SELECT sum(shelf_width) as shelf_width FROM product ORDER BY sum(shelf_width)  

       the unexpected query is not valid in the dialect which support order by alias conformance.

       

      Attachments

        Issue Links

          Activity

            People

              yanjing.wang yanjing.wang
              yanjing.wang yanjing.wang
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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