milastdbx commented on code in PR #45462:
URL: https://github.com/apache/spark/pull/45462#discussion_r1519779866


##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -3004,6 +3004,12 @@
     ],
     "sqlState" : "2200E"
   },
+  "NULL_QUERY_STRING_EXECUTE_IMMEDIATE" : {
+    "message" : [
+      "SQLQuery string should not be null."

Review Comment:
   perhaps something like: `Execute immediate requires non-null value for 
sqlString variable, but provided <varName> is null`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala:
##########
@@ -88,6 +88,10 @@ class SubstituteExecuteImmediate(val catalogManager: 
CatalogManager)
           throw 
QueryCompilationErrors.invalidExecuteImmediateVariableType(varReference.dataType)
         }
 
+        if (varReference.eval(null) == null) {

Review Comment:
   consider storing `varReference` in variable so we don't evalulate multiple 
times



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to