Commit 2cb7ff2
authored
[18102873455] Handle sparse string columns on arrow read (#2700)
#### Reference Issues/PRs
Monday ref: 18102873455
#### What does this implement or fix?
Change consists of two commits (which can be reviewed separately):
First one (tests and benchmarks):
- Adds a python test via ternary operator which reads sparse data
- Adds a benchmark to verify type handler performance
- Renames `test_arrow.py` to `test_arrow_read.py`
Second one (actual fix):
- Correctly handle sparse input string column and preserve the speed of
dense handling (by filling the inverted bitset)
#### Any other comments?
This change slightly slows down (`503us` -> `594us`) string processing
for arrow (most noticably if very few unique strings).
Experimentation shows that 100% of the slowdown can be attributed to
failure to inline [this lambda
function](https://github.com/man-group/ArcticDB/pull/2700/files#diff-4e399a492a48cda55aa054cc5f6f30a73f35d8ff3aa11dbd32a1f8f2b17598b4R77-R94)
argument to `for_each_enumerated`.
If we unroll `for_each_enumerated` performance goes back to original
level.
This slowdown will be fixed in a follow up PR. (which might positively
impact a lot of processing pipeline affected by a similar issue)
Benchmark results:
```
benchmarks --benchmark_filter="BM_arrow_string.*" --benchmark_min_time=2000x --benchmark_repetitions=5 --benchmark_time_unit=us
After first commit:
-----------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------------------------
BM_arrow_string_handler/10000/1/0_mean 59.7 us 65.1 us 5
BM_arrow_string_handler/10000/1/0_stddev 1.19 us 1.29 us 5
BM_arrow_string_handler/100000/1/0_mean 503 us 544 us 5
BM_arrow_string_handler/100000/1/0_stddev 8.52 us 3.18 us 5
BM_arrow_string_handler/10000/10000/0_mean 202 us 210 us 5
BM_arrow_string_handler/10000/10000/0_stddev 12.6 us 2.61 us 5
BM_arrow_string_handler/100000/100000/0_mean 2707 us 2906 us 5
BM_arrow_string_handler/100000/100000/0_stddev 52.1 us 13.0 us 5
After second commit:
-----------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------------------------
BM_arrow_string_handler/10000/1/0_mean 65.6 us 71.6 us 5
BM_arrow_string_handler/10000/1/0_stddev 1.01 us 1.10 us 5
BM_arrow_string_handler/100000/1/0_mean 594 us 645 us 5
BM_arrow_string_handler/100000/1/0_stddev 8.67 us 6.29 us 5
BM_arrow_string_handler/10000/10000/0_mean 203 us 215 us 5
BM_arrow_string_handler/10000/10000/0_stddev 0.838 us 0.894 us 5
BM_arrow_string_handler/100000/100000/0_mean 2850 us 3046 us 5
BM_arrow_string_handler/100000/100000/0_stddev 118 us 57.9 us 5
BM_arrow_string_handler/10000/1/5000_mean 69.2 us 75.5 us 5
BM_arrow_string_handler/10000/1/5000_stddev 0.815 us 0.892 us 5
BM_arrow_string_handler/100000/1/50000_mean 614 us 670 us 5
BM_arrow_string_handler/100000/1/50000_stddev 4.92 us 5.36 us 5
BM_arrow_string_handler/10000/1/10000_mean 6.91 us 7.53 us 5
BM_arrow_string_handler/10000/1/10000_stddev 0.161 us 0.179 us 5
BM_arrow_string_handler/100000/1/100000_mean 7.99 us 8.39 us 5
BM_arrow_string_handler/100000/1/100000_stddev 0.259 us 0.121 us 5
```
#### Checklist
<details>
<summary>
Checklist for code changes...
</summary>
- [ ] Have you updated the relevant docstrings, documentation and
copyright notice?
- [ ] Is this contribution tested against [all ArcticDB's
features](../docs/mkdocs/docs/technical/contributing.md)?
- [ ] Do all exceptions introduced raise appropriate [error
messages](https://docs.arcticdb.io/error_messages/)?
- [ ] Are API changes highlighted in the PR description?
- [ ] Is the PR labelled as enhancement or bug so it appears in
autogenerated release notes?
</details>
<!--
Thanks for contributing a Pull Request to ArcticDB! Please ensure you
have taken a look at:
- ArcticDB's Code of Conduct:
https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md
- ArcticDB's Contribution Licensing:
https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing
-->1 parent 87fb70f commit 2cb7ff2
File tree
7 files changed
+200
-81
lines changed- cpp/arcticdb
- arrow
- test
- python/tests
- unit/arcticdb/version_store
7 files changed
+200
-81
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1105 | 1105 | | |
1106 | 1106 | | |
1107 | 1107 | | |
| 1108 | + | |
1108 | 1109 | | |
1109 | 1110 | | |
1110 | 1111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 68 | + | |
71 | 69 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 80 | + | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
87 | | - | |
| 84 | + | |
88 | 85 | | |
89 | 86 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
96 | 95 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 21 | | |
44 | 22 | | |
45 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1123 | 1123 | | |
1124 | 1124 | | |
1125 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1126 | 1134 | | |
1127 | 1135 | | |
1128 | 1136 | | |
| |||
0 commit comments