yihua opened a new issue, #20859: URL: https://github.com/apache/hudi/issues/20859
A Spark SQL MERGE INTO whose source key column has a wider integral type than the target key column is refused, for example an INT record key matched against a BIGINT source column (common with `spark.range`): ```sql MERGE INTO t USING (SELECT 1L AS id, 11 AS v) s ON t.id = s.id WHEN MATCHED THEN UPDATE SET * WHEN NOT MATCHED THEN INSERT * ``` On a table without a record key it fails with "Invalid MERGE INTO matching condition: ... can't cast ... (of LongType) to IntegerType", and with a record key with "Primary key data type mismatch between source table and target table". Spark casts the key in this case. Proposal: accept a source key of another integral type for an integral key column, cast with an ANSI cast so a value the key column cannot hold fails instead of matching another record (Spark 3.5 and later, which also ANSI-cast the inserted value). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
