Commit a2bb4c9
authored
feat(parquet): selective null padding for list child readers (#9848)
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->
- Contributes to #9731
- Depend on #9847
- Depend on #9846
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
Parquet list decoding currently materializes padding for null or empty
parent lists and then copies the child array to filter that padding back
out. This is expensive for nested list columns, especially sparse lists
and fixed-width children, where memory can scale with decoded levels
instead of actual emitted child values.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
This PR makes list child readers emit compact child arrays directly by
pushing selective null padding into the leaf `RecordReader`. It also
builds definition-level validity bitmaps word-at-a-time, sizes child
buffers after levels are decoded, and adds list runtime and peak-memory
benchmarks across element types and null densities.
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
Extensive test coverage for the new logic through existing list reader
tests, which now exercise the production `PrimitiveArrayReader` path
with in-memory Parquet pages (see #9846), and
`BooleanBufferBuilder::append_word` has targeted unit coverage.
Benchmarks results:
```
Name Before After Delta
ListArray/StringList/no NULLs 7.3395 ms 5.8001 ms (-21.0%)
ListArray/StringList/half NULLs 4.1255 ms 3.4274 ms (-16.9%)
ListArray/Int32List/90pct NULLs 1.0366 ms 975.63 us (-5.9%)
ListArray/Fixed32List/no NULLs 4.9298 ms 3.3137 ms (-32.8%)
ListArray/Fixed32List/half NULLs 2.8998 ms 2.7258 ms (-6.0%)
ListArray/Fixed32List/90pct NULLs 1.0556 ms 995.82 us (-5.7%)
ListArray/Fixed32List/99pct NULLs 508.65 us 467.16 us (-8.2%)
Name Before After Delta
ListArray_peak_memory/Int32List/no NULLs 836.51 KiB 574.79 KiB (-31.3%)
ListArray_peak_memory/Int32List/half NULLs 482.01 KiB 336.29 KiB (-30.2%)
ListArray_peak_memory/Int32List/90pct NULLs 271.95 KiB 175.32 KiB (-35.5%)
ListArray_peak_memory/Int32List/99pct NULLs 217.96 KiB 120.04 KiB (-44.9%)
ListArray_peak_memory/DoubleList/no NULLs 1.2399 MiB 715.31 KiB (-43.7%)
ListArray_peak_memory/DoubleList/half NULLs 753.66 KiB 400.39 KiB (-46.9%)
ListArray_peak_memory/DoubleList/90pct NULLs 380.62 KiB 190.89 KiB (-49.8%)
ListArray_peak_memory/DoubleList/99pct NULLs 315.21 KiB 121.61 KiB (-61.4%)
ListArray_peak_memory/Fixed32List/no NULLs 3.8031 MiB 1.5760 MiB (-58.6%)
ListArray_peak_memory/Fixed32List/half NULLs 2.1710 MiB 849.94 KiB (-61.8%)
ListArray_peak_memory/Fixed32List/90pct NULLs 1.0017 MiB 277.35 KiB (-73.0%)
ListArray_peak_memory/Fixed32List/99pct NULLs 898.69 KiB 130.93 KiB (-85.4%)
ListArray_peak_memory/StringList/no NULLs 3.7925 MiB 2.4715 MiB (-34.8%)
ListArray_peak_memory/StringList/half NULLs 1.2541 MiB 772.94 KiB (-39.8%)
ListArray_peak_memory/StringList/90pct NULLs 296.63 KiB 188.96 KiB (-36.3%)
ListArray_peak_memory/StringList/99pct NULLs 226.75 KiB 120.37 KiB (-46.9%)
Name Before After Delta
ListArray_allocated_bytes/Int32List/no NULLs 10.458 MiB 6.8018 MiB (-35.0%)
ListArray_allocated_bytes/Int32List/half NULLs 5.9797 MiB 4.0127 MiB (-32.9%)
ListArray_allocated_bytes/Int32List/90pct NULLs 2.9985 MiB 1.8210 MiB (-39.3%)
ListArray_allocated_bytes/Int32List/99pct NULLs 2.5579 MiB 1.3733 MiB (-46.3%)
ListArray_allocated_bytes/DoubleList/no NULLs 16.083 MiB 8.6546 MiB (-46.2%)
ListArray_allocated_bytes/DoubleList/half NULLs 8.9134 MiB 4.8497 MiB (-45.6%)
ListArray_allocated_bytes/DoubleList/90pct NULLs 4.3656 MiB 2.0179 MiB (-53.8%)
ListArray_allocated_bytes/DoubleList/99pct NULLs 3.7482 MiB 1.3903 MiB (-62.9%)
ListArray_allocated_bytes/Fixed32List/no NULLs 49.441 MiB 19.505 MiB (-60.5%)
ListArray_allocated_bytes/Fixed32List/half NULLs 26.846 MiB 10.459 MiB (-61.0%)
ListArray_allocated_bytes/Fixed32List/90pct NULLs 12.483 MiB 3.1127 MiB (-75.1%)
ListArray_allocated_bytes/Fixed32List/99pct NULLs 10.895 MiB 1.4980 MiB (-86.3%)
ListArray_allocated_bytes/StringList/no NULLs 47.519 MiB 21.743 MiB (-54.2%)
ListArray_allocated_bytes/StringList/half NULLs 19.097 MiB 10.478 MiB (-45.1%)
ListArray_allocated_bytes/StringList/90pct NULLs 3.4203 MiB 2.1165 MiB (-38.1%)
ListArray_allocated_bytes/StringList/99pct NULLs 2.6424 MiB 1.3777 MiB (-47.9%)
```
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
If there are any breaking changes to public APIs, please call them out.
-->
None.
---------
Signed-off-by: Hippolyte Barraud <hippolyte.barraud@datadoghq.com>1 parent d3d7ae8 commit a2bb4c9
28 files changed
Lines changed: 1440 additions & 405 deletions
File tree
- arrow-buffer/src/builder
- parquet
- benches
- src
- arrow
- array_reader
- arrow_reader
- buffer
- record_reader
- column
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
189 | 229 | | |
190 | 230 | | |
191 | 231 | | |
| |||
619 | 659 | | |
620 | 660 | | |
621 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
622 | 758 | | |
623 | 759 | | |
624 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
785 | 785 | | |
786 | 786 | | |
787 | 787 | | |
| 788 | + | |
788 | 789 | | |
789 | 790 | | |
790 | 791 | | |
791 | 792 | | |
792 | 793 | | |
793 | | - | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
794 | 797 | | |
795 | 798 | | |
796 | 799 | | |
| |||
858 | 861 | | |
859 | 862 | | |
860 | 863 | | |
| 864 | + | |
861 | 865 | | |
862 | 866 | | |
863 | 867 | | |
864 | 868 | | |
865 | | - | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
866 | 872 | | |
867 | 873 | | |
868 | 874 | | |
| |||
912 | 918 | | |
913 | 919 | | |
914 | 920 | | |
| 921 | + | |
915 | 922 | | |
916 | 923 | | |
917 | 924 | | |
| |||
922 | 929 | | |
923 | 930 | | |
924 | 931 | | |
| 932 | + | |
925 | 933 | | |
926 | 934 | | |
927 | 935 | | |
| |||
932 | 940 | | |
933 | 941 | | |
934 | 942 | | |
| 943 | + | |
935 | 944 | | |
936 | 945 | | |
937 | 946 | | |
| |||
951 | 960 | | |
952 | 961 | | |
953 | 962 | | |
| 963 | + | |
954 | 964 | | |
955 | 965 | | |
956 | 966 | | |
| |||
968 | 978 | | |
969 | 979 | | |
970 | 980 | | |
| 981 | + | |
971 | 982 | | |
972 | 983 | | |
973 | 984 | | |
974 | 985 | | |
975 | 986 | | |
976 | 987 | | |
977 | 988 | | |
| 989 | + | |
978 | 990 | | |
979 | 991 | | |
980 | 992 | | |
| |||
990 | 1002 | | |
991 | 1003 | | |
992 | 1004 | | |
| 1005 | + | |
993 | 1006 | | |
994 | 1007 | | |
995 | 1008 | | |
| |||
1003 | 1016 | | |
1004 | 1017 | | |
1005 | 1018 | | |
| 1019 | + | |
1006 | 1020 | | |
1007 | 1021 | | |
1008 | 1022 | | |
| |||
1016 | 1030 | | |
1017 | 1031 | | |
1018 | 1032 | | |
| 1033 | + | |
1019 | 1034 | | |
1020 | 1035 | | |
1021 | 1036 | | |
| |||
1029 | 1044 | | |
1030 | 1045 | | |
1031 | 1046 | | |
| 1047 | + | |
1032 | 1048 | | |
1033 | 1049 | | |
1034 | 1050 | | |
| |||
1045 | 1061 | | |
1046 | 1062 | | |
1047 | 1063 | | |
| 1064 | + | |
1048 | 1065 | | |
1049 | 1066 | | |
1050 | 1067 | | |
| |||
1053 | 1070 | | |
1054 | 1071 | | |
1055 | 1072 | | |
1056 | | - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
1057 | 1081 | | |
1058 | 1082 | | |
1059 | | - | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1060 | 1086 | | |
1061 | 1087 | | |
1062 | 1088 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
448 | 454 | | |
449 | 455 | | |
450 | 456 | | |
451 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
452 | 460 | | |
453 | 461 | | |
454 | 462 | | |
455 | 463 | | |
456 | 464 | | |
457 | 465 | | |
458 | 466 | | |
459 | | - | |
460 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
461 | 475 | | |
462 | 476 | | |
463 | 477 | | |
464 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
465 | 481 | | |
466 | 482 | | |
467 | 483 | | |
468 | 484 | | |
469 | 485 | | |
470 | 486 | | |
471 | 487 | | |
472 | | - | |
| 488 | + | |
| 489 | + | |
473 | 490 | | |
474 | 491 | | |
475 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
476 | 495 | | |
477 | 496 | | |
478 | 497 | | |
479 | 498 | | |
480 | 499 | | |
481 | 500 | | |
482 | | - | |
| 501 | + | |
| 502 | + | |
483 | 503 | | |
484 | 504 | | |
485 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
486 | 508 | | |
487 | 509 | | |
488 | 510 | | |
| |||
0 commit comments