Commit d428794
authored
[Refactor](block) remove all index_by_name usage (apache#57860)
This pull request refactors how columns are accessed by name in the
`Block` class and related code, removing the internal name-to-index map
and switching to linear search. It also removes temporary column
handling and updates code throughout the backend to use the new column
access pattern. Additionally, it improves error handling and updates
some operator logic for schema scans.
### Block class refactor (core theme):
* Removed the internal `index_by_name` map from the `Block` class,
replacing all column name lookups with linear search via the new
`get_position_by_name` method. This affects methods like `get_by_name`,
`try_get_by_name`, `has`, and related insert/erase logic.
[[1]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L85-R87)
[[2]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L164-L193)
[[3]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L204-L227)
[[4]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L241-L247)
[[5]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L259-L288)
[[6]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L310-R268)
[[7]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L774)
[[8]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L795-L803)
[[9]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L825-L835)
* Removed the ability to erase columns by name and the logic for
maintaining the name-to-index map, simplifying column management.
[[1]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L259-L288)
[[2]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L241-L247)
[[3]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L795-L803)
### Temporary column handling (cleanup theme):
* Removed the definition and usage of temporary block column prefixes
and the method `erase_tmp_columns`, as well as related cleanup logic in
scan operators.
[[1]](diffhunk://#diff-d569a6c78638e9c539783057051e89bcb135cc254c763e3bc5e3a71e334df883L27-L28)
[[2]](diffhunk://#diff-ac38473f151ccd99db4ed80dfbfa176f4f957ae2f5335ce8fbb4f5dbb0e932e9L1332-L1338)
[[3]](diffhunk://#diff-76dba768c36c76cce660f7fe39514a98b509030a8976aabc9ac47d58bc923976L795-L803)
### Column access updates in backend logic (consistency theme):
* Updated all code that previously accessed columns by name using the
old map to use the new position-based access, including changes in
partial update logic, push broker reader, and schema scan operator.
[[1]](diffhunk://#diff-23fa0193d626ba712c4186c66bcd1809c7e55bfc04ea10f5a91c691ed3e04727L944-R947)
[[2]](diffhunk://#diff-2ed235dda16244dccd76626375b4512b6ade1724933269c40a2953c29dd95c61L314-R314)
[[3]](diffhunk://#diff-2ed235dda16244dccd76626375b4512b6ade1724933269c40a2953c29dd95c61L387-R388)
[[4]](diffhunk://#diff-2ed235dda16244dccd76626375b4512b6ade1724933269c40a2953c29dd95c61L423-L443)
[[5]](diffhunk://#diff-aa97e616efca2638565e6a58aa9295252714265fcc1ed904d503425ef4930ce7L481-R484)
[[6]](diffhunk://#diff-aa97e616efca2638565e6a58aa9295252714265fcc1ed904d503425ef4930ce7L494-R494)
[[7]](diffhunk://#diff-991f87a3acb91e58d14e3b30520de5dd07ecade8d4ecf885c02bf436873b4262R182)
[[8]](diffhunk://#diff-991f87a3acb91e58d14e3b30520de5dd07ecade8d4ecf885c02bf436873b4262L253-R257)
### Schema scan operator improvements (feature theme):
* Added a slot-to-column index mapping (`_slot_offsets`) to
`SchemaScanOperatorX` for more efficient column mapping during scans.
[[1]](diffhunk://#diff-82ea988d6a5179d6698c2844ad8f06167ebdb362225b07b35e9a5ba0a7bb173aR22-R23)
[[2]](diffhunk://#diff-82ea988d6a5179d6698c2844ad8f06167ebdb362225b07b35e9a5ba0a7bb173aR90-R92)
[[3]](diffhunk://#diff-991f87a3acb91e58d14e3b30520de5dd07ecade8d4ecf885c02bf436873b4262R182)
[[4]](diffhunk://#diff-991f87a3acb91e58d14e3b30520de5dd07ecade8d4ecf885c02bf436873b4262L253-R257)
### Error handling and robustness (quality theme):
* Improved error handling for missing columns, notably in partial update
logic, by returning internal errors with block structure dumps when
columns are not found.
---
This refactor simplifies the `Block` class, improves code consistency,
and enhances error handling across the backend.1 parent 758f167 commit d428794
File tree
28 files changed
+144
-391
lines changed- be
- src
- common
- olap
- pipeline/exec
- vec
- core
- exec
- format
- arrow
- orc
- parquet
- table
- scan
- functions
- olap
- sink
- test/vec
- core
- exec
- format/parquet
- orc
28 files changed
+144
-391
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
941 | 941 | | |
942 | 942 | | |
943 | 943 | | |
944 | | - | |
945 | | - | |
946 | | - | |
| 944 | + | |
| 945 | + | |
947 | 946 | | |
948 | | - | |
| 947 | + | |
949 | 948 | | |
950 | 949 | | |
951 | 950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
316 | | - | |
| 314 | + | |
317 | 315 | | |
318 | 316 | | |
319 | 317 | | |
| |||
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
387 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
388 | 389 | | |
389 | 390 | | |
390 | 391 | | |
| |||
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
423 | | - | |
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
| 427 | + | |
| 428 | + | |
428 | 429 | | |
429 | 430 | | |
430 | | - | |
| 431 | + | |
| 432 | + | |
431 | 433 | | |
432 | 434 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
437 | 439 | | |
438 | 440 | | |
439 | 441 | | |
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
443 | | - | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | 481 | | |
483 | 482 | | |
484 | 483 | | |
| 484 | + | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
467 | 466 | | |
468 | 467 | | |
469 | 468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1332 | 1332 | | |
1333 | 1333 | | |
1334 | 1334 | | |
1335 | | - | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | 1335 | | |
1343 | 1336 | | |
1344 | 1337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | | - | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
0 commit comments