Repository navigation
Commit 03204c0
fix: keep the running hash for nested dictionaries in Spark xxhash64 (#25813)
## Which issue does this PR close?
- Closes #25799.
## Rationale for this change
Spark `xxhash64` returns different results for the same data depending
on whether a value inside a struct or list is dictionary-encoded. The
dictionary fast path restarted from the default seed, so earlier
arguments and earlier list elements had no effect.
## What changes are included in this PR?
Ports the fix from apache/datafusion-comet#5757:
- The dictionary fast path is used only when every row has the same
running hash.
- The fast path starts from that running hash instead of 42.
## What is the testing strategy for this PR?
Two unit tests ported from Comet, both fail on main:
- `test_dictionary_element_in_list_matches_decoded`: a dictionary inside
a list hashes the same as its decoded values.
- `test_dictionary_with_nonuniform_seeds_matches_decoded`: rows with
different running hashes hash the same as the decoded values.
The existing Spark hash unit tests and sqllogictests pass. Both queries
from the issue now return matching results for dictionary and plain
values.
## Are there any user-facing changes?
`xxhash64` now matches Spark for dictionary-encoded values inside
structs and lists. No API changes.
Co-authored-by: tohuya6 <201355151+tohuya6@users.noreply.github.com>
Co-authored-by: Neil Conway <neil.conway@gmail.com>1 parent 4978b30 commit 03204c0
2 files changed
Lines changed: 70 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
898 | 898 | | |
899 | 899 | | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
902 | 909 | | |
903 | 910 | | |
904 | 911 | | |
| |||
957 | 964 | | |
958 | 965 | | |
959 | 966 | | |
960 | | - | |
| 967 | + | |
| 968 | + | |
961 | 969 | | |
962 | 970 | | |
963 | 971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
346 | 403 | | |
347 | 404 | | |
348 | 405 | | |
| |||
0 commit comments