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

RelToSqlConverter should use ordinal for ORDER BY if the dialect allows

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.26.0
    • 1.34.0
    • core

    Description

      For example:
      Query SQL isĀ 

      select a, sum(b) from table group by a order by 2

      When we convert this sql to relNode and convert it back to SQL by RelToConverter, the result is:

      select a, sum(b) from table group by a order by sum(b)

      But we want to keep order by column to ordinal.

      Would we add a switch in RelToConverter to control whether convert sort by column to expression or ordinal?
      Maybe we can use method isSortByOrdinal in dialect SqlConformance?

      Attachments

        Issue Links

          Activity

            People

              peng713128 peng wang
              peng713128 peng wang
              Votes:
              0 Vote for this issue
              Watchers:
              6 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 - 4h 50m
                  4h 50m