Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-7045

CTAS doesn't allow NULL values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Frontend
    • impalad version 2.7.0-cdh5.10.0 RELEASE (build 785a073cd07e2540d521ecebb8b38161ccbd2aa2)
      Built on Fri Jan 20 12:03:56 PST 2017
    • ghx-label-9

    Description

      When I run following:

      {{CREATE TABLE temp_test AS SELECT CAST(null AS bigint) as nullable_int }}

      with the error:

      Unsupported type 'null_type' in column 'nullable_int' of table 'temp_test'

      The reason for this, I assume, is following. In the INSERT statements data types of result set's columns are retrieved from the resulting values:
      https://github.com/apache/impala/blob/789c5aac23480acc6e18c057b767b65fdd791c97/fe/src/main/java/org/apache/impala/analysis/InsertStmt.java#L275

      Whereas in CTAS they are calculated via base table of the column (and there is no base table for NULL):
      https://github.com/apache/impala/blob/ba84ad03cb83d7f7aed8524fcfbb0e2cdc9fdd53/fe/src/main/java/org/apache/impala/analysis/CreateTableAsSelectStmt.java#L171

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            pavgra Pavel Grafkin
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: