Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust-cubestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- os: windows-2019
- os: windows-2022
target: x86_64-pc-windows-msvc
executable_name: cubestored.exe
strip: true
Expand Down
25 changes: 1 addition & 24 deletions packages/cubejs-schema-compiler/src/adapter/BigqueryQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ export class BigqueryQuery extends BaseQuery {
return new BigqueryFilter(this, filter);
}

public dateSeriesSql(timeDimension: BaseTimeDimension) {
return `${timeDimension.dateSeriesAliasName()} AS (${this.seriesSql(timeDimension)})`;
}

public seriesSql(timeDimension: BaseTimeDimension) {
const values = timeDimension.timeSeries().map(
([from, to]) => `select '${from}' f, '${to}' t`
Expand All @@ -161,26 +157,6 @@ export class BigqueryQuery extends BaseQuery {
return 6;
}

public overTimeSeriesSelect(cumulativeMeasures, dateSeriesSql, baseQuery, dateJoinConditionSql, baseQueryAlias) {
const forSelect = this.overTimeSeriesForSelect(cumulativeMeasures);
const outerSeriesAlias = this.cubeAlias('outer_series');
const outerBase = this.cubeAlias('outer_base');
const timeDimensionAlias = this.timeDimensions.map(d => d.aliasName()).filter(d => !!d)[0];
const aliasesForSelect = this.timeDimensions.map(d => d.dateSeriesSelectColumn(outerSeriesAlias)).concat(
this.dimensions.concat(cumulativeMeasures).map(s => s.aliasName())
).filter(c => !!c).join(', ');
const dateSeriesAlias = this.timeDimensions.map(d => `${d.dateSeriesAliasName()}`).filter(c => !!c)[0];
return `
WITH ${dateSeriesSql} SELECT ${aliasesForSelect} FROM
${dateSeriesAlias} ${outerSeriesAlias}
LEFT JOIN (
SELECT ${forSelect} FROM ${dateSeriesAlias}
INNER JOIN (${baseQuery}) AS ${baseQueryAlias} ON ${dateJoinConditionSql}
${this.groupByClause()}
) AS ${outerBase} ON ${outerSeriesAlias}.${this.escapeColumnName('date_from')} = ${outerBase}.${timeDimensionAlias}
`;
}

public subtractInterval(date, interval) {
const [intervalFormatted, timeUnit] = this.formatInterval(interval);
if (['YEAR', 'MONTH', 'QUARTER'].includes(timeUnit) || intervalFormatted.includes('WEEK')) {
Expand Down Expand Up @@ -346,6 +322,7 @@ export class BigqueryQuery extends BaseQuery {
// DATEADD is being rewritten to DATE_ADD
templates.functions.DATE_ADD = 'DATETIME_ADD(DATETIME({{ args[0] }}), INTERVAL {{ interval }} {{ date_part }})';
templates.functions.CURRENTDATE = 'CURRENT_DATE';
templates.functions.DATE = 'TIMESTAMP({{ args_concat }})';
delete templates.functions.TO_CHAR;
delete templates.functions.PERCENTILECONT;
templates.expressions.binary = '{% if op == \'%\' %}MOD({{ left }}, {{ right }}){% else %}({{ left }} {{ op }} {{ right }}){% endif %}';
Expand Down
10 changes: 7 additions & 3 deletions packages/cubejs-testing-drivers/fixtures/athena.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",
"--------------------",

"--------------------",
"week granularity is not supported for intervals",
"--------------------",
"querying BigECommerce: rolling window by 2 week",
Expand Down Expand Up @@ -209,6 +208,11 @@
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk",
"SQL API: Timeshift measure from cube",
"SQL API: SQL push down push to cube quoted alias"
"SQL API: SQL push down push to cube quoted alias",
"querying BigECommerce: rolling window YTD (month + week)",
"querying BigECommerce: rolling window YTD (month + week + no gran)",
"querying BigECommerce: rolling window YTD without granularity",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
16 changes: 9 additions & 7 deletions packages/cubejs-testing-drivers/fixtures/bigquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD without date range",
"--------------------",

"---------------------------------------",
"SKIPPED SQL API (Need work)",
"---------------------------------------",
"SQL API: reuse params",
Expand Down Expand Up @@ -198,14 +198,9 @@
"SQL API: Rollup with aliases",
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk",
"querying Products: dimensions -- doesn't work wo ordering",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension",
"querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension",
"pre-aggregations Customers: running total without time dimension",
"querying BigECommerce: null boolean",
"querying BigECommerce: rolling count_distinct_approx window by 2 day",
"querying BigECommerce: rolling count_distinct_approx window by 2 week",
"querying BigECommerce: rolling count_distinct_approx window by 2 month",
Expand All @@ -216,6 +211,13 @@
"SQL API: Nested Rollup",
"SQL API: Nested Rollup with aliases",
"SQL API: Timeshift measure from cube",
"SQL API: SQL push down push to cube quoted alias"

"---- Different results comparing to baseQuery version. Need to investigate ----",
"SQL API: SQL push down push to cube quoted alias",
"querying BigECommerce: rolling window YTD (month + week)",
"querying BigECommerce: rolling window YTD (month + week + no gran)",
"querying BigECommerce: rolling window YTD without granularity",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
18 changes: 14 additions & 4 deletions packages/cubejs-testing-drivers/fixtures/clickhouse.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,25 @@
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum",
"querying BigECommerce: null boolean",

"---------------------------------------",
"Unsupported JOIN ON conditions. Unexpected 'big_e_commerce__order_date_month > subtractWeeks(date_to, 2)'",
"--------------------",
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day",
"querying BigECommerce: rolling window by 2 week",
"querying BigECommerce: rolling window by 2 month",
"querying BigECommerce: rolling window YTD (month)",
"querying BigECommerce: rolling window YTD (month + week)",
"querying BigECommerce: rolling window YTD (month + week + no gran)",
"querying BigECommerce: rolling window YTD (month + week + day)",
"querying BigECommerce: rolling window YTD (month + week + day + no gran)",

"---------------------------------------",
"Requires Tesseract. ",
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",
"--------------------",

"---------------------------------------",
"Custom Granularities ",
Expand All @@ -210,6 +215,11 @@
"SQL API: Rollup over exprs",
"SQL API: Rollup with aliases",
"SQL API: Simple Rollup",
"SQL API: SQL push down push to cube quoted alias"
"SQL API: SQL push down push to cube quoted alias",

"SKIPPED SQL API (due to inconsistency)",
"---------------------------------------",
"Below doesn't work probably due to strict type comparison in ClickHouse, but tests run across all DBs",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",
"--------------------",

"---------------------------------------",
"Custom Granularities ",
Expand Down
11 changes: 8 additions & 3 deletions packages/cubejs-testing-drivers/fixtures/mssql.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",
"--------------------",

"---------------------------------------",
"SKIPPED SQL API (Need work)",
"---------------------------------------",
Expand All @@ -163,6 +162,12 @@
"SQL API: NULLS FIRST/LAST SQL push down",
"SQL API: SQL push down push to cube quoted alias",
"SQL API: Date/time comparison with SQL push down",
"SQL API: Date/time comparison with date_trunc with SQL push down"
"SQL API: Date/time comparison with date_trunc with SQL push down",

"---------------------------------------",
"Error during rewrite: Can't detect Cube query and it may be not supported yet.",
"---------------------------------------",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
10 changes: 8 additions & 2 deletions packages/cubejs-testing-drivers/fixtures/mysql.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum",
"querying BigECommerce: null boolean",

"---------------------------------------",
"Requires Tesseract. ",
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",

"---------------------------------------",
Expand All @@ -158,6 +158,12 @@
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk",
"SQL API: SQL push down push to cube quoted alias",
"SQL API: Date/time comparison with date_trunc with SQL push down"
"SQL API: Date/time comparison with date_trunc with SQL push down",

"---------------------------------------",
"Error during rewrite: Can't detect Cube query and it may be not supported yet.",
"---------------------------------------",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
10 changes: 9 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/postgres.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"querying Products: dimensions -- doesn't work wo ordering",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",

"---------------------------------------",
"Requires Tesseract. ",
"---------------------------------------",
Expand All @@ -181,6 +182,13 @@
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk",
"SQL API: Timeshift measure from cube",
"SQL API: SQL push down push to cube quoted alias"
"SQL API: SQL push down push to cube quoted alias",

"---- Different results comparing to baseQuery version. Need to investigate ----",
"querying BigECommerce: rolling window YTD (month + week)",
"querying BigECommerce: rolling window YTD (month + week + no gran)",
"querying BigECommerce: rolling window YTD without granularity",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
4 changes: 2 additions & 2 deletions packages/cubejs-testing-drivers/fixtures/redshift.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@
"querying Products: dimensions -- doesn't work wo ordering",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",

"---------------------------------------",
"Requires Tesseract. ",
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range",

"---------------------------------------",
"SKIPPED SQL API (Need work) ",
"---------------------------------------",
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-testing-drivers/fixtures/snowflake.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying BigECommerce: null sum",
"querying BigECommerce: null boolean",

"---------------------------------------",
"Requires Tesseract. ",
"---------------------------------------",
"querying BigECommerce: rolling window by 2 day without date range",
"querying BigECommerce: rolling window by 2 month without date range",
"querying BigECommerce: rolling window YTD",
"querying BigECommerce: rolling window YTD without date range"
]
}
1 change: 1 addition & 0 deletions packages/cubejs-testing-drivers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"redshift-core": "yarn test-driver -i dist/test/redshift-core.test.js",
"redshift-full": "yarn test-driver -i dist/test/redshift-full.test.js",
"redshift-export-bucket-s3-full": "yarn test-driver -i dist/test/redshift-export-bucket-s3-full.test.js",
"update-all-snapshots-local": "yarn run athena-export-bucket-s3-full --mode=local -u; yarn run bigquery-export-bucket-gcs-full --mode=local -u; yarn run clickhouse-full --mode=local -u; yarn run clickhouse-export-bucket-s3-full --mode=local -u; yarn run clickhouse-export-bucket-s3-prefix-full --mode=local -u; yarn run databricks-jdbc-export-bucket-azure-full --mode=local -u; yarn run databricks-jdbc-export-bucket-azure-prefix-full --mode=local -u; yarn run databricks-jdbc-export-bucket-gcs-full --mode=local -u; yarn run databricks-jdbc-export-bucket-gcs-prefix-full --mode=local -u; yarn run databricks-jdbc-export-bucket-s3-full --mode=local -u; yarn run databricks-jdbc-export-bucket-s3-prefix-full --mode=local -u; yarn run databricks-jdbc-full --mode=local -u; yarn run mssql-full --mode=local -u; yarn run mysql-full --mode=local -u; yarn run postgres-full --mode=local -u; yarn run redshift-export-bucket-s3-full --mode=local -u; yarn run redshift-full --mode=local -u; yarn run snowflake-encrypted-pk-full --mode=local -u; yarn run snowflake-export-bucket-azure-full --mode=local -u; yarn run snowflake-export-bucket-azure-prefix-full --mode=local -u; yarn run snowflake-export-bucket-azure-via-storage-integration-full --mode=local -u; yarn run snowflake-export-bucket-gcs-full --mode=local -u; yarn run snowflake-export-bucket-gcs-prefix-full --mode=local -u; yarn run snowflake-export-bucket-s3-full --mode=local -u; yarn run snowflake-export-bucket-s3-prefix-full --mode=local -u; yarn run snowflake-export-bucket-azure-prefix-full --mode=local -u; yarn run snowflake-export-bucket-azure-full --mode=local -u; yarn run snowflake-full --mode=local -u",
"tst": "clear && yarn tsc && yarn bigquery-core"
},
"files": [
Expand Down
Loading
Loading