lavanv11 opened a new pull request, #58799:
URL: https://github.com/apache/spark/pull/58799
### What changes were proposed in this pull request?
This PR includes both `pyUDT` and `sqlType` in
`PythonUserDefinedType.equals` and
`hashCode`.
`serializedPyClass` remains excluded from identity, and `acceptsType`
retains its
existing compatibility semantics.
The PR also adds regression coverage for the shared
`InternalRowComparableWrapper`
ordering cache in both lookup orders, plus focused equality and hash-code
tests.
### Why are the changes needed?
`InternalRowComparableWrapper` caches generated orderings by data type.
Python UDT
equality previously considered only the Python class name, so UDTs with the
same
class name but different underlying SQL types could share a cache entry.
For example, binary and `UTF8_LCASE` string-backed UDTs could reuse the first
generated comparator, producing lookup-order-dependent collation semantics.
### Does this PR introduce _any_ user-facing change?
Yes. Python UDT-backed grouped keys now consistently use the ordering
semantics of
their underlying SQL type instead of potentially reusing a comparator
generated for
another SQL type.
### How was this patch tested?
Added regression tests to `InternalRowComparableWrapperSuite`, covering
binary-first
and UTF8_LCASE-first cache lookup orders, and to `DataTypeSuite`, covering
equality,
hash codes, differing SQL types, and exclusion of serialized Python class
data.
Ran:
```
build/sbt \
'catalyst/testOnly
org.apache.spark.sql.catalyst.util.InternalRowComparableWrapperSuite' \
'catalyst/testOnly org.apache.spark.sql.types.DataTypeSuite'
```
`InternalRowComparableWrapperSuite`: 7 passed; `DataTypeSuite`: 352 passed.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)
--
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]