Skip to content

Commit 1ddf5e7

Browse files
Nikita-strKSDaemon
authored andcommitted
dont change __user / __cubejoinfield names in aliasing
1 parent 3bc4093 commit 1ddf5e7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,9 @@ export class BaseQuery {
34733473
}
34743474
// TODO: https://github.com/cube-js/cube.js/issues/4019
34753475
// use single underscore for pre-aggregations to avoid fail of pre-aggregation name replace
3476+
if (name === '__user' || name === '__cubejoinfield') {
3477+
return name;
3478+
}
34763479
return inflection.underscore(name).replace(/\./g, isPreAggregationName ? '_' : '__');
34773480
}
34783481

rust/cubesql/cubesql/src/compile/test/test_wrapper.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,9 +925,9 @@ async fn test_case_wrapper_with_system_fields() {
925925
.wrapped_sql
926926
.sql
927927
.contains(
928-
"\\\"cubeName\\\":\\\"KibanaSampleDataEcommerce\\\",\\\"alias\\\":\\\"user\\\""
928+
"\\\"cubeName\\\":\\\"KibanaSampleDataEcommerce\\\",\\\"alias\\\":\\\"__user\\\""
929929
),
930-
r#"SQL contains `\"cubeName\":\"KibanaSampleDataEcommerce\",\"alias\":\"user\"` {}"#,
930+
r#"SQL contains `\"cubeName\":\"KibanaSampleDataEcommerce\",\"alias\":\"__user\"` {}"#,
931931
logical_plan.find_cube_scan_wrapped_sql().wrapped_sql.sql
932932
);
933933

0 commit comments

Comments
 (0)