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

SqlAdvisor: lack of hints when sub-query has STAR (simplifySql produces 0 AS "*")

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.17.0
    • Fix Version/s: 1.18.0
    • Component/s: core
    • Labels:
      None

      Description

      SimpleSqlParser.purgeSelectExprsKeepAliases tries to replace expressions in select clause with aliases, and it often produces invalid SQL:

      select * from dummy is replaced with select 0 AS "*" from dummy which is invalid
      select a.x+ b.y from dummy is replaced with select 0 AS "b.y" from dummy and so on.

      Testcase:

      select ax^ from (select * from dummy a)

      Actual output:

      SELECT ax _suggest_ FROM ( SELECT 0 AS * FROM dummy a )

      I'm inclined to comment purgeSelectExprsKeepAliases out for now.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                vladimirsitnikov Vladimir Sitnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: