Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit 65a57ac

Browse files
committed
Fix missing order by
1 parent 61dd328 commit 65a57ac

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

dist/module.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59165,6 +59165,10 @@ function () {
5916559165
if (this.target.orderBySort === "2") {
5916659166
orderBy += " DESC";
5916759167
}
59168+
59169+
if (this.hll === undefined) {
59170+
query = query + " " + orderBy;
59171+
}
5916859172
}
5916959173

5917059174
if (this.isWindow) {

dist/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bigquery_query.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ export default class BigQueryQuery {
587587
if (this.target.orderBySort === "2") {
588588
orderBy += " DESC";
589589
}
590+
if (this.hll === undefined) {
591+
query = query + " " + orderBy;
592+
}
590593
}
591594
if (this.isWindow) {
592595
query = "\nSELECT * EXCEPT (" + this.tmpValue + ") From \n (" + query;

src/specs/bigquery_query.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ describe("BigQueryQuery", () => {
218218
where: [],
219219
};
220220
let result =
221-
"#standardSQL\nSELECT\n `t` AS time,\n `value`\nFROM `undefined.undefined.table`\nGROUP BY 1,2";
221+
"#standardSQL\nSELECT\n `t` AS time,\n `value`\nFROM `undefined.undefined.table`\nGROUP BY 1,2 \nORDER BY 1";
222222
const query = new BigQueryQuery(target, templateSrv);
223223

224224
expect(query.buildQuery()).toBe(result);
225225

226226
query.target.metricColumn = "m";
227227
result =
228-
"#standardSQL\nSELECT\n `t` AS time,\n CAST (`m`AS String ) AS metric,\n `value`\nFROM `undefined.undefined.table`\nGROUP BY 1,2,3";
228+
"#standardSQL\nSELECT\n `t` AS time,\n CAST (`m`AS String ) AS metric,\n `value`\nFROM `undefined.undefined.table`\nGROUP BY 1,2,3 \nORDER BY 1,2";
229229
expect(query.buildQuery()).toBe(result);
230230
});
231231

0 commit comments

Comments
 (0)