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

wenchen 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 7f8ef96cea27 [SPARK-48166][SQL] Avoid using BadRecordException as 
user-facing error in VariantExpressionEvalUtils
7f8ef96cea27 is described below

commit 7f8ef96cea27d52d0bdda3808c6c48534dcd8567
Author: Vladimir Golubev <vladimir.golu...@databricks.com>
AuthorDate: Tue May 7 16:13:46 2024 +0800

    [SPARK-48166][SQL] Avoid using BadRecordException as user-facing error in 
VariantExpressionEvalUtils
    
    ### What changes were proposed in this pull request?
    Stop using `BadRecordException` in a user-facing context. Currently it is 
thrown then the `parse_json` input is malformed.
    
    ### Why are the changes needed?
    `BadRecordException` is an internal exception designed for 
`FailureSafeParser`.
    
    ### Does this PR introduce _any_ user-facing change?
    Yes, `parse_json` will not expose `BadRecordException` in error.
    
    ### How was this patch tested?
    `testOnly 
org.apache.spark.sql.catalyst.expressions.variant.VariantExpressionEvalUtilsSuite`
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #46428 from 
vladimirg-db/vladimirg-db/get-rid-of-bad-record-exception-in-variant-expression-eval-utils.
    
    Authored-by: Vladimir Golubev <vladimir.golu...@databricks.com>
    Signed-off-by: Wenchen Fan <wenc...@databricks.com>
---
 .../sql/catalyst/expressions/variant/VariantExpressionEvalUtils.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/VariantExpressionEvalUtils.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/VariantExpressionEvalUtils.scala
index f468e9745605..eb235eb854e0 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/VariantExpressionEvalUtils.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/VariantExpressionEvalUtils.scala
@@ -20,7 +20,7 @@ package org.apache.spark.sql.catalyst.expressions.variant
 import scala.util.control.NonFatal
 
 import org.apache.spark.sql.catalyst.InternalRow
-import org.apache.spark.sql.catalyst.util.{ArrayData, BadRecordException, 
MapData}
+import org.apache.spark.sql.catalyst.util.{ArrayData, MapData}
 import org.apache.spark.sql.errors.QueryExecutionErrors
 import org.apache.spark.sql.types._
 import org.apache.spark.types.variant.{Variant, VariantBuilder, 
VariantSizeLimitException, VariantUtil}
@@ -48,7 +48,7 @@ object VariantExpressionEvalUtils {
           .variantSizeLimitError(VariantUtil.SIZE_LIMIT, "parse_json"))
       case NonFatal(e) =>
         
parseJsonFailure(QueryExecutionErrors.malformedRecordsDetectedInRecordParsingError(
-          input.toString, BadRecordException(() => input, cause = e)))
+          input.toString, e))
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to