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

Literal NULL should be generated in SqlDialect

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.19.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      In Calcite, this simple query will throw exception during validation, even it is ok in many databases.

      Query:
      final String query = "select NULL as col "
          + "from \"foodmart\".\"product\"";
      
      Exception
      org.apache.calcite.tools.ValidationException: org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to line 1, column 11: Illegal use of 'NULL'
      

      The right way to use 'NULL' in Calcite is:

      final String query = "select cast(NULL as integer) as col "
          + "from \"foodmart\".\"product\"";
      

      However,  the converted query by RelToSqlConverter is illegal in Calcite.

      SELECT NULL AS \"COL\"
      FROM \"foodmart\".\"product\"
      

      The issue is trivial, but it is against to general sense. Maybe we can generate NULL literal in SqlDialect?

        Attachments

        Issue Links

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

              Dates

              • Created:
                Updated:

                Issue deployment