Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-42909

INSERT INTO with column list does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.3.2
    • None
    • SQL

    Description

      Hi,

      When performing a INSERT INTO with a defined incomplete column list, the missing columns should get a NULL value. However, an error is thrown indicating that the column is missing.

      Case simulation:

      drop table if exists default.TVTest;
      create table default.TVTest
      ( col1 int NOT NULL
      , col2 int
      );
      insert into default.TVTest select 1,2;
      insert into default.TVTest select 2,NULL; --> col2 can contain NULL values
      insert into default.TVTest (col1) select 3; – Error in SQL statement: DeltaAnalysisException: Column col2 is not specified in INSERT
      insert into default.TVTest (col1) VALUES (3); – Error in SQL statement: DeltaAnalysisException: Column col2 is not specified in INSERT
      select * from default.TVTest;

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tjomme Tjomme Vergauwen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: