Skip to content

Commit 62b359f

Browse files
committed
fix(cubesql): Window PARTITION BY, ORDER BY queries fail for SQL push down
1 parent abb07ad commit 62b359f

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ class BaseQuery {
24832483
binary: '({{ left }} {{ op }} {{ right }})',
24842484
sort: '{{ expr }} {% if asc %}ASC{% else %}DESC{% endif %}{% if nulls_first %} NULLS FIRST{% endif %}',
24852485
cast: 'CAST({{ expr }} AS {{ data_type }})',
2486-
window_function: '{{ fun_call }} OVER ({% if partition_by %}PARTITION BY {{ partition_by }}{% if order_by %} {% endif %}{% endif %}{% if order_by %}ORDER BY {{ order_by }}{% endif %})',
2486+
window_function: '{{ fun_call }} OVER ({% if partition_by_concat %}PARTITION BY {{ partition_by_concat }}{% if order_by_concat %} {% endif %}{% endif %}{% if order_by_concat %}ORDER BY {{ order_by_concat }}{% endif %})',
24872487
in_list: '{{ expr }} {% if negated %}NOT {% endif %}IN ({{ in_exprs_concat }})',
24882488
},
24892489
quotes: {

rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,18 +1398,7 @@ impl CubeScanWrapperNode {
13981398
)
13991399
.await?;
14001400
sql_query = query;
1401-
sql_order_by.push(
1402-
sql_generator
1403-
.get_sql_templates()
1404-
// TODO asc/desc
1405-
.sort_expr(sql, true, false)
1406-
.map_err(|e| {
1407-
DataFusionError::Internal(format!(
1408-
"Can't generate SQL for sort expr: {}",
1409-
e
1410-
))
1411-
})?,
1412-
);
1401+
sql_order_by.push(sql);
14131402
}
14141403
let resulting_sql = sql_generator
14151404
.get_sql_templates()

0 commit comments

Comments
 (0)