You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/14 00:23:46 UTC

[GitHub] [spark] viirya commented on a change in pull request #34883: [SPARK-37629][SQL] Speed up Expression.canonicalized

viirya commented on a change in pull request #34883:
URL: https://github.com/apache/spark/pull/34883#discussion_r768223821



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
##########
@@ -222,6 +222,20 @@ abstract class Expression extends TreeNode[Expression] {
    */
   def childrenResolved: Boolean = children.forall(_.resolved)
 
+  // Return a roughly canonicalized expression, which recursively canonicalizes each expression node
+  // without changing the structure of the expression tree.
+  // This method should only be called in `canonicalized` or subclass's `roughlyCanonicalized`.
+  // Subclasses (especially leaf nodes) should override this method to customize the
+  // canonicalization logic. Some basic canonicalization rules:
+  //  - Names and nullability hints for `DataType`s are stripped. See the override in
+  //    `AttributeReference` and `GetStructField`.
+  //  - TimeZoneId for [[Cast]] and [[AnsiCast]] are stripped if `needsTimeZone` is false.
+  //  - Rearrange the inputs of certain predicate expressions according to the `hashCode` of inputs.
+  lazy val roughlyCanonicalized: Expression = {

Review comment:
       `preCanonicalized`? roughlyCanonicalized` looks a bit vague and weird.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org