From 49ca6aa6cb75b931d1c38dcffb4cd3dd63b0a2f3 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Fri, 10 Nov 2023 12:17:09 +0300 Subject: [PATCH] [MINOR][SQL] Pass `cause` in `CannotReplaceMissingTableException` costructor ### What changes were proposed in this pull request? In the PR, I propose to use the `cause` argument in the `CannotReplaceMissingTableException` constructor. ### Why are the changes needed? To improve user experience with Spark SQL while troubleshooting issues. Currently, users don't see where the exception come from. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manually. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #43738 from MaxGekk/fix-missed-cause. Authored-by: Max Gekk Signed-off-by: Max Gekk --- .../catalyst/analysis/CannotReplaceMissingTableException.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CannotReplaceMissingTableException.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CannotReplaceMissingTableException.scala index 910bb9d374971..032cdca12c050 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CannotReplaceMissingTableException.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CannotReplaceMissingTableException.scala @@ -28,4 +28,5 @@ class CannotReplaceMissingTableException( extends AnalysisException( errorClass = "TABLE_OR_VIEW_NOT_FOUND", messageParameters = Map("relationName" - -> quoteNameParts(tableIdentifier.namespace :+ tableIdentifier.name))) + -> quoteNameParts(tableIdentifier.namespace :+ tableIdentifier.name)), + cause = cause)