Commit 5d29560
committed
[SPARK-32485][SQL][TEST] Fix RecordBinaryComparator tests on big-endian platforms.
Comparisons performed by RecordBinaryComparator are executed in
lexicographic order (byte by byte starting from the byte at index 0).
This means that the underlying endianness of the platform can affect
the result of a comparison between multi-byte values such as longs.
This difference means that two tests fail on big-endian platforms.
Also, the two tests compare 'special' long values to test edge cases
that triggered old bugs in the fast path of the comparator. However
since PR #26548 these 'special' values are byte-reversed before being
compared on little-endian platforms, which means that the edge cases
these 'special' values were designed to trigger are no longer tested.
This PR fixes both these issues by byte reversing the values on
little-endian systems.
RecordBinaryComparatorSuite tests now pass on a big-endian machine
(s390x).1 parent 15b7333 commit 5d29560
File tree
1 file changed
+42
-6
lines changed- sql/core/src/test/java/test/org/apache/spark/sql/execution/sort
1 file changed
+42
-6
lines changedLines changed: 42 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
264 | 283 | | |
265 | 284 | | |
266 | 285 | | |
267 | | - | |
| 286 | + | |
268 | 287 | | |
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
272 | | - | |
| 291 | + | |
273 | 292 | | |
274 | 293 | | |
275 | 294 | | |
276 | 295 | | |
277 | | - | |
| 296 | + | |
278 | 297 | | |
279 | 298 | | |
280 | 299 | | |
281 | 300 | | |
282 | 301 | | |
283 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
284 | 320 | | |
285 | 321 | | |
286 | 322 | | |
287 | | - | |
| 323 | + | |
288 | 324 | | |
289 | 325 | | |
290 | 326 | | |
291 | 327 | | |
292 | | - | |
| 328 | + | |
293 | 329 | | |
294 | 330 | | |
295 | 331 | | |
296 | 332 | | |
297 | | - | |
| 333 | + | |
298 | 334 | | |
299 | 335 | | |
300 | 336 | | |
| |||
0 commit comments