cloud-fan commented on code in PR #58581:
URL: https://github.com/apache/spark/pull/58581#discussion_r3962401440
##########
python/pyspark/sql/types.py:
##########
@@ -1366,10 +1390,15 @@ def processDataType(dt: DataType, fieldPath: str) ->
None:
return collationMetadata
def _isCollatedString(self, dt: DataType) -> bool:
- return isinstance(dt, StringType) and not dt.isUTF8BinaryCollation()
+ if isinstance(dt, StringType):
+ return not dt.isUTF8BinaryCollation()
+ if isinstance(dt, (CharType, VarcharType)):
+ return not dt.isUTF8BinaryCollation()
Review Comment:
Thanks for the update. The Python fix is still unreachable because
`CharType` and `VarcharType` inherit from `AtomicType`, not `StringType`. I
don't think changing their Python inheritance is appropriate here: it would
broaden all `isinstance(..., StringType)` dispatches, and the current
JSON-removal branch would then take the generic case first and lose
CHAR/VARCHAR lengths. Please handle the constrained types explicitly before
`StringType` and add exact JSON-shape coverage, including explicit
`UTF8_BINARY`.
<!-- SPARK_DEV_REVIEW_REPLY
{"feedback_id":"inline:3960045561","thread_id":"inline:3960045561","verdict_sha256":"225cb381ab3e25f7a1747b558361645191950bf3bdc65b526d158a2277851d38"}
-->
--
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]