Skip to content

Commit f04bb12

Browse files
committed
#883: Excel download data columns sequence is different from table visualisation
1 parent 6b05460 commit f04bb12

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

data-providers/src/main/java/datart/data/provider/calcite/SqlBuilder.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,6 @@ public String build() throws SqlParseException {
157157
}
158158
}
159159

160-
// aggregators
161-
if (!CollectionUtils.isEmpty(executeParam.getAggregators())) {
162-
for (AggregateOperator aggregator : executeParam.getAggregators()) {
163-
String alias;
164-
if (aggregator.getSqlOperator() == null) {
165-
alias = aggregator.getColumn();
166-
} else {
167-
alias = aggregator.getSqlOperator().name() + "(" + aggregator.getColumn() + ")";
168-
}
169-
columnAlias.put(aggregator.getColumn(), alias);
170-
selectList.add(createAggNode(aggregator.getSqlOperator(), aggregator.getColumn(), alias));
171-
}
172-
}
173-
174160
//group by
175161
if (!CollectionUtils.isEmpty(executeParam.getGroups())) {
176162
for (GroupByOperator group : executeParam.getGroups()) {
@@ -186,6 +172,20 @@ public String build() throws SqlParseException {
186172
}
187173
}
188174

175+
// aggregators
176+
if (!CollectionUtils.isEmpty(executeParam.getAggregators())) {
177+
for (AggregateOperator aggregator : executeParam.getAggregators()) {
178+
String alias;
179+
if (aggregator.getSqlOperator() == null) {
180+
alias = aggregator.getColumn();
181+
} else {
182+
alias = aggregator.getSqlOperator().name() + "(" + aggregator.getColumn() + ")";
183+
}
184+
columnAlias.put(aggregator.getColumn(), alias);
185+
selectList.add(createAggNode(aggregator.getSqlOperator(), aggregator.getColumn(), alias));
186+
}
187+
}
188+
189189
//order
190190
if (!CollectionUtils.isEmpty(executeParam.getOrders())) {
191191
for (OrderOperator order : executeParam.getOrders()) {

0 commit comments

Comments
 (0)