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
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,7 @@ export class PreAggregationPartitionRangeLoader {
throw new Error(`Date range expected to be a string array but ${range} found`);
}

if (range[0].length !== 23 || range[1].length !== 23) {
if ((range[0].length !== 23 && range[0].length !== 26) || (range[1].length !== 23 && range[0].length !== 26)) {
throw new Error(`Date range expected to be in YYYY-MM-DDTHH:mm:ss.SSS format but ${range} found`);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable global-require */
/* globals describe, jest, beforeEach, test, expect */
import R from 'ramda';
import { PreAggregationPartitionRangeLoader } from '../../src';

class MockDriver {
constructor() {
Expand Down Expand Up @@ -369,4 +370,31 @@ describe('PreAggregations', () => {
expect(result[0][1].lastUpdatedAt).toEqual(1893709044209);
});
});

describe('intersectDateRanges', () => {
test('6 timestamps - valid intersection', () => {
expect(PreAggregationPartitionRangeLoader.intersectDateRanges(
['2024-01-05T00:00:00.000000', '2024-01-05T23:59:59.999999'],
['2024-01-01T00:00:00.000000', '2024-01-31T23:59:59.999999'],
)).toEqual(
['2024-01-05T00:00:00.000000', '2024-01-05T23:59:59.999999']
);

expect(PreAggregationPartitionRangeLoader.intersectDateRanges(
['2024-01-20T00:00:00.000000', '2024-02-05T23:59:59.999999'],
['2024-01-01T00:00:00.000000', '2024-01-31T23:59:59.999999'],
)).toEqual(
['2024-01-20T00:00:00.000000', '2024-01-31T23:59:59.999999']
);
});

test('3 timestamps - valid intersection', () => {
expect(PreAggregationPartitionRangeLoader.intersectDateRanges(
['2024-01-05T00:00:00.000', '2024-01-05T23:59:59.999'],
['2024-01-01T00:00:00.000', '2024-01-31T23:59:59.999'],
)).toEqual(
['2024-01-05T00:00:00.000', '2024-01-05T23:59:59.999']
);
});
});
});
1 change: 0 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/bigquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
"---------------------------------------",
"Full tests ",
"---------------------------------------",
"must built pre-aggregations",
"querying Customers: dimentions + order + total + offset",
"querying ECommerce: dimentions + order + total + offset",

Expand Down