From 1e37d1f8d62dd35531b3da8f7d253f3969f1ea6f Mon Sep 17 00:00:00 2001 From: waralexrom <108349432+waralexrom@users.noreply.github.com> Date: Wed, 1 Apr 2026 10:45:19 +0200 Subject: [PATCH 1/2] chore(tesseract): MSSQL driver tests (#10588) --- .github/workflows/drivers-tests.yml | 2 + .../src/adapter/MssqlQuery.ts | 37 +- .../fixtures/_schemas.json | 2 +- .../fixtures/mssql.json | 69 + .../__snapshots__/mssql-full.test.ts.snap | 1126 +++++++++++++++-- 5 files changed, 1154 insertions(+), 82 deletions(-) diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 6b67692488e98..e965a05581aac 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -296,6 +296,8 @@ jobs: use_tesseract_sql_planner: true - database: clickhouse use_tesseract_sql_planner: true + - database: mssql + use_tesseract_sql_planner: true fail-fast: false steps: diff --git a/packages/cubejs-schema-compiler/src/adapter/MssqlQuery.ts b/packages/cubejs-schema-compiler/src/adapter/MssqlQuery.ts index 75de415fb55b2..45399322202ce 100644 --- a/packages/cubejs-schema-compiler/src/adapter/MssqlQuery.ts +++ b/packages/cubejs-schema-compiler/src/adapter/MssqlQuery.ts @@ -268,11 +268,15 @@ export class MssqlQuery extends BaseQuery { const templates = super.sqlTemplates(); templates.functions.LEAST = 'LEAST({{ args_concat }})'; templates.functions.GREATEST = 'GREATEST({{ args_concat }})'; + // MSSQL ROUND requires 2 arguments: ROUND(number, length) + templates.functions.ROUND = 'ROUND({{ args_concat }}{% if args | length < 2 %}, 0{% endif %})'; // NOTE: MSSQL does not support DISTINCT clause. No workaround is available delete templates.functions.STRING_AGG; // PERCENTILE_CONT works but requires PARTITION BY delete templates.functions.PERCENTILECONT; delete templates.expressions.ilike; + // MSSQL uses + for string concatenation instead of || + templates.expressions.concat_strings = '{{ strings | join(\' + \' ) }}'; // NOTE: this template contains a comma; two order expressions are being generated templates.expressions.sort = '{{ expr }} IS NULL {% if nulls_first %}DESC{% else %}ASC{% endif %}, {{ expr }} {% if asc %}ASC{% else %}DESC{% endif %}'; templates.types.string = 'VARCHAR'; @@ -298,11 +302,37 @@ export class MssqlQuery extends BaseQuery { '{% if not loop.last %}, {% endif %}' + '{% endfor %}' + ') AS dates (date_from, date_to)'; + // MSSQL uses recursive CTE for time series generation. + // The template body becomes content of `time_series AS (...)` CTE, + // so it self-references `time_series` for recursion. + templates.statements.generated_time_series_select = + 'SELECT CAST({{ start }} AS DATETIME2) AS date_from,\n' + + ' DATEADD(MILLISECOND, -1, DATEADD({{ minimal_time_unit }}, 1, CAST({{ start }} AS DATETIME2))) AS date_to\n' + + 'UNION ALL\n' + + 'SELECT DATEADD({{ minimal_time_unit }}, 1, date_from),\n' + + ' DATEADD(MILLISECOND, -1, DATEADD({{ minimal_time_unit }}, 1, DATEADD({{ minimal_time_unit }}, 1, date_from)))\n' + + 'FROM time_series\n' + + 'WHERE DATEADD({{ minimal_time_unit }}, 1, date_from) <= CAST({{ end }} AS DATETIME2)'; + + templates.statements.generated_time_series_with_cte_range_source = + 'SELECT {{ range_source }}.{{ min_name }} AS date_from,\n' + + ' DATEADD(MILLISECOND, -1, DATEADD({{ minimal_time_unit }}, 1, {{ range_source }}.{{ min_name }})) AS date_to,\n' + + ' {{ range_source }}.{{ max_name }} AS max_date\n' + + 'FROM {{ range_source }}\n' + + 'UNION ALL\n' + + 'SELECT DATEADD({{ minimal_time_unit }}, 1, date_from),\n' + + ' DATEADD(MILLISECOND, -1, DATEADD({{ minimal_time_unit }}, 1, DATEADD({{ minimal_time_unit }}, 1, date_from))),\n' + + ' max_date\n' + + 'FROM time_series\n' + + 'WHERE DATEADD({{ minimal_time_unit }}, 1, date_from) <= max_date'; + // MSSQL uses OFFSET/FETCH instead of LIMIT/OFFSET + templates.tesseract.ilike = 'LOWER({{ expr }}) {% if negated %}NOT {% endif %}LIKE LOWER({{ pattern }})'; + templates.filters.like_pattern = 'CONCAT({% if start_wild %}\'%\'{% else %}\'\'{% endif %}, LOWER({{ value }}), {% if end_wild %}\'%\'{% else %}\'\'{% endif %})'; templates.statements.select = '{% if ctes %} WITH \n' + '{{ ctes | join(\',\n\') }}\n' + '{% endif %}' + - 'SELECT {% if distinct %}DISTINCT {% endif %}' + + 'SELECT {% if limit is not none and not order_by %}TOP {{ limit }} {% endif %}{% if distinct %}DISTINCT {% endif %}' + '{{ select_concat | map(attribute=\'aliased\') | join(\', \') }} {% if from %}\n' + 'FROM (\n' + '{{ from | indent(2, true) }}\n' + @@ -312,8 +342,9 @@ export class MssqlQuery extends BaseQuery { '{% if filter %}\nWHERE {{ filter }}{% endif %}' + '{% if group_by %}\nGROUP BY {{ group_by }}{% endif %}' + '{% if having %}\nHAVING {{ having }}{% endif %}' + - '{% if order_by %}\nORDER BY {{ order_by | map(attribute=\'expr\') | join(\', \') }}\nOFFSET {% if offset is not none %}{{ offset }}{% else %}0{% endif %} ROWS{% endif %}' + - '{% if limit is not none %}\nFETCH NEXT {{ limit }} ROWS ONLY{% endif %}'; + '{% if order_by %}\nORDER BY {{ order_by | map(attribute=\'expr\') | join(\', \') }}\nOFFSET {% if offset is not none %}{{ offset }}{% else %}0{% endif %} ROWS' + + '\nFETCH NEXT {% if limit is not none %}{{ limit }}{% else %}2147483647{% endif %} ROWS ONLY{% endif %}' + + '{% if ctes %}\nOPTION (MAXRECURSION 0){% endif %}'; return templates; } } diff --git a/packages/cubejs-testing-drivers/fixtures/_schemas.json b/packages/cubejs-testing-drivers/fixtures/_schemas.json index 051b644b6b322..4a149924d112b 100644 --- a/packages/cubejs-testing-drivers/fixtures/_schemas.json +++ b/packages/cubejs-testing-drivers/fixtures/_schemas.json @@ -441,7 +441,7 @@ { "name": "percentageOfTotalForStatus", "type": "number", - "sql": "ROUND(100 * {totalProfit} / NULLIF({totalProfitForStatus}, 0))", + "sql": "ROUND(100 * {totalProfit} / NULLIF({totalProfitForStatus}, 0), 0)", "multi_stage": true }, { diff --git a/packages/cubejs-testing-drivers/fixtures/mssql.json b/packages/cubejs-testing-drivers/fixtures/mssql.json index 5b233fb5ace72..ace65c8dc3910 100644 --- a/packages/cubejs-testing-drivers/fixtures/mssql.json +++ b/packages/cubejs-testing-drivers/fixtures/mssql.json @@ -183,5 +183,74 @@ "---------------------------------------", "SQL API: Rolling Window YTD (year + month + day + date_trunc equal)", "SQL API: Rolling Window YTD (year + month + day + date_trunc IN)" + ], + "tesseractSkip": [ + "---------------------------------------", + "SKIPPED FOR MS SQL (total not supported)", + "---------------------------------------", + "querying Customers: dimensions + total", + "querying Customers: dimensions + order + limit + total", + "querying Customers: dimensions + order + total + offset", + "querying Customers: dimensions + order + limit + total + offset", + "querying Products: dimensions + order + total", + "querying Products: dimensions + order + limit + total", + "querying ECommerce: dimensions + total", + "querying ECommerce: dimensions + order + limit + total", + "querying ECommerce: dimensions + order + total + offset", + "querying ECommerce: dimensions + order + limit + total + offset", + + "---------------------------------------", + "SKIPPED FOR ALL ", + "---------------------------------------", + "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 BigECommerce: null sum", + "querying BigECommerce: null boolean", + "---------------------------------------", + "SKIPPED SQL API (Need work)", + "---------------------------------------", + "SQL API: reuse params", + "SQL API: post-aggregate percentage of total", + "SQL API: powerbi min max ungrouped flag", + "SQL API: powerbi min max push down", + "SQL API: Simple Rollup", + "SQL API: Complex Rollup", + "SQL API: Nested Rollup", + "SQL API: Rollup with aliases", + "SQL API: Rollup over exprs", + "SQL API: Nested Rollup with aliases", + "SQL API: Nested Rollup over asterisk", + "SQL API: Extended nested Rollup over asterisk", + "SQL API: ungrouped pre-agg", + "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", + + "---------------------------------------", + "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)", + "---------------------------------------", + "Switch dimensions", + "---------------------------------------", + "querying SwitchSourceTest: simple cross join", + "querying SwitchSourceTest: full cross join", + "querying SwitchSourceTest: filter by switch dimensions", + + "-------", + "querying BigECommerce: rolling window YTD (month + week)", + "querying BigECommerce: rolling window YTD (month + week + no gran)", + "querying BigECommerce: rolling window YTD without granularity", + "querying BigECommerce with Retail Calendar: totalCountRetailMonthAgo", + "querying BigECommerce with Retail Calendar: totalCountRetailWeekAgo", + "SQL API: Timeshift measure from cube", + "querying BigECommerce: rolling window YTD (month + week + day + no gran)", + "SQL API: Timeshift measure from cube", + "querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading without date range", + "querying BigECommerce: rolling window YTD (month + week + day)" ] } diff --git a/packages/cubejs-testing-drivers/test/__snapshots__/mssql-full.test.ts.snap b/packages/cubejs-testing-drivers/test/__snapshots__/mssql-full.test.ts.snap index 94e743162c16e..5efb39414137c 100644 --- a/packages/cubejs-testing-drivers/test/__snapshots__/mssql-full.test.ts.snap +++ b/packages/cubejs-testing-drivers/test/__snapshots__/mssql-full.test.ts.snap @@ -53,6 +53,334 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/mssql-driver Tesseract: SQL API: Timeshift measure from cube 1`] = ` +Array [ + Object { + "orderDate": 2020-01-01T00:00:00.000Z, + "totalQuantity": 6, + "totalQuantityPriorMonth": null, + }, + Object { + "orderDate": 2020-02-01T00:00:00.000Z, + "totalQuantity": 2, + "totalQuantityPriorMonth": 6, + }, + Object { + "orderDate": 2020-03-01T00:00:00.000Z, + "totalQuantity": 13, + "totalQuantityPriorMonth": 2, + }, + Object { + "orderDate": 2020-04-01T00:00:00.000Z, + "totalQuantity": 3, + "totalQuantityPriorMonth": 13, + }, + Object { + "orderDate": 2020-05-01T00:00:00.000Z, + "totalQuantity": 15, + "totalQuantityPriorMonth": 3, + }, + Object { + "orderDate": 2020-06-01T00:00:00.000Z, + "totalQuantity": 18, + "totalQuantityPriorMonth": 15, + }, + Object { + "orderDate": 2020-07-01T00:00:00.000Z, + "totalQuantity": null, + "totalQuantityPriorMonth": 18, + }, + Object { + "orderDate": 2020-09-01T00:00:00.000Z, + "totalQuantity": 27, + "totalQuantityPriorMonth": null, + }, + Object { + "orderDate": 2020-10-01T00:00:00.000Z, + "totalQuantity": 11, + "totalQuantityPriorMonth": 27, + }, + Object { + "orderDate": 2020-11-01T00:00:00.000Z, + "totalQuantity": 43, + "totalQuantityPriorMonth": 11, + }, + Object { + "orderDate": 2020-12-01T00:00:00.000Z, + "totalQuantity": 22, + "totalQuantityPriorMonth": 43, + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver Tesseract: querying BigECommerce with Retail Calendar: totalCountRetailMonthAgo 1`] = ` +Array [ + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-02-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-02-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-03-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-03-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailMonthAgo": "20000", + "RetailCalendar.retail_date": "2020-04-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-04-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "50000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-05-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-05-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "70000", + "BigECommerce.totalCountRetailMonthAgo": "50000", + "RetailCalendar.retail_date": "2020-06-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-06-01T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailMonthAgo": "70000", + "RetailCalendar.retail_date": "2020-07-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-07-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "60000", + "BigECommerce.totalCountRetailMonthAgo": null, + "RetailCalendar.retail_date": "2020-09-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-09-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "40000", + "BigECommerce.totalCountRetailMonthAgo": "60000", + "RetailCalendar.retail_date": "2020-10-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-10-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "90000", + "BigECommerce.totalCountRetailMonthAgo": "50000", + "RetailCalendar.retail_date": "2020-11-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-11-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "70000", + "BigECommerce.totalCountRetailMonthAgo": "80000", + "RetailCalendar.retail_date": "2020-12-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-12-01T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailMonthAgo": "70000", + "RetailCalendar.retail_date": "2021-01-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2021-01-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver Tesseract: querying BigECommerce with Retail Calendar: totalCountRetailWeekAgo 1`] = ` +Array [ + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-02-16T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-02-16T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-02-23T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-02-23T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-03-15T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-15T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-03-22T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-22T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-03-29T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-29T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-04-05T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-04-05T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-04-12T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-04-12T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-05-10T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-10T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-05-17T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-17T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-05-24T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-24T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-05-31T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-31T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-06-07T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-07T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-14T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-14T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-21T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-21T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-28T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-28T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-08-30T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-08-30T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-09-06T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-06T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-09-13T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-13T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-09-20T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-20T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-09-27T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-27T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-10-11T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-11T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-10-18T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-18T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-10-25T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-25T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-11-01T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-11-08T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-08T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-11-15T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-15T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-11-22T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-22T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-11-29T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-29T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-12-06T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-06T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-12-13T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-13T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-12-20T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-20T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-12-27T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-27T00:00:00.000", + }, +] +`; + exports[`Queries with the @cubejs-backend/mssql-driver filtering Customers: contains + dimensions, first 1`] = ` Array [ Object { @@ -2336,122 +2664,569 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: filtering with possible casts 1`] = ` +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce with Retail Calendar: totalCountRetailMonthAgo 1`] = ` Array [ Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.totalSales": "488960", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-02-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-02-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", - "BigECommerce.totalSales": "2328800", + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-03-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-03-01T00:00:00.000", }, -] -`; - -exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: partitioned pre-agg 1`] = ` -Array [ Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.productName": "Balt Solid Wood Rectangular Table", - "BigECommerce.totalQuantity": "20000", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailMonthAgo": "20000", + "RetailCalendar.retail_date": "2020-04-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-04-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", - "BigECommerce.totalQuantity": "40000", + "BigECommerce.count": "50000", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "RetailCalendar.retail_date": "2020-05-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-05-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-02-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", - "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", - "BigECommerce.totalQuantity": "20000", + "BigECommerce.count": "70000", + "BigECommerce.totalCountRetailMonthAgo": "50000", + "RetailCalendar.retail_date": "2020-06-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-06-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", - "BigECommerce.productName": "Canon PC1080F Personal Copier", - "BigECommerce.totalQuantity": "50000", + "BigECommerce.count": null, + "BigECommerce.totalCountRetailMonthAgo": "70000", + "RetailCalendar.retail_date": "2020-07-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-07-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", - "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", - "BigECommerce.totalQuantity": "80000", + "BigECommerce.count": "60000", + "BigECommerce.totalCountRetailMonthAgo": null, + "RetailCalendar.retail_date": "2020-09-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-09-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-04-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", - "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", - "BigECommerce.totalQuantity": "30000", + "BigECommerce.count": "40000", + "BigECommerce.totalCountRetailMonthAgo": "60000", + "RetailCalendar.retail_date": "2020-10-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-10-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.productName": "Google Nexus 6", - "BigECommerce.totalQuantity": "30000", + "BigECommerce.count": "90000", + "BigECommerce.totalCountRetailMonthAgo": "50000", + "RetailCalendar.retail_date": "2020-11-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-11-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.productName": "Google Nexus 7", - "BigECommerce.totalQuantity": "30000", + "BigECommerce.count": "70000", + "BigECommerce.totalCountRetailMonthAgo": "80000", + "RetailCalendar.retail_date": "2020-12-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-12-01T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", - "BigECommerce.totalQuantity": "20000", + "BigECommerce.count": null, + "BigECommerce.totalCountRetailMonthAgo": "70000", + "RetailCalendar.retail_date": "2021-01-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2021-01-01T00:00:00.000", }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce with Retail Calendar: totalCountRetailWeekAgo 1`] = ` +Array [ Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", - "BigECommerce.totalQuantity": "50000", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-02-16T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-02-16T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", - "BigECommerce.totalQuantity": "20000", + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-02-23T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-02-23T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.productName": "DMI Eclipse Executive Suite Bookcases", - "BigECommerce.totalQuantity": "10000", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-03-15T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-15T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.productName": "HTC One", - "BigECommerce.totalQuantity": "30000", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-03-22T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-22T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", - "BigECommerce.totalQuantity": "50000", + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-03-29T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-03-29T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", - "BigECommerce.totalQuantity": "20000", + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-04-05T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-04-05T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", - "BigECommerce.totalQuantity": "60000", + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-04-12T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-04-12T00:00:00.000", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-05-10T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-10T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-05-17T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-17T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-05-24T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-24T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-05-31T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-05-31T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-06-07T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-07T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-14T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-14T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-21T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-21T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-06-28T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-06-28T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-08-30T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-08-30T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-09-06T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-06T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-09-13T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-13T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-09-20T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-20T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-09-27T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-09-27T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-10-11T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-11T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-10-18T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-18T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-10-25T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-10-25T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-11-01T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-11-08T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-08T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-11-15T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-15T00:00:00.000", + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-11-22T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-22T00:00:00.000", + }, + Object { + "BigECommerce.count": "30000", + "BigECommerce.totalCountRetailWeekAgo": "10000", + "RetailCalendar.retail_date": "2020-11-29T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-11-29T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "30000", + "RetailCalendar.retail_date": "2020-12-06T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-06T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": null, + "RetailCalendar.retail_date": "2020-12-13T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-13T00:00:00.000", + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-12-20T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-20T00:00:00.000", + }, + Object { + "BigECommerce.count": null, + "BigECommerce.totalCountRetailWeekAgo": "20000", + "RetailCalendar.retail_date": "2020-12-27T00:00:00.000", + "RetailCalendar.retail_date.week": "2020-12-27T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce with Retail Calendar: totalCountRetailYearAgo 1`] = ` +Array [ + Object { + "BigECommerce.count": "420000", + "BigECommerce.totalCountRetailYearAgo": "20000", + "RetailCalendar.retail_date": "2020-02-02T00:00:00.000", + "RetailCalendar.retail_date.year": "2020-02-02T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: SeveralMultiStageMeasures 1`] = ` +Array [ + Object { + "BigECommerce.count": "20000", + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": null, + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "20000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "20000", + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "10000", + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "20000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "50000", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "10000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "70000", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "50000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": null, + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": null, + "BigECommerce.totalCountRetailMonthAgo": "70000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "60000", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": null, + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "40000", + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "60000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "90000", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "40000", + "BigECommerce.totalProfitYearAgo": null, + }, + Object { + "BigECommerce.count": "70000", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.percentageOfTotalForStatus": "100", + "BigECommerce.totalCountRetailMonthAgo": "90000", + "BigECommerce.totalProfitYearAgo": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: filtering with possible casts 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.totalSales": "488960", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.totalSales": "2328800", + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: multi-stage group by time dimension 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-01-01T00:00:00.000", + "BigECommerce.totalProfit": "296548", + "BigECommerce.totalProfitForQuarter": "6194485", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-01-01T00:00:00.000", + "BigECommerce.totalProfit": "61992", + "BigECommerce.totalProfitForQuarter": "6194485", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-01-01T00:00:00.000", + "BigECommerce.totalProfit": "5835945", + "BigECommerce.totalProfitForQuarter": "6194485", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-04-01T00:00:00.000", + "BigECommerce.totalProfit": "64176", + "BigECommerce.totalProfitForQuarter": "3943386", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-04-01T00:00:00.000", + "BigECommerce.totalProfit": "3536849", + "BigECommerce.totalProfitForQuarter": "3943386", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-04-01T00:00:00.000", + "BigECommerce.totalProfit": "342361", + "BigECommerce.totalProfitForQuarter": "3943386", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-07-01T00:00:00.000", + "BigECommerce.totalProfit": "4611332", + "BigECommerce.totalProfitForQuarter": "4611332", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-10-01T00:00:00.000", + "BigECommerce.totalProfit": "1399970", + "BigECommerce.totalProfitForQuarter": "15766324", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-10-01T00:00:00.000", + "BigECommerce.totalProfit": "11326617", + "BigECommerce.totalProfitForQuarter": "15766324", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.quarter": "2020-10-01T00:00:00.000", + "BigECommerce.totalProfit": "3039737", + "BigECommerce.totalProfitForQuarter": "15766324", + }, +] +`; + +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: partitioned pre-agg 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.productName": "Balt Solid Wood Rectangular Table", + "BigECommerce.totalQuantity": "20000", + }, + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "40000", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "BigECommerce.totalQuantity": "20000", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.productName": "Canon PC1080F Personal Copier", + "BigECommerce.totalQuantity": "50000", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "BigECommerce.totalQuantity": "80000", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.productName": "Google Nexus 6", + "BigECommerce.totalQuantity": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.productName": "Google Nexus 7", + "BigECommerce.totalQuantity": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", + "BigECommerce.totalQuantity": "20000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "BigECommerce.totalQuantity": "50000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "BigECommerce.totalQuantity": "20000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "BigECommerce.totalQuantity": "10000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.productName": "HTC One", + "BigECommerce.totalQuantity": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "BigECommerce.totalQuantity": "50000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", + "BigECommerce.totalQuantity": "20000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "BigECommerce.totalQuantity": "60000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "Project Tote Personal File", "BigECommerce.totalQuantity": "10000", }, @@ -3962,6 +4737,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window YTD without date range 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "50000", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "60000", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "110000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "180000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "180000", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "180000", + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "240000", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "280000", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "370000", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "440000", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "440000", + }, +] +`; + exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window YTD without granularity 1`] = ` Array [ Object { @@ -4035,6 +4875,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window by 2 day without date range 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": "10000", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": "10000", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, +] +`; + exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window by 2 month 1`] = ` Array [ Object { @@ -4100,6 +5005,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window by 2 month without date range 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "30000", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "60000", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "120000", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "70000", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "60000", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "100000", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "130000", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "160000", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "70000", + }, +] +`; + exports[`Queries with the @cubejs-backend/mssql-driver querying BigECommerce: rolling window by 2 week 1`] = ` Array [ Object { From 6408fde429ea872b3edf547b18adc79e640eda49 Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Wed, 1 Apr 2026 11:00:29 +0200 Subject: [PATCH 2/2] docs: upgrade now button in maintenance window (#10596) --- .../workspace/maintenance-window.mdx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/content/product/administration/workspace/maintenance-window.mdx b/docs/content/product/administration/workspace/maintenance-window.mdx index 6a739dbcd0141..3649442621fa9 100644 --- a/docs/content/product/administration/workspace/maintenance-window.mdx +++ b/docs/content/product/administration/workspace/maintenance-window.mdx @@ -53,7 +53,7 @@ snapshot during the window. Navigate to Admin → Settings → Maintenance Window in the Cube Cloud console. - + 1. Toggle **Enable Scheduled Maintenance Window** to on. 2. Select the **Day of week** (e.g., Sunday). @@ -95,6 +95,27 @@ revert to an older version, contact support. +## Upgrade now + +If a critical fix has been released and you don't want to wait for the +next scheduled maintenance window, you can apply the latest eligible +snapshot immediately. + +When the maintenance window is enabled, an **Upgrade Now** section +appears at the bottom of the settings page. Click **Upgrade Now** to +advance to the latest eligible snapshot right away. + +The button is disabled while the upgrade is in progress. Once complete, +the new version will appear in the **Active Version** dropdown. + + + +The same eligibility rules apply — only snapshots that are at least +24 hours old are considered. If you are already on the latest eligible +snapshot, the button will return an error. + + + ## FAQ ### What happens if I disable the maintenance window? @@ -122,4 +143,10 @@ Yes. When the maintenance window is enabled, the settings page shows an Select any of them to switch back. See [Active version](#active-version) above for details. +### Can I trigger an immediate upgrade without waiting for the window? + +Yes. Use the **Upgrade Now** button on the settings page to apply the +latest eligible snapshot immediately. See [Upgrade now](#upgrade-now) +above for details. + [ref-dedicated]: /product/deployment/cloud/deployment-types#production-cluster