Skip to content

Commit a606030

Browse files
committed
dont change __user / __cubejoinfield names in aliasing
1 parent 534c2b1 commit a606030

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,9 @@ export class BaseQuery {
26462646
}
26472647
// TODO: https://github.com/cube-js/cube.js/issues/4019
26482648
// use single underscore for pre-aggregations to avoid fail of pre-aggregation name replace
2649+
if (name === '__user' || name === '__cubejoinfield') {
2650+
return name;
2651+
}
26492652
return inflection.underscore(name).replace(/\./g, isPreAggregationName ? '_' : '__');
26502653
}
26512654

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,10 +925,7 @@ impl CubeScanWrapperNode {
925925

926926
let alias = if can_rename_columns {
927927
let alias = expr_name(&expr, &schema)?;
928-
let mut truncated_alias = non_id_regex
929-
.replace_all(&alias, "_")
930-
.trim_start_matches("_")
931-
.to_lowercase();
928+
let mut truncated_alias = non_id_regex.replace_all(&alias, "_").to_lowercase();
932929
truncated_alias.truncate(16);
933930
let mut alias = truncated_alias.clone();
934931
for i in 1..10000 {

rust/cubesql/cubesql/src/compile/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20497,8 +20497,8 @@ ORDER BY "source"."str0" ASC
2049720497
.wrapped_sql
2049820498
.unwrap()
2049920499
.sql
20500-
.contains("\\\"cube_name\\\":\\\"KibanaSampleDataEcommerce\\\",\\\"alias\\\":\\\"user\\\""),
20501-
r#"SQL contains `\"cube_name\":\"KibanaSampleDataEcommerce\",\"alias\":\"user\"` {}"#,
20500+
.contains("\\\"cube_name\\\":\\\"KibanaSampleDataEcommerce\\\",\\\"alias\\\":\\\"__user\\\""),
20501+
r#"SQL contains `\"cube_name\":\"KibanaSampleDataEcommerce\",\"alias\":\"__user\"` {}"#,
2050220502
logical_plan
2050320503
.find_cube_scan_wrapper()
2050420504
.wrapped_sql

0 commit comments

Comments
 (0)