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

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

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.18.0
    • core
    • 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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment