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

SqlToRelConverter throws an exception when converting a NULL SqlLiteral

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.36.0
    • 1.37.0
    • core
    • None

    Description

      The problem is in SqlNodeToRexConverterImpl.convertLiteral. This function attempts to handle NULL literals differently from all other literals:

          final RexBuilder rexBuilder = cx.getRexBuilder();
          if (literal.getValue() == null) {
            RelDataType type = cx.getValidator().getValidatedNodeType(literal);
            return rexBuilder.makeNullLiteral(type);
          }
      
          switch (literal.getTypeName()) {
          ...
      

      However, such a literal does not have a validated data type, so getValidatedNodeType will throw Util.needToImplement.

      The solution would be to handle NULL literals like all other literals and create a literal with a NULL type.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mbudiu Mihai Budiu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: