Open Walderman opened 3 years ago
I've hit this too, with the python api , databricks 7.4 and 7.3
I had another look at this on delta-core 0.8.0, and the error is gone, but schema evolution still does not work (MERGE statement completes successfully, but any source columns not present in target table are ignored). From looking into the code, schema evolution on MERGE directly from SQL statement is not supported yet? Would be great to add this.
We're literally in production (for 1 year) with Delta and this doesn't work, causing pain and trouble. It used to work in Delta 0.6 but rolling back now is troublesome for us (basically going back to EMR5 on Spark 2.x).
Our environment currently experience this bug is: Delta 0.8.0/Spark 3 on EMR 6.2. We're indeed also using Spark SQL. Work-around as Walderman suggested, to use the API version. It somehow also got passed our QA as production has long-running tables (since Delta 0.6) while QA environment usually gets reset.
Lately I found that this specific error also happens with this very misleading message when there is a type mismatch on the merge condition
on t.id = s.id
For example if t.id
and s.id
aren't the same type.
Problem When trying to run MERGE INTO command in spark sql with clause: WHEN NOT MATCHED THEN INSERT * getting error: org.apache.spark.sql.AnalysisException: Unable to find the column 'col2' of the target table from the INSERT columns: id. INSERT clause must specify value for all the columns of the target table. This only happens for insert part and only when this is executed via spark sql (as per below steps to reproduce)
Steps to reproduce Version: Spark 3.0.0 with delta-core 0.7.0
removing WHEN NOT MATCHED INSERT * clause makes the statement work (i get new schema with col2 added)
running update/insert via Scala API also works
Expected Result Both Spark SQL and API merge work in the same way and allow for schema evolution with option "spark.databricks.delta.schema.autoMerge.enabled" set to "true"
in this case, as per https://docs.delta.io/latest/delta-update.html#merge-examples&language-scala i would expect new column to be added, which works for api version.