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

Fail INSERT INTO ... REPLACE statement if the condition contains subquery

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0.0
    • 4.0.0
    • SQL

    Description

      For the following query:

      INSERT INTO tbl REPLACE WHERE id = (select c2 from values(1) as t(c2)) SELECT * FROM source

      There will be an analysis error:

      [UNRESOLVED_COLUMN.WITHOUT_SUGGESTION] A column, variable, or function parameter with name `c2` cannot be resolved.  SQLSTATE: 42703; line 1 pos 51;
      'OverwriteByExpression RelationV2[id#27L, data#28] testcat.tbl testcat.tbl, (id#27L = scalar-subquery#26 []), false 

      The error message is confusing. The actually reason is the OverwriteByExpression plan doesn't support subqueries. While supporting the feature is non-trivial, we should improve the error message.

      Attachments

        Issue Links

          Activity

            People

              Gengliang.Wang Gengliang Wang
              Gengliang.Wang Gengliang Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: