shivadarshan-devadiga commented on code in PR #60750:
URL: https://github.com/apache/spark/pull/60750#discussion_r4651084576
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ApplyCharTypePaddingHelper.scala:
##########
@@ -48,6 +53,37 @@ object ApplyCharTypePaddingHelper {
}
}
+ /**
+ * A column, or a field of a struct column reached through
[[GetStructField]], with the raw type
+ * of that column or field. The raw type is the one recorded in the column's
metadata, so a CHAR
+ * or VARCHAR field keeps its length although its data type is a string.
+ */
+ object RawTypedRef {
+ // A value whose type no longer matches its raw type, e.g. after a cast,
has none.
+ def unapply(e: Expression): Option[DataType] = rawType(e).filter { rawType
=>
Review Comment:
Thank you, you're right, and the PR description was wrong about it. I took
your suggestion: a CHAR raw type now accepts a value of any string type, as
`padAttrLitCmp` did, and other raw types still need the exact type. The
`Dataset.to` example with `STRING COLLATE UTF8_LCASE` is now in `SPARK-61970:
char type comparison with a constant in filters and outer references`:
`where("c = 'a'")` returns the row, and `selectExpr("c = 'a'")` is true.
--
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]