This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new db35193abc9 [SPARK-45476][SQL][FOLLOWUP] Raise exception directly 
instead of calling `resolveColumnsByPosition`
db35193abc9 is described below

commit db35193abc9689f286de049134d06361c785bd55
Author: Haejoon Lee <[email protected]>
AuthorDate: Mon Oct 16 09:35:01 2023 +0900

    [SPARK-45476][SQL][FOLLOWUP] Raise exception directly instead of calling 
`resolveColumnsByPosition`
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to raise exception directly instead of calling 
`resolveColumnsByPosition`.
    
    ### Why are the changes needed?
    
    We can directly throw error when resolving output columns if there is any 
error, instead of calling `resolveColumnsByPosition` again.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    The existing CI should pass.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #42762 from itholic/SPARK-42309-followup.
    
    Lead-authored-by: Haejoon Lee <[email protected]>
    Co-authored-by: itholic <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala
index fc0e727bea5..d4175772577 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala
@@ -111,7 +111,8 @@ object TableOutputResolver {
     }
 
     if (errors.nonEmpty) {
-      resolveColumnsByPosition(tableName, query.output, actualExpectedCols, 
conf, errors += _)
+      throw QueryCompilationErrors.incompatibleDataToTableCannotFindDataError(
+        tableName, actualExpectedCols.map(_.name).map(toSQLId).mkString(", "))
     }
 
     if (resolved == query.output) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to