Skip to content

Commit 5034e21

Browse files
committed
fix(tesseract): fix wrong default alias for symbols with digits in name
1 parent 0e95f18 commit 5034e21

File tree

2 files changed

+24
-1
lines changed
  • packages/cubejs-schema-compiler/test/integration/postgres
  • rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates

2 files changed

+24
-1
lines changed

packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ describe('SQL Generation', () => {
4545
type: 'sum',
4646
sql: 'amount',
4747
},
48+
revenue_1d_d1_dd: {
49+
type: 'sum',
50+
sql: 'amount',
51+
},
4852
visitor_revenue: {
4953
type: 'sum',
5054
sql: 'amount',
@@ -3265,6 +3269,25 @@ SELECT 1 AS revenue, cast('2024-01-01' AS timestamp) as time UNION ALL
32653269
}]
32663270
));
32673271

3272+
it('aliases for columns with digits and underscores', async () => runQueryTest(
3273+
{
3274+
measures: ['visitors.revenue_1d_d1_dd'],
3275+
},
3276+
[{
3277+
visitors__revenue_1d_d1_dd: '2000',
3278+
}]
3279+
));
3280+
3281+
it('multiplied sum no dimensions through view', async () => runQueryTest(
3282+
{
3283+
measures: ['visitors_visitors_checkins_view.revenue', 'visitors_visitors_checkins_view.id_sum'],
3284+
},
3285+
[{
3286+
visitors_visitors_checkins_view__revenue: '2000',
3287+
visitors_visitors_checkins_view__id_sum: '21'
3288+
}]
3289+
));
3290+
32683291
// Subquery aggregation for multiplied measure (and any `keysSelect` for that matter)
32693292
// should pick up all dimensions, even through member expressions
32703293
it('multiplied sum with dimension member expressions', async () => runQueryTest(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl PlanSqlTemplates {
3333
.with_boundaries(&[
3434
UNDERSCORE_UPPER_BOUND,
3535
Boundary::LOWER_UPPER,
36-
Boundary::DIGIT_LOWER,
36+
Boundary::DIGIT_UPPER,
3737
Boundary::ACRONYM,
3838
])
3939
.to_case(Case::Snake)

0 commit comments

Comments
 (0)