MaxGekk commented on code in PR #38660:
URL: https://github.com/apache/spark/pull/38660#discussion_r1037898056


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -541,6 +541,13 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
       messageParameters = Map("fieldCannotBeNullMsg" -> 
fieldCannotBeNullMsg(index, fieldName)))
   }
 
+  def valueCannotBeNullError(locationDesc: String): RuntimeException = {
+    new RuntimeException(s"The value at $locationDesc cannot be null, but a 
NULL was found. " +
+      "This is typically caused by the presence of a NULL value when the 
schema indicates the " +
+      "value should be non-null. Check that the input data matches the schema 
and/or that UDFs " +
+      "which can return null have a nullable return schema.")

Review Comment:
   Could you create an error class in `error-classes.json`, and move the error 
text there.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -541,6 +541,13 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
       messageParameters = Map("fieldCannotBeNullMsg" -> 
fieldCannotBeNullMsg(index, fieldName)))
   }
 
+  def valueCannotBeNullError(locationDesc: String): RuntimeException = {
+    new RuntimeException(s"The value at $locationDesc cannot be null, but a 
NULL was found. " +

Review Comment:
   Please, use a Spark's exception like `SparkRuntimeException`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to