@malloydata/db-trino 0.0.240-dev250311202829 → 0.0.240-dev250311214430

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-trino",
3
- "version": "0.0.240-dev250311202829",
3
+ "version": "0.0.240-dev250311214430",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "prepublishOnly": "npm run build"
23
23
  },
24
24
  "dependencies": {
25
- "@malloydata/malloy": "^0.0.240-dev250311202829",
25
+ "@malloydata/malloy": "^0.0.240-dev250311214430",
26
26
  "@prestodb/presto-js-client": "^1.0.0",
27
27
  "gaxios": "^4.2.0",
28
28
  "trino-client": "^0.2.2"
@@ -1 +0,0 @@
1
- export {};
@@ -1,112 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2024 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const _1 = require(".");
26
- // array(varchar) is array
27
- const ARRAY_SCHEMA = 'array(integer)';
28
- // row(...) is inline
29
- const INLINE_SCHEMA = 'row(a double, b integer, c varchar(60))';
30
- // array(row(....)) is nested
31
- const NESTED_SCHEMA = 'array(row(a double, b integer, c varchar(60)))';
32
- // array(row(..., array(row(....)))) is deeply nested
33
- const DEEP_SCHEMA = 'array(row(a double, b array(row(c integer, d varchar(60)))))';
34
- const intType = { type: 'number', numberType: 'integer' };
35
- const doubleType = { type: 'number', numberType: 'float' };
36
- const stringType = { type: 'string' };
37
- const recordSchema = [
38
- { name: 'a', ...doubleType },
39
- { name: 'b', ...intType },
40
- { name: 'c', ...stringType },
41
- ];
42
- describe('Trino connection', () => {
43
- let connection;
44
- beforeAll(() => {
45
- connection = new _1.TrinoConnection('trino', {}, _1.TrinoExecutor.getConnectionOptionsFromEnv('trino'));
46
- });
47
- afterAll(() => {
48
- connection.close();
49
- });
50
- describe('schema parser', () => {
51
- it('parses arrays', () => {
52
- expect(connection.malloyTypeFromTrinoType(ARRAY_SCHEMA)).toEqual({
53
- type: 'array',
54
- elementTypeDef: intType,
55
- });
56
- });
57
- it('parses inline', () => {
58
- expect(connection.malloyTypeFromTrinoType(INLINE_SCHEMA)).toEqual({
59
- 'type': 'record',
60
- 'fields': recordSchema,
61
- });
62
- });
63
- it('parses nested', () => {
64
- expect(connection.malloyTypeFromTrinoType(NESTED_SCHEMA)).toEqual({
65
- 'type': 'array',
66
- 'elementTypeDef': { type: 'record_element' },
67
- 'fields': recordSchema,
68
- });
69
- });
70
- it('parses a simple type', () => {
71
- expect(connection.malloyTypeFromTrinoType('varchar(60)')).toEqual(stringType);
72
- });
73
- it('parses a decimal integer type', () => {
74
- expect(connection.malloyTypeFromTrinoType('decimal(10)')).toEqual({
75
- type: 'number',
76
- numberType: 'integer',
77
- });
78
- });
79
- it('parses a decimal float type', () => {
80
- expect(connection.malloyTypeFromTrinoType('decimal(10,10)')).toEqual({
81
- type: 'number',
82
- numberType: 'float',
83
- });
84
- });
85
- it('parses row with timestamp(3)', () => {
86
- expect(connection.malloyTypeFromTrinoType('row(la_time timestamp(3))')).toEqual({
87
- type: 'record',
88
- fields: [{ name: 'la_time', type: 'timestamp' }],
89
- });
90
- });
91
- it('parses deep nesting', () => {
92
- expect(connection.malloyTypeFromTrinoType(DEEP_SCHEMA)).toEqual({
93
- 'type': 'array',
94
- 'elementTypeDef': { type: 'record_element' },
95
- 'fields': [
96
- { 'name': 'a', ...doubleType },
97
- {
98
- 'name': 'b',
99
- 'type': 'array',
100
- 'elementTypeDef': { type: 'record_element' },
101
- 'join': 'many',
102
- 'fields': [
103
- { 'name': 'c', ...intType },
104
- { 'name': 'd', ...stringType },
105
- ],
106
- },
107
- ],
108
- });
109
- });
110
- });
111
- });
112
- //# sourceMappingURL=trino_connection.spec.js.map