加速日度行位置索引查询

This commit is contained in:
boris
2026-08-29 21:33:38 +08:00
parent d547bfc5b7
commit 42c92fd184
+4 -2
View File
@@ -566,7 +566,9 @@ struct SymbolPriceSeries {
valid_volume_start_by_count: Vec<usize>,
}
type DenseRowPositionIndex = BTreeMap<NaiveDate, Vec<u32>>;
// Row groups keep their chronological BTreeMap for range scans, while the
// hot symbol-id lookup uses a hash index to avoid a tree traversal per row.
type DenseRowPositionIndex = AHashMap<NaiveDate, Vec<u32>>;
const MISSING_ROW_POSITION: u32 = u32::MAX;
const MAX_DENSE_ROW_INDEX_BYTES: usize = 256 * 1024 * 1024;
@@ -4048,7 +4050,7 @@ fn build_dense_row_positions<T>(
return None;
}
let mut positions_by_date = BTreeMap::new();
let mut positions_by_date = AHashMap::new();
for (date, rows) in groups {
let symbol_ids = symbol_ids_by_date.get(date)?;
if rows.len() != symbol_ids.len() {