Repository navigation
Conversation
Local rows raise AssertionError (conversion) and CANNOT_INFER_TYPE_FOR_FIELD (inference); only the native row fallback of pandas input reads the values as doubles, while frames on the Arrow path convert them as PySpark does. Co-authored-by: Isaac <no-reply@databricks.com>
HyukjinKwon
marked this pull request as ready for review
November 8, 2026 10:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
SPARK-60704: fix Decimal hook dispatch and conversion-cache lifetime in the conversion already on master. Nested pandas inference also relates to SPARK-60696.
quantize(exp, context=...)call.Why are the changes needed?
Subclass hooks can otherwise be bypassed or receive incompatible arguments, and reentry can discard the outer conversion's cache. First-value-only inference can reject a later
Decimal("1.234")afterDecimal("1.2"), although both fit at the later scale.Does this PR introduce any user-facing change?
Yes. These are narrow correctness fixes with explicit compatibility limits:
decimal.Decimalto_pydecimal.Decimaldoes not make pure-Python instances native Decimals. Local-row conversion/inference can fail; inferred or names-only native pandas fallback can instead coerce them through__float__to doubles and lose precision. Quantums still use the selected class. Exact-C shortcuts assume CPython's immutable Decimal class.DefaultContextor a supplied context can observe different timing and sharing. Changes between conversions apply to the next conversion.PySparkRuntimeErrorduring DataFrame construction before sending a relation; reference PySpark Connect 4.3.0 can construct that input and later raiseArithmeticExceptionduring an action. A newly increased scale above 38 raisesValueErrorlocally. Existing explicit-nested conversion errors and Decimal-before-other-invalid-column ordering remain. Ordinary pandas columnar inputs retain Arrow's conversion errors.This does not establish full Python behavioral parity or introduce a new scientific-notation parser.
How was this patch tested?
Candidate
bbf493219fdda8bc668471163b936f34b5e46429against baselinee8b1d4284e11d119c4fda9563a913ece22f43e7c:InMemoryCatalog; it is outside those selected totals. Skips and exclusions are not passing coverage. Reference Python planning/conversion/decoding over Rust transport does not validate native Decimal conversion or full Python parity.PermissionError. The incomplete raw summary and failed-execution receipt are preserved; that run is not accepted as passed. A complete repeat uses an independently verified 3 GiB JVM heap, with unchanged sources, worker, driver and plan.Measurements use macOS, Spark Connect 4.3.0, pandas 2.3.3, PyArrow 26.0.0 and one shared owned local server. Decimal workloads have 200,000 rows and two fields; string workloads have three fields. Each worker is a separate process. The following values are client
createDataFrameCPU / wall milliseconds. Complete output and schema validation ran outside the timer.Warm medians of five calls:
First measured call per workload: imports, session setup and input preparation precede these samples; later workloads follow earlier ones in their worker.
Observed warm local-explicit CPU cost increased 6.5% versus master; the other three CPU medians changed by -1.2% to -0.1%. Whole-worker cumulative peak RSS was 273.1 MiB for master, 282.8 MiB for the candidate and 257.6 MiB for Python.
This is one fixed-order paired run without confidence intervals. RSS includes input preparation, expected tables, collection, validation and allocator retention. Guard-only cost, fallback/wide/nested workload performance, RPC/upload counts, conversion-only memory, process cold starts and whole-query performance are outside these measurements.
Was this patch authored or co-authored using generative AI tooling?
OpenAI Codex.
This pull request and its description were written by OpenAI Codex.