Skip to content

Commit 7f09431

Browse files
committed
fix(cubestore): don't add all measures to default preagg index
1 parent bbc335d commit 7f09431

File tree

1 file changed

+13
-4
lines changed
  • rust/cubestore/cubestore/src/metastore

1 file changed

+13
-4
lines changed

rust/cubestore/cubestore/src/metastore/mod.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ impl MetaStore for RocksMetaStore {
21342134
} else {
21352135
None
21362136
};
2137-
let aggregate_column_indices = if let Some(aggrs) = aggregates {
2137+
let aggregate_column_indices = if let Some(ref aggrs) = aggregates {
21382138
let res = aggrs.iter()
21392139
.map(|aggr| {
21402140
let aggr_column = &aggr.1;
@@ -2232,6 +2232,14 @@ impl MetaStore for RocksMetaStore {
22322232
index_def,
22332233
)?;
22342234
}
2235+
2236+
let aggr_column_names = if let Some(ref aggrs) = aggregates {
2237+
aggrs.iter()
2238+
.map(|aggr| aggr.1.clone())
2239+
.collect::<Vec<String>>()
2240+
} else {
2241+
vec![]
2242+
};
22352243
let def_index_columns = table_id
22362244
.get_row()
22372245
.unique_key_columns()
@@ -2242,9 +2250,10 @@ impl MetaStore for RocksMetaStore {
22422250
ColumnType::Bytes => None,
22432251
ColumnType::HyperLogLog(_) => None,
22442252
_ => {
2245-
if seq_column_index.is_none()
2246-
|| seq_column_index.is_some()
2247-
&& c.get_index() as u64 != seq_column_index.unwrap()
2253+
if !aggr_column_names.contains(&c.get_name())
2254+
&& seq_column_index.is_none()
2255+
|| (seq_column_index.is_some()
2256+
&& c.get_index() as u64 != seq_column_index.unwrap())
22482257
{
22492258
Some(c.get_name().clone())
22502259
} else {

0 commit comments

Comments
 (0)