diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 263a61fbc8045..7f16a79527882 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -273,6 +273,8 @@ jobs: use_tesseract_sql_planner: true - database: athena-export-bucket-s3 use_tesseract_sql_planner: true + - database: databricks-jdbc + use_tesseract_sql_planner: true fail-fast: false steps: diff --git a/packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts b/packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts index b0da4374d9e2c..ac08b4328d099 100644 --- a/packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts +++ b/packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts @@ -161,6 +161,10 @@ export class DatabricksQuery extends BaseQuery { return 120; } + public supportGeneratedSeriesForCustomTd() { + return true; + } + public sqlTemplates() { const templates = super.sqlTemplates(); templates.functions.CURRENTDATE = 'CURRENT_DATE'; @@ -178,6 +182,32 @@ export class DatabricksQuery extends BaseQuery { templates.expressions.interval_single_date_part = 'INTERVAL \'{{ num }}\' {{ date_part }}'; templates.quotes.identifiers = '`'; templates.quotes.escape = '``'; + templates.statements.time_series_select = 'SELECT date_from::timestamp AS `date_from`,\n' + + 'date_to::timestamp AS `date_to` \n' + + 'FROM(\n' + + ' VALUES ' + + '{% for time_item in seria %}' + + '(\'{{ time_item | join(\'\\\', \\\'\') }}\')' + + '{% if not loop.last %}, {% endif %}' + + '{% endfor %}' + + ') AS dates (date_from, date_to)'; + templates.statements.generated_time_series_select = 'SELECT d AS date_from,\n' + + '(d + INTERVAL {{ granularity }}) - INTERVAL 1 MILLISECOND AS date_to\n' + + ' FROM (SELECT explode(sequence(\n' + + ' from_utc_timestamp({{ start }}, \'UTC\'), from_utc_timestamp({{ end }}, \'UTC\'), INTERVAL {{ granularity }}\n' + + ' )) AS d)'; + templates.statements.generated_time_series_with_cte_range_source = + 'SELECT d AS date_from,\n' + + '(d + INTERVAL {{ granularity }}) - INTERVAL 1 MILLISECOND AS date_to\n' + + 'FROM {{ range_source }}\n' + + 'LATERAL VIEW explode(\n' + + ' sequence(\n' + + ' CAST({{ min_name }} AS TIMESTAMP),\n' + + ' CAST({{ max_name }} AS TIMESTAMP),\n' + + ' INTERVAL {{ granularity }}\n' + + ' )\n' + + ') dates AS d'; + // TODO: Databricks has `TIMESTAMP_NTZ` with logic similar to Pg's `TIMESTAMP` // but that requires Runtime 13.3+. Should this be enabled? // templates.types.timestamp = 'TIMESTAMP_NTZ'; diff --git a/packages/cubejs-testing-drivers/fixtures/databricks-jdbc.json b/packages/cubejs-testing-drivers/fixtures/databricks-jdbc.json index e2c62e8eaf59e..06430be25943e 100644 --- a/packages/cubejs-testing-drivers/fixtures/databricks-jdbc.json +++ b/packages/cubejs-testing-drivers/fixtures/databricks-jdbc.json @@ -235,5 +235,48 @@ "SQL API: Nested Rollup with aliases", "SQL API: Nested Rollup over asteriks", "SQL API: Extended nested Rollup over asterisk" + ], + "tesseractSkip": [ + "must download query from the data source via memory", + "must download query from the data source via stream", + "for the Customers.RollingExternal", + "for the Customers.RollingInternal", + "for the ECommerce.SimpleAnalysisExternal", + "for the ECommerce.SimpleAnalysisInternal", + "for the ECommerce.TimeAnalysisInternal", + "for the ECommerce.TimeAnalysisExternal", + "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 ECommerce: count by three_months_by_march + no dimension", + "querying custom granularities ECommerce: count by three_months_by_march + dimension", + "SQL API: SQL push down push to cube quoted alias", + "SQL API: Complex Rollup", + "SQL API: Simple Rollup", + "SQL API: Rollup over exprs", + "SQL API: Rollup with aliases", + "SQL API: Nested Rollup", + "SQL API: Nested Rollup with aliases", + "SQL API: Nested Rollup over asterisk", + "SQL API: Rolling Window YTD (year + month + day + date_trunc equal)", + "SQL API: Rolling Window YTD (year + month + day + date_trunc IN)", + + "---- Different results comparing to baseQuery version. Need to investigate ----", + "querying ECommerce: dimensions", + "querying ECommerce: dimensions + order", + "querying ECommerce: dimensions + limit", + "querying ECommerce: dimensions + total", + "querying ECommerce: dimensions + order + limit + total", + "querying ECommerce: dimensions + order + total + offset", + "querying ECommerce: dimensions + order + limit + total + offset", + "filtering ECommerce: contains dimensions, first", + "filtering ECommerce: contains dimensions, second", + "filtering ECommerce: startsWith + dimensions, first", + "filtering ECommerce: startsWith + dimensions, second", + "filtering ECommerce: endsWith + dimensions, first", + "filtering ECommerce: endsWith + dimensions, second", + "querying BigECommerce: rolling window YTD (month + week)", + "querying BigECommerce: rolling window YTD (month + week + no gran)" ] } diff --git a/packages/cubejs-testing-drivers/test/__snapshots__/databricks-jdbc-full.test.ts.snap b/packages/cubejs-testing-drivers/test/__snapshots__/databricks-jdbc-full.test.ts.snap index fce072a38c3cb..768525e4489e2 100644 --- a/packages/cubejs-testing-drivers/test/__snapshots__/databricks-jdbc-full.test.ts.snap +++ b/packages/cubejs-testing-drivers/test/__snapshots__/databricks-jdbc-full.test.ts.snap @@ -1813,6 +1813,231 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver SQL API: Extended nested Rollup over asterisk 1`] = ` +Array [ + Object { + "SUM(a.count)": "1", + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-141677", + "row": 7174, + }, +] +`; + exports[`Queries with the @cubejs-backend/databricks-jdbc-driver SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` Array [ Object { @@ -9060,47 +9285,227 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: null boolean 1`] = ` +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce with Retail Calendar: totalCountRetailMonthAgo 1`] = ` Array [ Object { - "BigECommerce.returning": null, + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailMonthAgo": "1", + "RetailCalendar.retail_date": "2020-02-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-02-01T00:00:00.000", }, -] -`; - -exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: null sum 1`] = ` -Array [ Object { - "BigECommerce.totalSales": null, + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailMonthAgo": "1", + "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/databricks-jdbc-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": "2", + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailMonthAgo": "2", + "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": "4", + "BigECommerce.count": "5", + "BigECommerce.totalCountRetailMonthAgo": "1", + "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": "2", + "BigECommerce.count": "7", + "BigECommerce.totalCountRetailMonthAgo": "5", + "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": "5", + "BigECommerce.count": "4", + "BigECommerce.totalCountRetailMonthAgo": "6", + "RetailCalendar.retail_date": "2020-10-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-10-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "9", + "BigECommerce.totalCountRetailMonthAgo": "5", + "RetailCalendar.retail_date": "2020-11-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-11-01T00:00:00.000", + }, + Object { + "BigECommerce.count": "7", + "BigECommerce.totalCountRetailMonthAgo": "8", + "RetailCalendar.retail_date": "2020-12-01T00:00:00.000", + "RetailCalendar.retail_date.month": "2020-12-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce with Retail Calendar: totalCountRetailWeekAgo 1`] = ` +Array [ + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-03-22", + "RetailCalendar.retail_date.week": "2020-03-22", + }, + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-05-31", + "RetailCalendar.retail_date.week": "2020-05-31", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-06-07", + "RetailCalendar.retail_date.week": "2020-06-07", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-06-14", + "RetailCalendar.retail_date.week": "2020-06-14", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-06-21", + "RetailCalendar.retail_date.week": "2020-06-21", + }, + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-09-06", + "RetailCalendar.retail_date.week": "2020-09-06", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-09-13", + "RetailCalendar.retail_date.week": "2020-09-13", + }, + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-09-20", + "RetailCalendar.retail_date.week": "2020-09-20", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-10-18", + "RetailCalendar.retail_date.week": "2020-10-18", + }, + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-10-25", + "RetailCalendar.retail_date.week": "2020-10-25", + }, + Object { + "BigECommerce.count": "3", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-11-01", + "RetailCalendar.retail_date.week": "2020-11-01", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "3", + "RetailCalendar.retail_date": "2020-11-08", + "RetailCalendar.retail_date.week": "2020-11-08", + }, + Object { + "BigECommerce.count": "3", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-11-15", + "RetailCalendar.retail_date.week": "2020-11-15", + }, + Object { + "BigECommerce.count": "1", + "BigECommerce.totalCountRetailWeekAgo": "3", + "RetailCalendar.retail_date": "2020-11-22", + "RetailCalendar.retail_date.week": "2020-11-22", + }, + Object { + "BigECommerce.count": "3", + "BigECommerce.totalCountRetailWeekAgo": "1", + "RetailCalendar.retail_date": "2020-11-29", + "RetailCalendar.retail_date.week": "2020-11-29", + }, + Object { + "BigECommerce.count": "2", + "BigECommerce.totalCountRetailWeekAgo": "2", + "RetailCalendar.retail_date": "2020-12-20", + "RetailCalendar.retail_date.week": "2020-12-20", + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce with Retail Calendar: totalCountRetailYearAgo 1`] = ` +Array [ + Object { + "BigECommerce.count": "42", + "BigECommerce.totalCountRetailYearAgo": "2", + "RetailCalendar.retail_date": "2020-02-02", + "RetailCalendar.retail_date.year": "2020-02-02", + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-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": 48.896, + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.totalSales": 232.88, + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: null boolean 1`] = ` +Array [ + Object { + "BigECommerce.returning": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: null sum 1`] = ` +Array [ + Object { + "BigECommerce.totalSales": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/databricks-jdbc-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": "2", + }, + 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": "4", + }, + 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": "2", + }, + 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": "5", }, Object { "BigECommerce.orderDate": "2020-03-01T00:00:00.000", @@ -10882,6 +11287,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/databricks-jdbc-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": "2", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "3", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "5", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "6", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "11", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "18", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "18", + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "18", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "24", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "28", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "37", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountYTD": "44", + }, +] +`; + exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: rolling window YTD without granularity 1`] = ` Array [ Object { @@ -10955,6 +11425,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/databricks-jdbc-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": null, + }, + 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": "1", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + 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/databricks-jdbc-driver querying BigECommerce: rolling window by 2 month 1`] = ` Array [ Object { @@ -11020,6 +11555,71 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/databricks-jdbc-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": "2", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "6", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "12", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "7", + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "6", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "10", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "13", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "16", + }, +] +`; + exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: rolling window by 2 week 1`] = ` Array [ Object { @@ -15901,6 +16501,46 @@ Array [ ] `; +exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading without date range 1`] = ` +Array [ + Object { + "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2019-12-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "8", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-02-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-02-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "12", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-04-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "6", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-06-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-06-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "19", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-08-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-08-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "16", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-10-01T10:00:00.000", + "ECommerce.rollingCountByLeading": null, + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-12-01T10:00:00.000", + "ECommerce.rollingCountByLeading": null, + }, +] +`; + exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` Array [ Object { @@ -15980,18 +16620,3 @@ Array [ }, ] `; - -exports[`Queries with the @cubejs-backend/databricks-jdbc-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": 48.896, - }, - Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", - "BigECommerce.totalSales": 232.88, - }, -] -`;