cloud-fan commented on code in PR #48912:
URL: https://github.com/apache/spark/pull/48912#discussion_r1852027344
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala:
##########
@@ -440,8 +440,12 @@ trait RuntimeReplaceable extends Expression {
// are semantically equal.
override lazy val canonicalized: Expression = replacement.canonicalized
- final override def eval(input: InternalRow = null): Any =
- throw QueryExecutionErrors.cannotEvaluateExpressionError(this)
+ final override def eval(input: InternalRow = null): Any = {
+ // For convenience, we allow to evaluate `RuntimeReplaceable` expressions,
in case we need to
+ // get a constant from foldable expression before the query execution
starts.
+ assert(input == null)
Review Comment:
Ideally people should never eagerly evaluate a `RuntimeReplaceable`, the
only case I see is evaluating foldable expressions. I think it's better to only
allow it, to make sure that there is no `RuntimeReplaceable` leaked to the
runtime execution.
--
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]