delta-io / delta

An open-source storage framework that enables building a Lakehouse architecture with compute engines including Spark, PrestoDB, Flink, Trino, and Hive and APIs
https://delta.io
Apache License 2.0
7.22k stars 1.62k forks source link

[Spark] Use SQL expression in VARCHAR violation error #3242

Closed tomvanbussel closed 2 weeks ago

tomvanbussel commented 2 weeks ago

Which Delta project/connector is this regarding?

Description

Small fix to use the SQL expression instead of the internal catalyst representation of an expression in the error message for a VARCHAR length constraint violation.

How was this patch tested?

Modified an existing test

Does this PR introduce any user-facing changes?

Yes, the error message for the class DELTA_EXCEED_CHAR_VARCHAR_LIMIT will use different formatting for the expression of the violated constraint. For example, the user will now see ((value IS NULL) OR (length(value) <= 12)) instead of (isnull('value) OR (length('value) <= 12))