HyukjinKwon opened a new pull request, #159:
URL: https://github.com/apache/spark-connect-rust/pull/159

   ### What changes were proposed in this pull request?
   
   [SPARK-60921](https://issues.apache.org/jira/browse/SPARK-60921): the Python 
client's data types now compare and hash as PySpark's do.
   
   - As PySpark's `DataType.__eq__` does, a data type is equal to a data type 
of its class, or of a subclass of it, with the same attributes, and `!=` to any 
other. The attributes of the types of this module are their Spark data types, 
such as the fields of a struct, the precision and scale of a decimal, or the 
element type and `containsNull` of an array; those of a pure-Python subclass, 
such as a `UserDefinedType`, are its `__dict__`, as in PySpark. Data types 
still do not order.
   - As PySpark's `DataType.__hash__` does, a data type hashes as its string, 
and `StructField` is now hashable.
   
   ### Why are the changes needed?
   
   The data types other than `StructField` defined no equality, so they 
compared by identity: `IntegerType() == IntegerType()` was false, and so was 
every comparison of schemas or field types, as in `df.schema == 
StructType(...)` or `field.dataType == StringType()`, and of a type with its 
pickled copy. Equal types also hashed differently, and `StructField` was 
unhashable.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, data types now compare and hash as in PySpark Connect 4.3.0.
   
   ### How was this patch tested?
   
   - A probe of eight comparisons, of integer, decimal, array, map and struct 
types and struct fields, gives output identical to official PySpark 4.3.0 for 
`==`, `!=` and hash equality.
   - New offline tests check equality both ways, `!=`, and hashing for fourteen 
pairs of data types, the equality of a nested schema with its pickled copy, 
comparisons with other objects, and that data types do not order. A new live 
test checks that a schema from the server equals the expected one, and that its 
field types compare. They also pass with official PySpark 4.3.0.
   - The offline Python suites (435 passed, 8 live cases skipped), and the live 
drop-in and Arrow suites (22 passed) and live cases (9 passed). Clippy reports 
no diagnostics in the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


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