@malloydata/db-trino 0.0.138-dev240402220928 → 0.0.138-dev240402223657

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.
@@ -59,7 +59,7 @@ export declare class TrinoConnection implements Connection, PersistSQLResults {
59
59
  }>;
60
60
  private structDefFromSqlBlock;
61
61
  private executeAndWait;
62
- private splitColumns;
62
+ splitColumns(s: string): string[];
63
63
  malloyTypeFromTrinoType(name: string, trinoType: string): FieldAtomicTypeDef | StructDef;
64
64
  structDefFromSchema(rows: string[][], structDef: StructDef): void;
65
65
  private loadSchemaForSqlBlock;
@@ -27,9 +27,15 @@ const ARRAY_SCHEMA = 'array(integer)';
27
27
  const STRUCT_SCHEMA = 'row(a double, b integer, c varchar(60))';
28
28
  const DEEP_SCHEMA = 'array(row(a double, b integer, c varchar(60)))';
29
29
  describe('Trino connection', () => {
30
+ let connection;
31
+ beforeAll(() => {
32
+ connection = new _1.TrinoConnection('trino', {}, _1.TrinoExecutor.getConnectionOptionsFromEnv());
33
+ });
34
+ afterAll(() => {
35
+ connection.close();
36
+ });
30
37
  describe('schema parser', () => {
31
38
  it('parses arrays', () => {
32
- const connection = new _1.TrinoConnection('trino', {}, _1.TrinoExecutor.getConnectionOptionsFromEnv());
33
39
  expect(connection.malloyTypeFromTrinoType('test', ARRAY_SCHEMA)).toEqual({
34
40
  'name': 'test',
35
41
  'type': 'struct',
@@ -103,5 +109,15 @@ describe('Trino connection', () => {
103
109
  });
104
110
  });
105
111
  });
112
+ describe('splitColumns', () => {
113
+ it('handles internal rows', () => {
114
+ const nested = 'popular_name varchar, airport_count double, by_state array(row(state varchar, airport_count double))';
115
+ expect(connection.splitColumns(nested)).toEqual([
116
+ 'popular_name varchar',
117
+ 'airport_count double',
118
+ 'by_state array(row(state varchar, airport_count double))',
119
+ ]);
120
+ });
121
+ });
106
122
  });
107
123
  //# sourceMappingURL=trino_connection.spec.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-trino",
3
- "version": "0.0.138-dev240402220928",
3
+ "version": "0.0.138-dev240402223657",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",