Anurag Mantripragada created SPARK-60075:
--------------------------------------------

             Summary: Avoid infinite recursion in toString of a V2 expression 
that V2ExpressionSQLBuilder does not know
                 Key: SPARK-60075
                 URL: https://issues.apache.org/jira/browse/SPARK-60075
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Anurag Mantripragada


V2ExpressionSQLBuilder.visitUnexpectedExpr builds its UNEXPECTED_V2_EXPRESSION 
error with String.valueOf(expr). For an ExpressionWithToString (for example a 
GeneralScalarExpression whose name the builder does not know, such as new 
GeneralScalarExpression("DATE_TRUNC", ...)), toString() calls 
ToStringSQLBuilder.build, which reaches visitUnexpectedExpr again, so 
toString() recurses until StackOverflowError instead of producing a string or a 
clean error.

Anything that prints such an expression is affected: describe(), log messages, 
error messages and explain output. SPARK-34586 
(https://github.com/apache/spark/pull/58153) works around it for DESCRIBE TABLE 
EXTENDED of a declared write ordering.

visitUnexpectedExpr should describe the expression without calling its 
toString(), for example by its class name and the name of a 
GeneralScalarExpression.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to