diff --git a/packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts b/packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts index e11b7f01b3af3..cf6312b48c188 100644 --- a/packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts +++ b/packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts @@ -45,6 +45,10 @@ describe('SQL Generation', () => { type: 'sum', sql: 'amount', }, + revenue_1d_d1_dd: { + type: 'sum', + sql: 'amount', + }, visitor_revenue: { type: 'sum', sql: 'amount', @@ -3265,6 +3269,15 @@ SELECT 1 AS revenue, cast('2024-01-01' AS timestamp) as time UNION ALL }] )); + it('aliases for columns with digits and underscores', async () => runQueryTest( + { + measures: ['visitors.revenue_1d_d1_dd'], + }, + [{ + visitors__revenue_1d_d1_dd: '2000', + }] + )); + // Subquery aggregation for multiplied measure (and any `keysSelect` for that matter) // should pick up all dimensions, even through member expressions it('multiplied sum with dimension member expressions', async () => runQueryTest( diff --git a/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates/plan.rs b/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates/plan.rs index edd4e4d927b16..7ef0e6e1f6001 100644 --- a/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates/plan.rs +++ b/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_templates/plan.rs @@ -33,7 +33,7 @@ impl PlanSqlTemplates { .with_boundaries(&[ UNDERSCORE_UPPER_BOUND, Boundary::LOWER_UPPER, - Boundary::DIGIT_LOWER, + Boundary::DIGIT_UPPER, Boundary::ACRONYM, ]) .to_case(Case::Snake)