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

CREATE TABLE AS SELECT changes behaviour in SPARK 3.4.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.4.0
    • None
    • Spark Core, SQL
    • None

    Description

      SPARK-41859 changes the behaviour for `CREATE TABLE AS SELECT ...` from OVERWRITE to APPEND when spark.sql.legacy.allowNonEmptyLocationInCTAS is set to true:

      drop table if exists test_table;
      create table test_table location '/tmp/test_table' stored as parquet as select 1 as col union all select 2 as col;
      drop table if exists test_table;
      create table test_table location '/tmp/test_table' stored as parquet as select 3 as col union all select 4 as col;
      select * from test_table;

      This produces

      {3, 4}

      in Spark <3.4.0 and

      {1, 2, 3, 4}

      in Spark 3.4.0 and later. This is a silent change in spark.sql.legacy.allowNonEmptyLocationInCTAS behaviour which introduces wrong results in the user application

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            estoianovici Eugen Stoianovici
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: