From a6d431910c736d79964594a69e085f6d0cc40487 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Wed, 16 Nov 2022 12:29:09 -0800 Subject: [PATCH] [SPARK-41155][SQL] Add error message to SchemaColumnConvertNotSupportedException ### What changes were proposed in this pull request? This patch adds error message to `SchemaColumnConvertNotSupportedException`. ### Why are the changes needed? Just found the fact that `SchemaColumnConvertNotSupportedException` doesn't have any error message is annoying for debugging. In stack trace, we only see `SchemaColumnConvertNotSupportedException` but don't know what column is wrong. After this change, we should be able to see it, e.g., ``` org.apache.spark.sql.execution.datasources.SchemaColumnConvertNotSupportedException: column: [_1], physicalType: INT32, logicalType: bigint ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests. Closes #38669 from viirya/add_error_message. Authored-by: Liang-Chi Hsieh Signed-off-by: Liang-Chi Hsieh --- .../datasources/SchemaColumnConvertNotSupportedException.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/SchemaColumnConvertNotSupportedException.java b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/SchemaColumnConvertNotSupportedException.java index 7d1fbe64fc960..b7ff0c26a9d25 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/SchemaColumnConvertNotSupportedException.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/SchemaColumnConvertNotSupportedException.java @@ -54,7 +54,8 @@ public SchemaColumnConvertNotSupportedException( String column, String physicalType, String logicalType) { - super(); + super("column: " + column + ", physicalType: " + physicalType + + ", logicalType: " + logicalType); this.column = column; this.physicalType = physicalType; this.logicalType = logicalType;