Commit a6b5b73
feat: extract and populate RowKeys from sorted batches (#6292)
* feat: extract and populate RowKeys from sorted batches
Compute sort-key boundaries (first/last row values) during Parquet
write and store them as RowKeys proto in both the Parquet KV metadata
and MetricsSplitMetadata. The compactor uses these ranges to determine
key-range overlap between splits and to select merge boundaries.
- New row_keys module: extract_row_keys() reads sort schema column
values at rows 0 and N-1, mapping Arrow types to ColumnValue proto
- prepare_write() now computes row_keys after sorting and injects
qh.row_keys (base64) + qh.row_keys_json into Parquet KV metadata
- write_to_bytes/write_to_file_with_metadata return row_keys proto
bytes alongside the write result
- split_writer captures and stores row_keys_proto on metadata
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: verify RowKeys consistency across all three storage paths
End-to-end test with 8 rows across 4 series (including null tags,
mixed metrics, wide timestamp range). Writes through the full
split_writer pipeline and verifies the RowKeys proto is byte-identical
in all three places:
1. MetricsSplitMetadata.row_keys_proto (feeds Postgres)
2. Parquet file KV metadata (qh.row_keys, base64-encoded)
3. InsertableMetricsSplit.row_keys (Postgres column)
Also checks: min/max column values match expected sort order,
all_inclusive_max equals max, JSON metadata is parseable, and
the split is not marked expired.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: resolve merge conflicts after rebase — adapt to ParquetSplitMetadata API
- Keep DDSketch sketch validation in prepare_write
- Fix ParquetSplitWriter::new to pass ParquetSplitKind
- Remove Postgres path test (InsertableParquetSplit moved to quickwit-metastore)
- Update MetricsSplitMetadata references to ParquetSplitMetadata
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style: fix nightly fmt — collapse split_writer binding to one line
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add .unwrap() to ParquetWriter/ParquetSplitWriter::new calls in row_keys tests
These constructors now return Result after the sorted-series-key merge.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: normalize legacy "timestamp" to "timestamp_secs" in row_keys extraction
The sort schema parser accepts "timestamp" as a legacy alias, but the
Arrow batch only contains "timestamp_secs". Without normalization,
index_of fails and the code encodes None for the timestamp boundary,
losing time range information from RowKeys.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: deduplicate qh.row_keys in Parquet KV metadata
build_compaction_key_value_metadata already emits qh.row_keys when
split_metadata.row_keys_proto is present. prepare_write then appended
another entry from freshly computed values, producing duplicates.
Now strips any pre-existing qh.row_keys and qh.row_keys_json before
pushing the authoritative values from the sorted batch. Also adds a
test assertion verifying exactly one qh.row_keys entry exists.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 68990db commit a6b5b73
5 files changed
Lines changed: 1009 additions & 27 deletions
File tree
- quickwit/quickwit-parquet-engine/src
- row_keys
- storage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| 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 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
0 commit comments