Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.0, 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: SQL
    • Labels:
      None

      Description

      When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` returns this error:

      0: jdbc:hive2://localhost:10016/> select NULL;
      Error: java.lang.IllegalArgumentException: Unrecognized type name: null (state=,code=0)
      

      Note: I originally pasted in this code erroneously:

      0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
      Error: org.apache.spark.sql.catalyst.parser.ParseException: 
      DataType null() is not supported.(line 1, pos 20)
      

      This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, The same query returns NULL:

      0: jdbc:hive2://localhost:10015/> select null;
      +-------+--+
      |  _c0  |
      +-------+--+
      | NULL  |
      +-------+--+
      1 row selected (0.658 seconds)
      

      I can select expressions that evaluate to NULL or CAST NULL to different types:

      0: jdbc:hive2://localhost:10016/> select null=null
      0: jdbc:hive2://localhost:10016/> ;
      +----------------+--+
      | (NULL = NULL)  |
      +----------------+--+
      | NULL           |
      +----------------+--+
      1 row selected (0.69 seconds)
      0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
      +--------------------+--+
      | CAST(NULL AS INT)  |
      +--------------------+--+
      | NULL               |
      +--------------------+--+
      1 row selected (0.676 seconds)
      0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
      +-----------------------+--+
      | CAST(NULL AS STRING)  |
      +-----------------------+--+
      | NULL                  |
      +-----------------------+--+
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tnemet Todd Nemet
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: