LuciferYang commented on code in PR #60168:
URL: https://github.com/apache/spark/pull/60168#discussion_r4546852750


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statsEstimation/ValueInterval.scala:
##########
@@ -62,12 +62,13 @@ object ValueInterval {
   }
 
   def isIntersected(r1: ValueInterval, r2: ValueInterval): Boolean = (r1, r2) 
match {
-    case (_, _: DefaultValueInterval) | (_: DefaultValueInterval, _) =>
-      // The DefaultValueInterval represents string/binary types which do not 
have max/min stats,
-      // we assume they are intersected to be conservative on estimation
-      true
     case (_, _: NullValueInterval) | (_: NullValueInterval, _) =>
+      // Null values intersect no interval, even one whose range is unknown
       false
+    case (_, _: DefaultValueInterval) | (_: DefaultValueInterval, _) =>
+      // The DefaultValueInterval has an unknown range, e.g. for string/binary 
types which do not

Review Comment:
   Done in ed972757ef4. The class doc now covers both cases, binary/string 
types and a join key with distinct values but no min/max, and does not cover a 
column that holds only nulls. The `intersect` arm for two unknown ranges says 
neither range is known.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statsEstimation/JoinEstimation.scala:
##########
@@ -223,6 +224,19 @@ case class JoinEstimation(join: Join) extends Logging {
     (joinCard, AttributeMap(keyStatsAfterJoin))
   }
 
+  /**
+   * Returns the value range of a join key. A key with distinct values but no 
min/max (a data
+   * source may not report them, and a union drops them for some types) has an 
unknown range, not
+   * only nulls. Like a string key, it is assumed to overlap the other key.

Review Comment:
   Done in ed972757ef4. It now says such a key overlaps the other key unless 
that key holds only nulls.



-- 
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]

Reply via email to