cloud-fan commented on a change in pull request #31034:
URL: https://github.com/apache/spark/pull/31034#discussion_r554846502
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -298,6 +300,30 @@ class Analyzer(override val catalogManager: CatalogManager)
CleanupAliases)
)
+ /**
+ * Initialize the tag of Cast so we can distinguish if Cast is
auto-generated by Analyzer and
+ * strip auto-generated cast when use Cast.sql.
+ */
+ object InitializeCastTag extends Rule[LogicalPlan] {
+ private def setCastTag(plan: LogicalPlan): Unit = {
+ plan.resolveOperators { case p =>
+ p.transformExpressions {
+ case cast: CastBase =>
+ cast.setTagValue(Cast.AUTO_GENERATED_TAG, false)
Review comment:
that's for test only, but from the test writer's point of view, it's
user-specified as well, and let's handle it too.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]