davidm-db commented on code in PR #47648:
URL: https://github.com/apache/spark/pull/47648#discussion_r1709078583
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala:
##########
@@ -78,11 +82,14 @@ trait NonLeafStatementExec extends CompoundStatementExec {
case Array(field) if field.dataType == BooleanType =>
df.limit(2).collect() match {
case Array(row) => row.getBoolean(0)
- case _ => false
+ case _ =>
+ throw
QueryExecutionErrors.invalidBooleanStatementError(statement.getText)
}
- case _ => false
+ case _ =>
+ throw
QueryExecutionErrors.invalidBooleanStatementError(statement.getText)
Review Comment:
I would maybe create two different error messages for these cases...
First one would be like "Boolean expression <expr> is invalid. It returns
more than one row." and the second one would be similar to what you did here
"Boolean statement is expected in the condition, but <expr> was found.".
This would better indicate what is the problem.
--
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]