Skip to content

Commit 02ba0d5

Browse files
authored
Remove redundant suffix for Aggregate enum (#686)
<!-- The PR description should answer 2 (maybe 3) important questions: --> ### What <!-- What is this PR trying to accomplish (and why, if it's not obvious)? --> Tiny PR to remove a redundant enum variant suffix, as prep for upcoming v0.2 PR <!-- Consider: do we need to add a changelog entry? --> ### How <!-- How is it trying to accomplish it (what are the implementation steps)? -->
1 parent 4160af1 commit 02ba0d5

File tree

1 file changed

+6
-11
lines changed
  • crates/query-engine/translation/src/translation/query

1 file changed

+6
-11
lines changed

crates/query-engine/translation/src/translation/query/sorting.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ struct Column(models::FieldName);
9797
/// An aggregate operation to select from a table used in an order by.
9898
#[derive(Debug)]
9999
enum Aggregate {
100-
CountStarAggregate,
101-
SingleColumnAggregate {
100+
CountStar,
101+
SingleColumn {
102102
column: models::FieldName,
103103
function: models::AggregateFunctionName,
104104
},
@@ -167,12 +167,7 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec<OrderByElementGrou
167167
),
168168
models::OrderByTarget::StarCountAggregate { path } => aggregate_element_groups.insert(
169169
hash_path(path),
170-
(
171-
i,
172-
path,
173-
element.order_direction,
174-
Aggregate::CountStarAggregate,
175-
),
170+
(i, path, element.order_direction, Aggregate::CountStar),
176171
),
177172
models::OrderByTarget::SingleColumnAggregate {
178173
path,
@@ -185,7 +180,7 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec<OrderByElementGrou
185180
i,
186181
path,
187182
element.order_direction,
188-
Aggregate::SingleColumnAggregate {
183+
Aggregate::SingleColumn {
189184
column: column.clone(),
190185
function: function.clone(),
191186
},
@@ -694,7 +689,7 @@ fn translate_targets(
694689
.iter()
695690
.map(|element| {
696691
match &element.element {
697-
Aggregate::CountStarAggregate => {
692+
Aggregate::CountStar => {
698693
let column_alias = sql::helpers::make_column_alias("count".to_string());
699694
Ok(OrderBySelectExpression {
700695
index: element.index,
@@ -706,7 +701,7 @@ fn translate_targets(
706701
aggregate: Some(sql::ast::Function::Unknown("COUNT".to_string())),
707702
})
708703
}
709-
Aggregate::SingleColumnAggregate { column, function } => {
704+
Aggregate::SingleColumn { column, function } => {
710705
let selected_column = target_collection.lookup_column(column)?;
711706
// we are going to deliberately use the table column name and not an alias we get from
712707
// the query request because this is internal to the sorting mechanism.

0 commit comments

Comments
 (0)