@cubejs-backend/dremio-driver 1.1.11 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.13](https://github.com/cube-js/cube/compare/v1.1.12...v1.1.13) (2025-01-09)
7
+
8
+ **Note:** Version bump only for package @cubejs-backend/dremio-driver
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.1.12](https://github.com/cube-js/cube/compare/v1.1.11...v1.1.12) (2025-01-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **dremio-driver:** Fix stale version of testing-shared dependency ([#9079](https://github.com/cube-js/cube/issues/9079)) ([ee826e1](https://github.com/cube-js/cube/commit/ee826e10c4e1a078083d32580a5d63bcdeb16628))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.1.11](https://github.com/cube-js/cube/compare/v1.1.10...v1.1.11) (2024-12-16)
7
26
 
8
27
  **Note:** Version bump only for package @cubejs-backend/dremio-driver
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cubejs-backend/dremio-driver",
3
3
  "description": "Cube.js Dremio driver",
4
4
  "author": "Cube Dev, Inc.",
5
- "version": "1.1.11",
5
+ "version": "1.1.13",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/cube-js/cube.git",
@@ -13,19 +13,25 @@
13
13
  },
14
14
  "main": "driver/DremioDriver.js",
15
15
  "scripts": {
16
+ "tsc": "tsc",
17
+ "watch": "tsc -w",
18
+ "test": "yarn integration",
19
+ "integration": "npm run integration:dremio",
20
+ "integration:dremio": "jest --verbose dist/test",
16
21
  "lint": "eslint driver/*.js",
17
22
  "lint:fix": "eslint driver/*.js"
18
23
  },
19
24
  "dependencies": {
20
- "@cubejs-backend/base-driver": "1.1.10",
21
- "@cubejs-backend/schema-compiler": "1.1.11",
22
- "@cubejs-backend/shared": "1.1.10",
25
+ "@cubejs-backend/base-driver": "1.1.12",
26
+ "@cubejs-backend/schema-compiler": "1.1.13",
27
+ "@cubejs-backend/shared": "1.1.12",
23
28
  "axios": "^0.21.1",
24
29
  "moment-timezone": "^0.5.31",
25
30
  "sqlstring": "^2.3.1"
26
31
  },
27
32
  "devDependencies": {
28
33
  "@cubejs-backend/linter": "^1.0.0",
34
+ "@cubejs-backend/testing-shared": "1.1.13",
29
35
  "jest": "^27"
30
36
  },
31
37
  "license": "Apache-2.0",
@@ -33,10 +39,13 @@
33
39
  "access": "public"
34
40
  },
35
41
  "jest": {
36
- "testEnvironment": "node"
42
+ "testEnvironment": "node",
43
+ "setupFiles": [
44
+ "./test/test-env.js"
45
+ ]
37
46
  },
38
47
  "eslintConfig": {
39
48
  "extends": "../cubejs-linter"
40
49
  },
41
- "gitHead": "b8afc8466fabcd50e95aad595675aa505ff48293"
50
+ "gitHead": "7e663343c8c5a7514d6630915257f54a975e9ea2"
42
51
  }
@@ -0,0 +1,21 @@
1
+ import { DriverTests } from '@cubejs-backend/testing-shared';
2
+
3
+ const DremioDriver = require('../../driver/DremioDriver');
4
+
5
+ describe('DremioDriver', () => {
6
+ let tests: DriverTests;
7
+
8
+ jest.setTimeout(10 * 60 * 1000); // Engine needs to spin up
9
+
10
+ beforeAll(async () => {
11
+ tests = new DriverTests(new DremioDriver({}), { expectStringFields: false });
12
+ });
13
+
14
+ afterAll(async () => {
15
+ await tests.release();
16
+ });
17
+
18
+ test('query', async () => {
19
+ await tests.testQuery();
20
+ });
21
+ });
@@ -0,0 +1,121 @@
1
+ import { prepareCompiler as originalPrepareCompiler } from '@cubejs-backend/schema-compiler';
2
+
3
+ const DremioQuery = require('../../driver/DremioQuery');
4
+
5
+ const prepareCompiler = (content: string) => originalPrepareCompiler({
6
+ localPath: () => __dirname,
7
+ dataSchemaFiles: () => Promise.resolve([{ fileName: 'main.js', content }]),
8
+ });
9
+
10
+ describe('DremioQuery', () => {
11
+
12
+ jest.setTimeout(10 * 60 * 1000); // Engine needs to spin up
13
+
14
+ const { compiler, joinGraph, cubeEvaluator } = prepareCompiler(
15
+ `
16
+ cube(\`sales\`, {
17
+ sql: \` select * from public.sales \`,
18
+
19
+ measures: {
20
+ count: {
21
+ type: 'count'
22
+ }
23
+ },
24
+ dimensions: {
25
+ category: {
26
+ type: 'string',
27
+ sql: 'category'
28
+ },
29
+ salesDatetime: {
30
+ type: 'time',
31
+ sql: 'sales_datetime'
32
+ },
33
+ isShiped: {
34
+ type: 'boolean',
35
+ sql: 'is_shiped',
36
+ },
37
+ }
38
+ });
39
+ `,
40
+ );
41
+
42
+ it('should use DATE_TRUNC for time granularity dimensions', () => compiler.compile().then(() => {
43
+ const query = new DremioQuery(
44
+ { joinGraph, cubeEvaluator, compiler },
45
+ {
46
+ measures: ['sales.count'],
47
+ timeDimensions: [
48
+ {
49
+ dimension: 'sales.salesDatetime',
50
+ granularity: 'day',
51
+ dateRange: ['2017-01-01', '2017-01-02'],
52
+ },
53
+ ],
54
+ timezone: 'America/Los_Angeles',
55
+ order: [
56
+ {
57
+ id: 'sales.salesDatetime',
58
+ },
59
+ ],
60
+ }
61
+ );
62
+
63
+ const queryAndParams = query.buildSqlAndParams();
64
+
65
+ expect(queryAndParams[0]).toContain(
66
+ 'DATE_TRUNC(\'day\', CONVERT_TIMEZONE(\'-08:00\', "sales".sales_datetime))'
67
+ );
68
+ }));
69
+
70
+ it('should cast BOOLEAN', () => compiler.compile().then(() => {
71
+ const query = new DremioQuery(
72
+ { joinGraph, cubeEvaluator, compiler },
73
+ {
74
+ measures: ['sales.count'],
75
+ filters: [
76
+ {
77
+ member: 'sales.isShiped',
78
+ operator: 'equals',
79
+ values: ['true']
80
+ }
81
+ ]
82
+ }
83
+ );
84
+
85
+ const queryAndParams = query.buildSqlAndParams();
86
+
87
+ expect(queryAndParams[0]).toContain(
88
+ '("sales".is_shiped = CAST(? AS BOOLEAN))'
89
+ );
90
+
91
+ expect(queryAndParams[1]).toEqual(['true']);
92
+ }));
93
+
94
+ it('should cast timestamp', () => compiler.compile().then(() => {
95
+ const query = new DremioQuery(
96
+ { joinGraph, cubeEvaluator, compiler },
97
+ {
98
+ measures: ['sales.count'],
99
+ timeDimensions: [
100
+ {
101
+ dimension: 'sales.salesDatetime',
102
+ granularity: 'day',
103
+ dateRange: ['2017-01-01', '2017-01-02'],
104
+ },
105
+ ],
106
+ timezone: 'America/Los_Angeles',
107
+ order: [
108
+ {
109
+ id: 'sales.salesDatetime',
110
+ },
111
+ ],
112
+ }
113
+ );
114
+
115
+ const queryAndParams = query.buildSqlAndParams();
116
+
117
+ expect(queryAndParams[0]).toContain(
118
+ '("sales".sales_datetime >= TO_TIMESTAMP(?, \'YYYY-MM-DD"T"HH24:MI:SS.FFF\') AND "sales".sales_datetime <= TO_TIMESTAMP(?, \'YYYY-MM-DD"T"HH24:MI:SS.FFF\'))'
119
+ );
120
+ }));
121
+ });
@@ -0,0 +1,12 @@
1
+ const REQUIRED_ENV_VARS = [
2
+ 'CUBEJS_DB_URL',
3
+ 'CUBEJS_DB_NAME',
4
+ 'CUBEJS_DB_DREMIO_AUTH_TOKEN',
5
+ ];
6
+
7
+ REQUIRED_ENV_VARS.forEach((key) => {
8
+ // Trying to populate from DRIVERS_TESTS_DREMIO_* vars
9
+ if (process.env[`DRIVERS_TESTS_DREMIO_${key}`] !== undefined) {
10
+ process.env[key] = process.env[`DRIVERS_TESTS_DREMIO_${key}`];
11
+ }
12
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "include": [
4
+ "src",
5
+ "test"
6
+ ],
7
+ "compilerOptions": {
8
+ "outDir": "dist",
9
+ "rootDir": ".",
10
+ "baseUrl": ".",
11
+ "resolveJsonModule": true
12
+ }
13
+ }