Skip to content

Commit 403f3c4

Browse files
committed
update
1 parent d545900 commit 403f3c4

File tree

6 files changed

+47
-60
lines changed

6 files changed

+47
-60
lines changed

packages/cubejs-backend-native/Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cubejs-schema-compiler/test/integration/postgres/cube-views.test.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -413,23 +413,12 @@ view(\`OrdersView3\`, {
413413
expect(cube.config.measures.filter((({ isVisible }) => isVisible)).length).toBe(0);
414414
});
415415

416-
if (getEnv('nativeSqlPlanner')) {
417-
it('split views', async () => runQueryTest({
418-
measures: ['OrdersView3.count'],
419-
dimensions: ['OrdersView3_ProductCategories.name'],
420-
order: [{ id: 'OrdersView3_ProductCategories.name' }],
421-
}, [{
422-
orders_view3__count: '2',
423-
orders_view3_product_categories__name: 'Groceries',
424-
}]));
425-
} else {
426-
it('split views', async () => runQueryTest({
427-
measures: ['OrdersView3.count'],
428-
dimensions: ['OrdersView3_ProductCategories.name'],
429-
order: [{ id: 'OrdersView3_ProductCategories.name' }],
430-
}, [{
431-
orders_view3__count: '2',
432-
orders_view3__product_categories__name: 'Groceries',
433-
}]));
434-
}
416+
it('split views', async () => runQueryTest({
417+
measures: ['OrdersView3.count'],
418+
dimensions: ['OrdersView3_ProductCategories.name'],
419+
order: [{ id: 'OrdersView3_ProductCategories.name' }],
420+
}, [{
421+
orders_view3__count: '2',
422+
orders_view3__product_categories__name: 'Groceries',
423+
}]));
435424
});

packages/cubejs-schema-compiler/test/integration/postgres/views-join-order.test.ts

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -207,31 +207,16 @@ view(\`Product_Stock\`, {
207207
);
208208
}
209209

210-
if (getEnv('nativeSqlPlanner')) {
211-
it('join order', async () => runQueryTest({
212-
measures: ['Product_Stock.quantity'],
213-
dimensions: [
214-
'Product_Stock.sub_category',
215-
'Product_Stock.brand'
216-
],
217-
order: [{ id: 'Product_Stock.quantity' }]
218-
}, [{
219-
product_stock__sub_category: 'Sub Category',
220-
product_stock__brand: 'Brand',
221-
product_stock__quantity: '10',
222-
}]));
223-
} else {
224-
it('join order', async () => runQueryTest({
225-
measures: ['Product_Stock.quantity'],
226-
dimensions: [
227-
'Product_Stock.sub_category',
228-
'Product_Stock.brand'
229-
],
230-
order: [{ id: 'Product_Stock.quantity' }]
231-
}, [{
232-
product__stock__sub_category: 'Sub Category',
233-
product__stock__brand: 'Brand',
234-
product__stock__quantity: '10',
235-
}]));
236-
}
210+
it('join order', async () => runQueryTest({
211+
measures: ['Product_Stock.quantity'],
212+
dimensions: [
213+
'Product_Stock.sub_category',
214+
'Product_Stock.brand'
215+
],
216+
order: [{ id: 'Product_Stock.quantity' }]
217+
}, [{
218+
product__stock__sub_category: 'Sub Category',
219+
product__stock__brand: 'Brand',
220+
product__stock__quantity: '10',
221+
}]));
237222
});

rust/cubesqlplanner/Cargo.lock

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

rust/cubesqlplanner/cubesqlplanner/src/planner/query_tools.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::plan::FilterItem;
1111
use crate::planner::sql_evaluator::collectors::collect_join_hints;
1212
use crate::planner::sql_templates::PlanSqlTemplates;
1313
use chrono_tz::Tz;
14-
use convert_case::{Boundary, Case, Casing};
1514
use cubenativeutils::CubeError;
1615
use itertools::Itertools;
1716
use lazy_static::lazy_static;
@@ -187,9 +186,7 @@ impl QueryTools {
187186
}
188187

189188
pub fn alias_name(&self, name: &str) -> String {
190-
name.without_boundaries(&[Boundary::LOWER_DIGIT, Boundary::UPPER_DIGIT])
191-
.to_case(Case::Snake)
192-
.replace(".", "__")
189+
PlanSqlTemplates::alias_name(name)
193190
}
194191

195192
pub fn escaped_alias_name(&self, name: &str) -> String {

rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates/plan.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ use std::rc::Rc;
1010
pub struct PlanSqlTemplates {
1111
render: Rc<dyn SqlTemplatesRender>,
1212
}
13+
pub const UNDERSCORE_UPPER_BOUND: Boundary = Boundary {
14+
name: "LowerUpper",
15+
condition: |s, _| {
16+
s.get(0) == Some(&"_")
17+
&& s.get(1)
18+
.map(|c| c.to_uppercase() != c.to_lowercase() && *c == c.to_uppercase())
19+
== Some(true)
20+
},
21+
arg: None,
22+
start: 0,
23+
len: 0,
24+
};
1325

1426
impl PlanSqlTemplates {
1527
pub fn new(render: Rc<dyn SqlTemplatesRender>) -> Self {
@@ -18,8 +30,12 @@ impl PlanSqlTemplates {
1830

1931
pub fn alias_name(name: &str) -> String {
2032
let res = name
21-
.from_case(Case::Camel)
22-
.without_boundaries(&[Boundary::LOWER_DIGIT, Boundary::UPPER_DIGIT])
33+
.with_boundaries(&[
34+
UNDERSCORE_UPPER_BOUND,
35+
Boundary::LOWER_UPPER,
36+
Boundary::DIGIT_LOWER,
37+
Boundary::ACRONYM,
38+
])
2339
.to_case(Case::Snake)
2440
.replace(".", "__");
2541
res

0 commit comments

Comments
 (0)