You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "laserninja (via GitHub)" <gi...@apache.org> on 2026/09/14 20:58:51 UTC
[PR] [PYTHON] Compare leaf type parameters in assertSchemaEqual [spark]
laserninja opened a new pull request, #58791:
URL: https://github.com/apache/spark/pull/58791
### What changes were proposed in this pull request?
Use data-type equality for leaf types after the existing recursive nullability handling. Add coverage for collations, character lengths, time precision, interval bounds, and nested containers.
### Why are the changes needed?
The ignoreNullable comparator accepts remaining types solely because typeName matches. This also ignores semantic parameters unrelated to nullability, such as UTF8_BINARY versus UTF8_LCASE collations.
```python
from pyspark.sql.types import StringType, StructField, StructType
from pyspark.testing import assertSchemaEqual
a = StructType([StructField("s", StringType())])
b = StructType([StructField("s", StringType("UTF8_LCASE"))])
assertSchemaEqual(a, b) # Returns without raising
```
### Does this PR introduce _any_ user-facing change?
Yes. With ignoreNullable=True, schemas with unequal leaf-type parameters now raise DIFFERENT_SCHEMA. Recursive array, map, and struct nullability remains ignored.
### How was this patch tested?
The new regression tests failed before the fix and passed afterward on Python 3.10.11 with NumPy 2.2.6. The focused run passed 2 tests, including parameterized subtests:
```bash
PYTHONPATH=python TERM=dumb python -m unittest pyspark.sql.tests.test_utils.SchemaComparisonTests -q
PYTHON_EXECUTABLE=python ./dev/lint-python --compile --custom-pyspark-error --ruff
```
Run the commands with the Python virtual environment activated; the local run shared an environment from a sibling checkout. The tests call public Python APIs directly and require no SparkSession. Python compilation, custom-error checks, Ruff lint, and Ruff formatting passed. JVM-backed suites were not run because these fixes are confined to Python-side logic.
Draft pending creation and linking of the corresponding ASF Jira issue.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-6).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-59515][PYTHON] Compare leaf type parameters in assertSchemaEqual [spark]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #58791:
URL: https://github.com/apache/spark/pull/58791#issuecomment-5673795857
Thanks for the review. Created [SPARK-59515](https://issues.apache.org/jira/browse/SPARK-59515), linked it in the description, and added the Jira ID to the title. I also explicitly noted that user tests relying on the previous loose matching of leaf-type parameters may now fail correctly with DIFFERENT_SCHEMA, while recursive nullability remains ignored. No code changes were needed for these review items.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-59515][PYTHON] Compare leaf type parameters in assertSchemaEqual [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #58791:
URL: https://github.com/apache/spark/pull/58791#issuecomment-5789481107
cc @asl3
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org