Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-21134

Sql. UPPER, LOWER and SUBSTRING functions must support NULL values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • clients, sql

    Description

      As described in ANSI99 specification, functions UPPER and LOWER must return NULL values for NULL argument:

       

      5) If <fold> is specified, then:

       .. b) if S is the null value, then the result of the <fold> is the null value.

      In the recent AI3 (commit c2ac5850973ae3bfd44b06fc6e3b5880f9f292f1) an error is shown instead:

      sql-cli> SELECT UPPER(NULL);
      Unknown error
      Unsupported Column type NULL
      
      sql-cli> SELECT LOWER(NULL);
      Unknown error
      Unsupported Column type NULL
      
      sql-cli> SELECT SUBSTRING(NULL FROM 1 FOR 2);
      Unknown error
      Unsupported Column type NULL

      NOTE: Most probably, it may be caused by client module, not sql module because a text of error is located in client-common module:

      $ grep -r 'Unsupported Column type' modules/*/src/main
      
      modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/JdbcConverterUtils.java:                throw new IllegalArgumentException("Unsupported Column type " + columnType);
      

      And when I add the following assertion to some test in ItFunctionsTest, it passes:

              assertQuery("SELECT LOWER(NULL)").returns(null).check();
      

      Previous AI3 versions allowed using NULL values in UPPER and LOWER functions, hence it's a degradation.

      Attachments

        Activity

          People

            zstan Evgeny Stanilovsky
            akhitrin Andrey Khitrin
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 - 0.5h
                0.5h