Skip to content

Commit 84fdb24

Browse files
committed
improve select_distinct_dimensions()
1 parent 3123a9d commit 84fdb24

File tree

1 file changed

+10
-10
lines changed
  • rust/cubesql/cubesql/src/compile/rewrite/rules

1 file changed

+10
-10
lines changed

rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,17 +1520,17 @@ impl MemberRules {
15201520
.member_name_to_expr
15211521
.as_ref()
15221522
.map_or(true, |member_names_to_expr| {
1523-
!member_names_to_expr.list.iter().any(|(_, member, _)| {
1524-
// we should allow transform only for queries with dimensions only,
1523+
!member_names_to_expr.list.iter().all(|(_, member, _)| {
1524+
// we should allow transform for queries with dimensions only,
15251525
// as it doesn't make sense for measures
1526-
meta_context
1527-
.find_measure_with_name(
1528-
member
1529-
.name()
1530-
.expect("Measure should have a name")
1531-
.to_string(),
1532-
)
1533-
.is_some()
1526+
if let Some(name) = member.name() {
1527+
meta_context
1528+
.find_dimension_with_name(name.to_string())
1529+
.is_some()
1530+
|| meta_context.is_synthetic_field(name.to_string())
1531+
} else {
1532+
true
1533+
}
15341534
})
15351535
})
15361536
}

0 commit comments

Comments
 (0)