vinodkc commented on code in PR #58195:
URL: https://github.com/apache/spark/pull/58195#discussion_r4620528223
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/UnsafeRowUtils.scala:
##########
@@ -237,4 +237,35 @@ object UnsafeRowUtils {
!st.supportsBinaryEquality
case _ => false
}
+
+ /**
+ * Returns an equality checker for grouping keys (UnsafeRows) of the given
data types.
+ * If every type is binary-stable, equality is a plain binary comparison.
Otherwise (e.g.
+ * a STRING with a non-binary collation), values that are semantically equal
can have
+ * different binary representations, so the checker falls back to an
ordering-based
+ * comparison that applies to all fields.
+ *
+ * `checkBytesFirst` controls whether that fallback compares the key bytes
before the
+ * ordering, and is only observable for non-binary-stable keys:
byte-identical rows
+ * compare equal under every collation and SQL ordering, so a byte-first
check answers
+ * same-spelling keys with one byte comparison, while every check whose
bytes differ
+ * pays a failed byte comparison before the same ordering comparison. It
pays off where
+ * most checks see keys spelled alike, such as rows compared against the
first row of
+ * the current group; where that trade-off has not been measured for a site,
pass
+ * `false` and compare collated keys with the ordering alone.
Review Comment:
Done (57dfd502e4a), with your wording: the Scaladoc now states that both
forms group keys the same way, that the choice only moves cost between checks
of identically spelled keys and all other checks, and that each call site's
comment says why it passes the value it does; no rule remains that the six
callers contradict.
--
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]