Repository navigation
Commit 5d53eb3
[refactor](be) Replace PrimitiveTypeConvertor with StorageLayout keyed by FieldType
### What problem does this PR solve?
Issue Number: None
Related PR: #68608, #68609
Problem Summary: How a compute-layer value becomes the value a segment stores
is written down in several places. PrimitiveTypeConvertor<PT> gives the V1
DATE, DATETIME and DECIMAL layouts to the key encodings of RowCursor and the
BKD index; KeyCoderTraitsForFloat canonicalises NaN on its own; and the
comparison and IN-list predicates repeat the V1 conversions by hand to probe a
bloom filter. The key-encodable types are listed as (FieldType, PrimitiveType)
pairs so that the key helpers can be keyed by PrimitiveType.
Add storage/storage_layout.h. For every fixed-width FieldType, StorageLayout<FT>
gives the StorageValue a segment stores, the PrimitiveValue the compute layer
holds, and to_storage from one to the other: a bit cast, the quiet NaN for
every NaN of FLOAT/DOUBLE, and the V1 packing of DATE, DATETIME and DECIMAL.
Make the PrimitiveType <-> FieldType mapping in storage_field_type.h constexpr,
so that a template picks its layout with
StorageLayout<primitive_type_to_storage_field_type(PT)>; data_type.h now
declares FieldType itself instead of including that header.
Move the users onto it: full_encode_field_as_key and so the RowCursor and BKD
query key encodings, the BKD +/- infinity sentinels, the NaN handling of
KeyCoderTraitsForFloat, and the bloom filter probes of the comparison and
IN-list predicates. The key-encodable types are listed by FieldType alone.
Delete PrimitiveTypeConvertor, whose last user was a test helper.
Every conversion is the one it replaces, so no stored or encoded byte changes.
The one difference is that a bloom filter probe now canonicalises a NaN, and no
bloom filter index is built on FLOAT or DOUBLE.
This is the second piece split out of #68608; the page encoders and decoders
move onto StorageLayout in later pieces.
### Release note
None
### Check List (For Author)
- Test: Unit Test
- StorageLayoutTest (new): the StorageValue size of every fixed-width
FieldType, the V1 DATE, DATETIME and DECIMAL packing, NaN
canonicalisation and bit casts
- KeyCoderTest (key order of full_encode_field_as_key for every key type),
TestRowCursor, StorageFieldTypeTest, DateBloomFilterTest,
BloomFilterIndexReaderWriterTest, BlockColumnPredicateTest,
PredicateCreatorTest, InvertedIndexReaderTest (BKD range queries of
every key type), SniiBkd*, and SegmentFlusherFormatTest and
SegmentFlusherTransformFormatTest with strict golden comparison
- Behavior changed: No
- Does this need documentation: No
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent 7dc90d1 commit 5d53eb3
16 files changed
Lines changed: 596 additions & 454 deletions
File tree
- be
- src
- core/data_type
- storage
- index
- inverted
- predicate
- test/storage
- segment
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | 558 | | |
603 | 559 | | |
604 | 560 | | |
| |||
This file was deleted.
0 commit comments