LuciferYang commented on code in PR #48912:
URL: https://github.com/apache/spark/pull/48912#discussion_r1852023714
##########
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:
If the premise here must be that `input == null`, then would it be better to
throw a meaningful QueryExecutionError instead of an AssertionError when input
is not null?
##########
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:
If the premise here must be that `input == null`, then would it be better to
throw a meaningful QueryExecutionError instead of an `AssertionError` when
input is not null?
--
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]