@malloydata/malloy-tests 0.0.66-dev230807232724
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/README.md +29 -0
- package/bin/dump_malloytest.sh +1 -0
- package/bin/postgres_init.sh +9 -0
- package/bin/postgres_start.sh +2 -0
- package/bin/postgres_stop.sh +2 -0
- package/data/duckdb/README.md +4 -0
- package/data/duckdb/aircraft.parquet +0 -0
- package/data/duckdb/aircraft_models.parquet +0 -0
- package/data/duckdb/airports.parquet +0 -0
- package/data/duckdb/alltypes.parquet +0 -0
- package/data/duckdb/alltypes2.parquet +0 -0
- package/data/duckdb/bq_medicare_test.parquet +0 -0
- package/data/duckdb/carriers.parquet +0 -0
- package/data/duckdb/flights/part.0.parquet +0 -0
- package/data/duckdb/flights/part.1.parquet +0 -0
- package/data/duckdb/flights/part.2.parquet +0 -0
- package/data/duckdb/flights.parquet +0 -0
- package/data/duckdb/flights_partitioned.parquet +0 -0
- package/data/duckdb/ga_sample.parquet +0 -0
- package/data/duckdb/numbers.parquet +0 -0
- package/data/duckdb/state_facts.parquet +0 -0
- package/data/duckdb/test.json +3 -0
- package/data/duckdb/words.parquet +0 -0
- package/data/duckdb/words_bigger.parquet +0 -0
- package/data/postgres/malloytest-postgres.sql.gz +0 -0
- package/data/postgres/state_facts.sql +366 -0
- package/dist/api.spec.d.ts +1 -0
- package/dist/api.spec.js +77 -0
- package/dist/api.spec.js.map +1 -0
- package/dist/databases/all/expr.spec.d.ts +3 -0
- package/dist/databases/all/expr.spec.js +581 -0
- package/dist/databases/all/expr.spec.js.map +1 -0
- package/dist/databases/all/functions.spec.d.ts +2 -0
- package/dist/databases/all/functions.spec.js +784 -0
- package/dist/databases/all/functions.spec.js.map +1 -0
- package/dist/databases/all/index.spec.d.ts +2 -0
- package/dist/databases/all/index.spec.js +154 -0
- package/dist/databases/all/index.spec.js.map +1 -0
- package/dist/databases/all/join.spec.d.ts +2 -0
- package/dist/databases/all/join.spec.js +309 -0
- package/dist/databases/all/join.spec.js.map +1 -0
- package/dist/databases/all/nomodel.spec.d.ts +2 -0
- package/dist/databases/all/nomodel.spec.js +957 -0
- package/dist/databases/all/nomodel.spec.js.map +1 -0
- package/dist/databases/all/orderby.spec.d.ts +2 -0
- package/dist/databases/all/orderby.spec.js +224 -0
- package/dist/databases/all/orderby.spec.js.map +1 -0
- package/dist/databases/all/problems.spec.d.ts +2 -0
- package/dist/databases/all/problems.spec.js +113 -0
- package/dist/databases/all/problems.spec.js.map +1 -0
- package/dist/databases/all/sql_expressions.spec.d.ts +2 -0
- package/dist/databases/all/sql_expressions.spec.js +96 -0
- package/dist/databases/all/sql_expressions.spec.js.map +1 -0
- package/dist/databases/all/time.spec.d.ts +3 -0
- package/dist/databases/all/time.spec.js +647 -0
- package/dist/databases/all/time.spec.js.map +1 -0
- package/dist/databases/bigquery/double_truncation.spec.d.ts +1 -0
- package/dist/databases/bigquery/double_truncation.spec.js +50 -0
- package/dist/databases/bigquery/double_truncation.spec.js.map +1 -0
- package/dist/databases/bigquery/handexpr.spec.d.ts +1 -0
- package/dist/databases/bigquery/handexpr.spec.js +713 -0
- package/dist/databases/bigquery/handexpr.spec.js.map +1 -0
- package/dist/databases/bigquery/injestion_time_partitioning.spec.d.ts +1 -0
- package/dist/databases/bigquery/injestion_time_partitioning.spec.js +235 -0
- package/dist/databases/bigquery/injestion_time_partitioning.spec.js.map +1 -0
- package/dist/databases/bigquery/joined_filters.spec.d.ts +1 -0
- package/dist/databases/bigquery/joined_filters.spec.js +72 -0
- package/dist/databases/bigquery/joined_filters.spec.js.map +1 -0
- package/dist/databases/bigquery/json.spec.d.ts +1 -0
- package/dist/databases/bigquery/json.spec.js +86 -0
- package/dist/databases/bigquery/json.spec.js.map +1 -0
- package/dist/databases/bigquery/malloy_query.spec.d.ts +1 -0
- package/dist/databases/bigquery/malloy_query.spec.js +906 -0
- package/dist/databases/bigquery/malloy_query.spec.js.map +1 -0
- package/dist/databases/bigquery/performance.skipped.spec.d.ts +1 -0
- package/dist/databases/bigquery/performance.skipped.spec.js +70 -0
- package/dist/databases/bigquery/performance.skipped.spec.js.map +1 -0
- package/dist/databases/bigquery/time.spec.d.ts +1 -0
- package/dist/databases/bigquery/time.spec.js +55 -0
- package/dist/databases/bigquery/time.spec.js.map +1 -0
- package/dist/databases/bigquery/wildcard_table_names.spec.d.ts +1 -0
- package/dist/databases/bigquery/wildcard_table_names.spec.js +212 -0
- package/dist/databases/bigquery/wildcard_table_names.spec.js.map +1 -0
- package/dist/databases/bigquery-duckdb/nested_source_table.spec.d.ts +1 -0
- package/dist/databases/bigquery-duckdb/nested_source_table.spec.js +247 -0
- package/dist/databases/bigquery-duckdb/nested_source_table.spec.js.map +1 -0
- package/dist/databases/bigquery-postgres/multi_connection.spec.d.ts +1 -0
- package/dist/databases/bigquery-postgres/multi_connection.spec.js +138 -0
- package/dist/databases/bigquery-postgres/multi_connection.spec.js.map +1 -0
- package/dist/databases/bigquery-postgres/streaming.spec.d.ts +1 -0
- package/dist/databases/bigquery-postgres/streaming.spec.js +88 -0
- package/dist/databases/bigquery-postgres/streaming.spec.js.map +1 -0
- package/dist/databases/duckdb/duckdb.spec.d.ts +1 -0
- package/dist/databases/duckdb/duckdb.spec.js +116 -0
- package/dist/databases/duckdb/duckdb.spec.js.map +1 -0
- package/dist/databases/postgres/postgres.spec.d.ts +1 -0
- package/dist/databases/postgres/postgres.spec.js +137 -0
- package/dist/databases/postgres/postgres.spec.js.map +1 -0
- package/dist/databases/shared/test_list.d.ts +3 -0
- package/dist/databases/shared/test_list.js +24 -0
- package/dist/databases/shared/test_list.js.map +1 -0
- package/dist/dependencies.spec.d.ts +1 -0
- package/dist/dependencies.spec.js +63 -0
- package/dist/dependencies.spec.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/model/utils.spec.d.ts +1 -0
- package/dist/model/utils.spec.js +38 -0
- package/dist/model/utils.spec.js.map +1 -0
- package/dist/models/faa_model.d.ts +5 -0
- package/dist/models/faa_model.js +977 -0
- package/dist/models/faa_model.js.map +1 -0
- package/dist/models/medicare_model.d.ts +4 -0
- package/dist/models/medicare_model.js +243 -0
- package/dist/models/medicare_model.js.map +1 -0
- package/dist/render/render.spec.d.ts +1 -0
- package/dist/render/render.spec.js +551 -0
- package/dist/render/render.spec.js.map +1 -0
- package/dist/runtimes.d.ts +33 -0
- package/dist/runtimes.js +147 -0
- package/dist/runtimes.js.map +1 -0
- package/dist/tags.spec.d.ts +1 -0
- package/dist/tags.spec.js +259 -0
- package/dist/tags.spec.js.map +1 -0
- package/dist/util/db-jest-matchers.d.ts +19 -0
- package/dist/util/db-jest-matchers.js +90 -0
- package/dist/util/db-jest-matchers.js.map +1 -0
- package/dist/util/index.d.ts +16 -0
- package/dist/util/index.js +171 -0
- package/dist/util/index.js.map +1 -0
- package/package.json +35 -0
- package/src/api.spec.ts +84 -0
- package/src/databases/all/expr.spec.ts +704 -0
- package/src/databases/all/functions.spec.ts +1135 -0
- package/src/databases/all/index.spec.ts +178 -0
- package/src/databases/all/join.spec.ts +350 -0
- package/src/databases/all/nomodel.spec.ts +1159 -0
- package/src/databases/all/orderby.spec.ts +268 -0
- package/src/databases/all/problems.spec.ts +121 -0
- package/src/databases/all/sql_expressions.spec.ts +107 -0
- package/src/databases/all/time.spec.ts +793 -0
- package/src/databases/bigquery/double_truncation.spec.ts +51 -0
- package/src/databases/bigquery/handexpr.spec.ts +782 -0
- package/src/databases/bigquery/injestion_time_partitioning.spec.ts +268 -0
- package/src/databases/bigquery/joined_filters.spec.ts +75 -0
- package/src/databases/bigquery/json.spec.ts +95 -0
- package/src/databases/bigquery/malloy_query.spec.ts +1036 -0
- package/src/databases/bigquery/performance.skipped.spec.ts +73 -0
- package/src/databases/bigquery/time.spec.ts +59 -0
- package/src/databases/bigquery/wildcard_table_names.spec.ts +233 -0
- package/src/databases/bigquery-duckdb/nested_source_table.spec.ts +268 -0
- package/src/databases/bigquery-postgres/multi_connection.spec.ts +143 -0
- package/src/databases/bigquery-postgres/streaming.spec.ts +100 -0
- package/src/databases/duckdb/duckdb.spec.ts +131 -0
- package/src/databases/postgres/postgres.spec.ts +167 -0
- package/src/databases/shared/test_list.ts +24 -0
- package/src/dependencies.spec.ts +62 -0
- package/src/index.ts +36 -0
- package/src/model/utils.spec.ts +37 -0
- package/src/models/faa_model.ts +995 -0
- package/src/models/medicare_model.ts +246 -0
- package/src/render/__snapshots__/render.spec.ts.snap +12574 -0
- package/src/render/render.spec.ts +670 -0
- package/src/runtimes.ts +182 -0
- package/src/tags.spec.ts +277 -0
- package/src/util/db-jest-matchers.ts +128 -0
- package/src/util/index.ts +191 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 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 runtimes_1 = require("../runtimes");
|
|
26
|
+
const util_1 = require("../util");
|
|
27
|
+
const render_1 = require("@malloydata/render");
|
|
28
|
+
const jsdom_1 = require("jsdom");
|
|
29
|
+
async function runUnsupportedRenderTest(connectionName, runtimes, expr, rendered) {
|
|
30
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
31
|
+
expect(runtime).toBeDefined();
|
|
32
|
+
if (runtime) {
|
|
33
|
+
const src = `
|
|
34
|
+
sql: sql_block is {
|
|
35
|
+
select: """SELECT ${expr} AS test"""
|
|
36
|
+
connection: "${connectionName}"
|
|
37
|
+
}
|
|
38
|
+
query: q is from_sql(sql_block)->{ project: *}
|
|
39
|
+
`;
|
|
40
|
+
const result = await runtime.loadModel(src).loadQueryByName('q').run();
|
|
41
|
+
// console.log("DATA", result.data.toObject());
|
|
42
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
43
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
44
|
+
dataStyles: {},
|
|
45
|
+
});
|
|
46
|
+
expect(html.innerHTML).toContain('<thead>');
|
|
47
|
+
expect(html.innerHTML).toContain(rendered);
|
|
48
|
+
// console.log(html.innerHTML);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const [describe, databases] = (0, util_1.describeIfDatabaseAvailable)([
|
|
52
|
+
'bigquery',
|
|
53
|
+
'postgres',
|
|
54
|
+
'duckdb',
|
|
55
|
+
]);
|
|
56
|
+
describe('rendering results', () => {
|
|
57
|
+
const runtimes = new runtimes_1.RuntimeList(databases);
|
|
58
|
+
afterAll(async () => {
|
|
59
|
+
await runtimes.closeAll();
|
|
60
|
+
});
|
|
61
|
+
test('can render table', async () => {
|
|
62
|
+
const runtime = runtimes.runtimeMap.get('bigquery');
|
|
63
|
+
expect(runtime).toBeDefined();
|
|
64
|
+
if (runtime) {
|
|
65
|
+
const src = `
|
|
66
|
+
query: table('malloy-data.faa.flights') -> {
|
|
67
|
+
group_by: carrier
|
|
68
|
+
aggregate: flight_count is count()
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const result = await runtime.loadQuery(src).run();
|
|
72
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
73
|
+
await new render_1.HTMLView(document).render(result, {
|
|
74
|
+
dataStyles: {},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
test('can render unsupported bigquery geo types', async () => {
|
|
79
|
+
await runUnsupportedRenderTest('bigquery', runtimes, "ST_GEOGFROMTEXT('LINESTRING(1 2, 3 4)')", 'LINESTRING(1 2, 3 4)');
|
|
80
|
+
});
|
|
81
|
+
test('can render unsupported bigquery ip types', async () => {
|
|
82
|
+
await runUnsupportedRenderTest('bigquery', runtimes, "NET.IP_FROM_STRING('192.168.1.1')", '{"type":"Buffer","data":[192,168,1,1]}');
|
|
83
|
+
});
|
|
84
|
+
test('can render unsupported bigquery interval types', async () => {
|
|
85
|
+
await runUnsupportedRenderTest('bigquery', runtimes, 'INTERVAL 1 YEAR', '1-0 0 0:0:0');
|
|
86
|
+
});
|
|
87
|
+
test('can render unsupported bigquery time types', async () => {
|
|
88
|
+
await runUnsupportedRenderTest('bigquery', runtimes, 'TIME(10, 10, 1)', '10:10:01');
|
|
89
|
+
});
|
|
90
|
+
test('can render unsupported postgres interval types', async () => {
|
|
91
|
+
await runUnsupportedRenderTest('postgres', runtimes, 'make_interval(days => 12)', '12 days');
|
|
92
|
+
});
|
|
93
|
+
test('can render unsupported postgres uuid types', async () => {
|
|
94
|
+
await runUnsupportedRenderTest('postgres', runtimes, "CAST('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11' AS UUID)", 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11');
|
|
95
|
+
});
|
|
96
|
+
test('can render unsupported postgres inet types', async () => {
|
|
97
|
+
await runUnsupportedRenderTest('postgres', runtimes, "'192.168.1.1'::inet", '192.168.1.1');
|
|
98
|
+
});
|
|
99
|
+
test('can render unsupported postgres macaddr types', async () => {
|
|
100
|
+
await runUnsupportedRenderTest('postgres', runtimes, "'00:04:E2:36:95:C0'::macaddr", '00:04:e2:36:95:c0');
|
|
101
|
+
});
|
|
102
|
+
test('can render supported postgres types', async () => {
|
|
103
|
+
await runUnsupportedRenderTest('postgres', runtimes, '12345', '12,345');
|
|
104
|
+
});
|
|
105
|
+
test('can render supported duckdb types', async () => {
|
|
106
|
+
await runUnsupportedRenderTest('duckdb', runtimes, '12345', '12,345');
|
|
107
|
+
});
|
|
108
|
+
test('can render unsupported duckdb blob types', async () => {
|
|
109
|
+
await runUnsupportedRenderTest('duckdb', runtimes, "'\\xAA'::BLOB", '{"type":"Buffer","data":[170]}');
|
|
110
|
+
});
|
|
111
|
+
test('can render unsupported duckdb uuid types', async () => {
|
|
112
|
+
await runUnsupportedRenderTest('duckdb', runtimes, "'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::UUID", 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11');
|
|
113
|
+
});
|
|
114
|
+
test('can render null unsupported types', async () => {
|
|
115
|
+
await runUnsupportedRenderTest('bigquery', runtimes, 'CAST(NULL AS GEOGRAPHY)', '<span class="value-null">∅</span>');
|
|
116
|
+
});
|
|
117
|
+
describe('html renderer', () => {
|
|
118
|
+
describe('complex query with tags', () => {
|
|
119
|
+
let model;
|
|
120
|
+
beforeAll(async () => {
|
|
121
|
+
const connectionName = 'duckdb';
|
|
122
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
123
|
+
expect(runtime).toBeDefined();
|
|
124
|
+
const src = `
|
|
125
|
+
sql: names_sql is { connection: "duckdb" select: """SELECT 'Pedro' as nm
|
|
126
|
+
UNION ALL SELECT 'Sebastian'
|
|
127
|
+
UNION ALL SELECT 'Alex'
|
|
128
|
+
UNION ALL SELECT 'Miguel'""" }
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
sql: height_sql is { connection: "duckdb" select: """SELECT 'Pedro' as nm, 1 as monthy, 20 as height, 3 as wt, 50 apptcost, 1 as vaccine
|
|
132
|
+
UNION ALL SELECT 'Pedro', 2, 25, 3.4, 100, 1
|
|
133
|
+
UNION ALL SELECT 'Pedro', 3, 38, 3.6, 200, 0
|
|
134
|
+
UNION ALL SELECT 'Pedro', 4, 45, 3.7, 300, 1
|
|
135
|
+
UNION ALL SELECT 'Sebastian', 1, 23, 2, 400, 1
|
|
136
|
+
UNION ALL SELECT 'Sebastian', 2, 28, 2.6, 500, 1
|
|
137
|
+
UNION ALL SELECT 'Sebastian', 3, 35, 3.6, 650, 0
|
|
138
|
+
UNION ALL SELECT 'Sebastian', 4, 47, 4.2, 70, 1
|
|
139
|
+
UNION ALL SELECT 'Alex', 1, 23, 2.5, 85, 0
|
|
140
|
+
UNION ALL SELECT 'Alex', 2, 28, 3, 42, 1
|
|
141
|
+
UNION ALL SELECT 'Alex', 3, 35, 3.2, 63, 1
|
|
142
|
+
UNION ALL SELECT 'Alex', 4, 47, 3.4, 81, 1
|
|
143
|
+
UNION ALL SELECT 'Miguel', 1, 23, 4, 34, 0
|
|
144
|
+
UNION ALL SELECT 'Miguel', 2, 28, 4.1, 64, 1
|
|
145
|
+
UNION ALL SELECT 'Miguel', 3, 35, 4.2, 31, 1
|
|
146
|
+
UNION ALL SELECT 'Miguel', 4, 47, 4.3, 76, 0 """ }
|
|
147
|
+
|
|
148
|
+
source: height
|
|
149
|
+
# line_chart
|
|
150
|
+
is from_sql(height_sql) + {
|
|
151
|
+
|
|
152
|
+
query: by_name is {
|
|
153
|
+
group_by: nm
|
|
154
|
+
nest: height_by_age
|
|
155
|
+
# line_chart
|
|
156
|
+
is {
|
|
157
|
+
project: monthy, height
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
nest: weight_by_age_bar_chart is {
|
|
161
|
+
project: monthy, wt
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
aggregate:
|
|
165
|
+
# currency
|
|
166
|
+
price is sum(apptcost)
|
|
167
|
+
# percent
|
|
168
|
+
visitcount is sum(vaccine) / count()
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
query: by_name is height -> by_name {
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
# transpose
|
|
176
|
+
query: by_name_transposed is height -> by_name {
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
source: names is from_sql(names_sql) + {
|
|
180
|
+
join_many: height on nm = height.nm
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
model = await runtime.loadModel(src);
|
|
184
|
+
});
|
|
185
|
+
test('regular table', async () => {
|
|
186
|
+
const result = await model.loadQueryByName('by_name').run();
|
|
187
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
188
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
189
|
+
dataStyles: {},
|
|
190
|
+
});
|
|
191
|
+
expect(html).toMatchSnapshot();
|
|
192
|
+
});
|
|
193
|
+
test('transposed table', async () => {
|
|
194
|
+
const result = await model.loadQueryByName('by_name_transposed').run();
|
|
195
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
196
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
197
|
+
dataStyles: {},
|
|
198
|
+
});
|
|
199
|
+
expect(html).toMatchSnapshot();
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
describe('hidden tags', () => {
|
|
203
|
+
let modelMaterializer;
|
|
204
|
+
beforeAll(() => {
|
|
205
|
+
const connectionName = 'duckdb';
|
|
206
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
207
|
+
expect(runtime).toBeDefined();
|
|
208
|
+
const src = `
|
|
209
|
+
sql: height_sql is { connection: "duckdb" select: """
|
|
210
|
+
SELECT 'Pedro' as nm, 1 as monthy, 20 as height, 3 as wt, 50 apptcost, 1 as vaccine
|
|
211
|
+
UNION ALL SELECT 'Pedro', 2, 25, 3.4, 100, 1
|
|
212
|
+
UNION ALL SELECT 'Sebastian', 1, 23, 2, 400, 1
|
|
213
|
+
UNION ALL SELECT 'Sebastian', 2, 28, 2.6, 500, 1 """ }
|
|
214
|
+
|
|
215
|
+
source: height
|
|
216
|
+
# line_chart
|
|
217
|
+
is from_sql(height_sql) + {
|
|
218
|
+
|
|
219
|
+
measure: visitcount is sum(vaccine) / count();
|
|
220
|
+
|
|
221
|
+
# currency
|
|
222
|
+
# hidden
|
|
223
|
+
dimension: price is apptcost
|
|
224
|
+
|
|
225
|
+
query: by_name is {
|
|
226
|
+
group_by: nm
|
|
227
|
+
order_by: nm
|
|
228
|
+
nest: height_by_age
|
|
229
|
+
is {
|
|
230
|
+
project:
|
|
231
|
+
# hidden
|
|
232
|
+
monthy,
|
|
233
|
+
height
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# hidden
|
|
237
|
+
nest: height_by_age_hidden
|
|
238
|
+
is {
|
|
239
|
+
project: monthy, height
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
# list
|
|
243
|
+
nest: monthy is {
|
|
244
|
+
project: price
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
aggregate:
|
|
248
|
+
visitcount
|
|
249
|
+
# hidden
|
|
250
|
+
noshowvc is visitcount
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
# dashboard
|
|
254
|
+
query: by_name_db is by_name {}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
query: by_name is height -> by_name {}
|
|
258
|
+
query: by_name_db is height -> by_name_db {}
|
|
259
|
+
`;
|
|
260
|
+
modelMaterializer = runtime.loadModel(src);
|
|
261
|
+
});
|
|
262
|
+
test('rendered correctly table', async () => {
|
|
263
|
+
const result = await modelMaterializer.loadQueryByName('by_name').run();
|
|
264
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
265
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
266
|
+
dataStyles: {},
|
|
267
|
+
});
|
|
268
|
+
expect(html).toMatchSnapshot();
|
|
269
|
+
});
|
|
270
|
+
test('rendered correctly dashboard', async () => {
|
|
271
|
+
const result = await modelMaterializer
|
|
272
|
+
.loadQueryByName('by_name_db')
|
|
273
|
+
.run();
|
|
274
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
275
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
276
|
+
dataStyles: {},
|
|
277
|
+
});
|
|
278
|
+
expect(html).toMatchSnapshot();
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
test('pivot table renders correctly', async () => {
|
|
282
|
+
const connectionName = 'duckdb';
|
|
283
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
284
|
+
expect(runtime).toBeDefined();
|
|
285
|
+
const src = `
|
|
286
|
+
sql: height_sql is { connection: "${connectionName}" select: """SELECT 'Pedro' as nm, 'Monday' as dayito, 1 as loc, 2 as lac, 1 as monthy, 20 as height, 3 as wt, 50 apptcost, 1 as vaccine, 'A' as btype
|
|
287
|
+
UNION ALL SELECT 'Pedro', 'Tuesday', 1, 2, 2, 25, 3.4, 100, 1, 'B'
|
|
288
|
+
UNION ALL SELECT 'Pedro', 'Tuesday', 1, 2, 3, 38, 3.6, 200, 0, 'A'
|
|
289
|
+
UNION ALL SELECT 'Pedro', 'Wednesday', 1, 2, 4, 45, 3.7, 300, 1, 'O'
|
|
290
|
+
UNION ALL SELECT 'Sebastian', 'Thursday', 1, 2, 1, 23, 2, 400, 1, 'C'
|
|
291
|
+
UNION ALL SELECT 'Sebastian', 'Thursday', 1, 2, 2, 28, 2.6, 500, 1, 'A'
|
|
292
|
+
UNION ALL SELECT 'Sebastian', 'Monday', 1, 2, 3, 35, 3.6, 650, 0, 'A'
|
|
293
|
+
UNION ALL SELECT 'Sebastian', 'Monday', 1, 2, 4, 47, 4.2, 70, 1, 'B'
|
|
294
|
+
UNION ALL SELECT 'Alex', 'Tuesday', 1, 2, 1, 23, 2.5, 85, 0, 'X'
|
|
295
|
+
UNION ALL SELECT 'Alex', 'Thursday', 1, 2, 2, 28, 3, 42, 1, 'P'
|
|
296
|
+
UNION ALL SELECT 'Alex', 'Thursday', 1, 2, 3, 35, 3.2, 63, 1, 'A'
|
|
297
|
+
UNION ALL SELECT 'Alex', 'Monday', 1, 2, 4, 47, 3.4, 81, 1, 'D'
|
|
298
|
+
UNION ALL SELECT 'Miguel', 'Monday', 1, 2, 1, 23, 4, 34, 0, 'E'
|
|
299
|
+
UNION ALL SELECT 'Miguel', 'Monday', 1, 2, 2, 28, 4.1, 64, 1, 'R'
|
|
300
|
+
UNION ALL SELECT 'Miguel', 'Wednesday', 1, 2, 3, 35, 4.2, 31, 1, 'E'
|
|
301
|
+
UNION ALL SELECT 'Miguel', 'Wednesday', 1, 2, 4, 47, 4.3, 76, 0, 'F' """ }
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
source: height
|
|
305
|
+
is from_sql(height_sql) + {
|
|
306
|
+
|
|
307
|
+
# percent
|
|
308
|
+
dimension: flac is lac
|
|
309
|
+
|
|
310
|
+
# currency
|
|
311
|
+
dimension: floc is loc
|
|
312
|
+
|
|
313
|
+
query: by_name is {
|
|
314
|
+
group_by: nm
|
|
315
|
+
# pivot pivot_dimensions="dayito"
|
|
316
|
+
nest: pivot_f is {
|
|
317
|
+
group_by: dayito
|
|
318
|
+
aggregate:
|
|
319
|
+
ht is avg(height),
|
|
320
|
+
price is sum(apptcost)
|
|
321
|
+
mbtype is max(btype)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
aggregate: pricepu is sum(apptcost)
|
|
325
|
+
# pivot
|
|
326
|
+
nest: pivot_f2 is {
|
|
327
|
+
group_by: floc, flac
|
|
328
|
+
aggregate:
|
|
329
|
+
ht is avg(height)
|
|
330
|
+
price is sum(apptcost)
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
query: by_name is height -> by_name {}
|
|
336
|
+
`;
|
|
337
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('by_name')).run();
|
|
338
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
339
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
340
|
+
dataStyles: {},
|
|
341
|
+
});
|
|
342
|
+
expect(html).toMatchSnapshot();
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
describe('date renderer', () => {
|
|
346
|
+
test('date with timezone rendered correctly', async () => {
|
|
347
|
+
const connectionName = 'duckdb';
|
|
348
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
349
|
+
expect(runtime).toBeDefined();
|
|
350
|
+
const src = `sql: one is { connection: "${connectionName}" select: """SELECT 1"""}
|
|
351
|
+
query: mex_query is from_sql(one) -> {
|
|
352
|
+
timezone: 'America/Mexico_City'
|
|
353
|
+
project: mex_time is @2021-02-24 03:05:06
|
|
354
|
+
}
|
|
355
|
+
`;
|
|
356
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('mex_query')).run();
|
|
357
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
358
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
359
|
+
dataStyles: {},
|
|
360
|
+
});
|
|
361
|
+
expect(html).toMatchSnapshot();
|
|
362
|
+
});
|
|
363
|
+
test('truncated date no explicit timezone rendered correctly', async () => {
|
|
364
|
+
const connectionName = 'duckdb';
|
|
365
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
366
|
+
expect(runtime).toBeDefined();
|
|
367
|
+
const src = `
|
|
368
|
+
sql: timeDataTrunc is { connection: "duckdb" select: """
|
|
369
|
+
SELECT CAST('2021-12-11 10:20:00' AS datetime) as times
|
|
370
|
+
UNION ALL SELECT CAST('2021-01-01 05:40:00' AS datetime)
|
|
371
|
+
UNION ALL SELECT CAST('2021-04-01 00:59:00' AS datetime)"""}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
query:
|
|
375
|
+
data_trunc is from_sql(timeDataTrunc) -> {
|
|
376
|
+
project: yr is times.year, qt is times.quarter, mt is times.month, dy is times.day
|
|
377
|
+
}
|
|
378
|
+
`;
|
|
379
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('data_trunc')).run();
|
|
380
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
381
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
382
|
+
dataStyles: {},
|
|
383
|
+
});
|
|
384
|
+
expect(html).toMatchSnapshot();
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
describe('bar chart renderer', () => {
|
|
388
|
+
test('date with timezone rendered correctly', async () => {
|
|
389
|
+
const connectionName = 'duckdb';
|
|
390
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
391
|
+
expect(runtime).toBeDefined();
|
|
392
|
+
const src = `sql: one is { connection: "${connectionName}" select: """SELECT 1"""}
|
|
393
|
+
query: mex_query
|
|
394
|
+
# bar_chart
|
|
395
|
+
is from_sql(one) -> {
|
|
396
|
+
timezone: 'America/Mexico_City'
|
|
397
|
+
project: mex_time is @2021-02-24 03:05:06
|
|
398
|
+
}
|
|
399
|
+
`;
|
|
400
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('mex_query')).run();
|
|
401
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
402
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
403
|
+
dataStyles: {},
|
|
404
|
+
});
|
|
405
|
+
expect(html).toMatchSnapshot();
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
describe('point map renderer', () => {
|
|
409
|
+
test('date with timezone rendered correctly', async () => {
|
|
410
|
+
const connectionName = 'duckdb';
|
|
411
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
412
|
+
expect(runtime).toBeDefined();
|
|
413
|
+
const src = `sql: timeData is { connection: "${connectionName}" select: """
|
|
414
|
+
SELECT 43.839187 as latitude, -113.849795 as longitude, CAST('2021-11-10' AS datetime) as times, 200 as size
|
|
415
|
+
UNION ALL SELECT 32.8647113, -117.1998042, CAST('2021-11-12' AS datetime), 400 as size"""}
|
|
416
|
+
|
|
417
|
+
query: mexico_point_map is from_sql(timeData) -> {
|
|
418
|
+
timezone: 'America/Mexico_City'
|
|
419
|
+
group_by: latitude, longitude, times
|
|
420
|
+
aggregate:
|
|
421
|
+
sizeSum is sum(size)
|
|
422
|
+
}`;
|
|
423
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('mexico_point_map')).run();
|
|
424
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
425
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
426
|
+
dataStyles: {},
|
|
427
|
+
});
|
|
428
|
+
expect(html).toMatchSnapshot();
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
describe('number renderer', () => {
|
|
432
|
+
test('value format tags works correctly', async () => {
|
|
433
|
+
const connectionName = 'duckdb';
|
|
434
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
435
|
+
expect(runtime).toBeDefined();
|
|
436
|
+
const src = `
|
|
437
|
+
sql: number_sql is { connection: "${connectionName}" select: """SELECT 12.345 as anumber""" }
|
|
438
|
+
|
|
439
|
+
query: number_query is from_sql(number_sql) -> {
|
|
440
|
+
project:
|
|
441
|
+
anumber
|
|
442
|
+
# number= "#,##0.0000"
|
|
443
|
+
larger is anumber
|
|
444
|
+
# number= "#,##0.00"
|
|
445
|
+
shorter is anumber
|
|
446
|
+
}
|
|
447
|
+
`;
|
|
448
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('number_query')).run();
|
|
449
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
450
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
451
|
+
dataStyles: {},
|
|
452
|
+
});
|
|
453
|
+
expect(html).toMatchSnapshot();
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
describe('data volume renderer', () => {
|
|
457
|
+
test('data volume tags works correctly', async () => {
|
|
458
|
+
const connectionName = 'duckdb';
|
|
459
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
460
|
+
expect(runtime).toBeDefined();
|
|
461
|
+
const src = `
|
|
462
|
+
sql: number_sql is { connection: "${connectionName}" select: """SELECT 1""" }
|
|
463
|
+
|
|
464
|
+
query: bytes_query is from_sql(number_sql) -> {
|
|
465
|
+
project:
|
|
466
|
+
# data_volume = bytes
|
|
467
|
+
usage_b is 3758
|
|
468
|
+
# data_volume = kb
|
|
469
|
+
usage_kb is 3758
|
|
470
|
+
# data_volume = mb
|
|
471
|
+
usage_mb is 3758096
|
|
472
|
+
# data_volume = gb
|
|
473
|
+
usage_gb is 3758096384
|
|
474
|
+
# data_volume = tb
|
|
475
|
+
usage_tb is 3758096384000
|
|
476
|
+
}
|
|
477
|
+
`;
|
|
478
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('bytes_query')).run();
|
|
479
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
480
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
481
|
+
dataStyles: {},
|
|
482
|
+
});
|
|
483
|
+
expect(html).toMatchSnapshot();
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
describe('duration renderer', () => {
|
|
487
|
+
test('duration tags works correctly', async () => {
|
|
488
|
+
const connectionName = 'duckdb';
|
|
489
|
+
const runtime = runtimes.runtimeMap.get(connectionName);
|
|
490
|
+
expect(runtime).toBeDefined();
|
|
491
|
+
const src = `
|
|
492
|
+
sql: number_sql is { connection: "${connectionName}" select: """SELECT 1""" }
|
|
493
|
+
|
|
494
|
+
query: duration_query is from_sql(number_sql) -> {
|
|
495
|
+
project:
|
|
496
|
+
# duration = nanoseconds
|
|
497
|
+
ns1 is 1
|
|
498
|
+
# duration = nanoseconds
|
|
499
|
+
ns2 is 1002
|
|
500
|
+
# duration = nanoseconds
|
|
501
|
+
ns3 is 1002003
|
|
502
|
+
# duration = microseconds
|
|
503
|
+
mis1 is 1
|
|
504
|
+
# duration = microseconds
|
|
505
|
+
mis2 is 1002
|
|
506
|
+
# duration = microseconds
|
|
507
|
+
mis3 is 1002003
|
|
508
|
+
# duration = milliseconds
|
|
509
|
+
ms1 is 1
|
|
510
|
+
# duration = milliseconds
|
|
511
|
+
ms2 is 1002
|
|
512
|
+
# duration = milliseconds
|
|
513
|
+
ms3 is 1002003
|
|
514
|
+
# duration = seconds
|
|
515
|
+
s1 is 1
|
|
516
|
+
# duration = seconds
|
|
517
|
+
s2 is 61
|
|
518
|
+
# duration = seconds
|
|
519
|
+
s3 is 121
|
|
520
|
+
# duration = seconds
|
|
521
|
+
s4 is 3610
|
|
522
|
+
# duration = seconds
|
|
523
|
+
s5 is 1728015
|
|
524
|
+
# duration = minutes
|
|
525
|
+
m1 is 1
|
|
526
|
+
# duration = minutes
|
|
527
|
+
m2 is 62
|
|
528
|
+
# duration = minutes
|
|
529
|
+
m3 is 1445
|
|
530
|
+
# duration = hours
|
|
531
|
+
h1 is 1
|
|
532
|
+
# duration = hours
|
|
533
|
+
h2 is 26
|
|
534
|
+
# duration = hours
|
|
535
|
+
h3 is 48
|
|
536
|
+
# duration = days
|
|
537
|
+
d1 is 1
|
|
538
|
+
# duration = days
|
|
539
|
+
d2 is 300
|
|
540
|
+
}
|
|
541
|
+
`;
|
|
542
|
+
const result = await (await runtime.loadModel(src).loadQueryByName('duration_query')).run();
|
|
543
|
+
const document = new jsdom_1.JSDOM().window.document;
|
|
544
|
+
const html = await new render_1.HTMLView(document).render(result, {
|
|
545
|
+
dataStyles: {},
|
|
546
|
+
});
|
|
547
|
+
expect(html).toMatchSnapshot();
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
//# sourceMappingURL=render.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.spec.js","sourceRoot":"","sources":["../../src/render/render.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;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,CAAC,WAAW,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG;4CAC0B,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDnD,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,CACnB,MAAM,OAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAChE,CAAC,GAAG,EAAE,CAAC;YACR,MAAM,QAAQ,GAAG,IAAI,aAAK,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,iBAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE;gBACvD,UAAU,EAAE,EAAE;aACf,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Connection, MalloyQueryData, QueryDataRow, Result, RunSQLOptions, SingleConnectionRuntime } from '@malloydata/malloy';
|
|
2
|
+
import { BigQueryConnection } from '@malloydata/db-bigquery';
|
|
3
|
+
import { DuckDBConnection } from '@malloydata/db-duckdb';
|
|
4
|
+
import { DuckDBWASMConnection } from '@malloydata/db-duckdb/wasm';
|
|
5
|
+
import { PooledPostgresConnection } from '@malloydata/db-postgres';
|
|
6
|
+
export declare class BigQueryTestConnection extends BigQueryConnection {
|
|
7
|
+
runSQL(sqlCommand: string, options?: RunSQLOptions): Promise<MalloyQueryData>;
|
|
8
|
+
}
|
|
9
|
+
export declare class PostgresTestConnection extends PooledPostgresConnection {
|
|
10
|
+
runSQL(sqlCommand: string, options?: RunSQLOptions): Promise<MalloyQueryData>;
|
|
11
|
+
}
|
|
12
|
+
export declare class DuckDBTestConnection extends DuckDBConnection {
|
|
13
|
+
constructor(name: string);
|
|
14
|
+
runSQL(sqlCommand: string, options?: RunSQLOptions): Promise<MalloyQueryData>;
|
|
15
|
+
}
|
|
16
|
+
export declare class DuckDBWASMTestConnection extends DuckDBWASMConnection {
|
|
17
|
+
constructor(name: string);
|
|
18
|
+
runSQL(sqlCommand: string, options?: RunSQLOptions): Promise<MalloyQueryData>;
|
|
19
|
+
}
|
|
20
|
+
export declare function rows(qr: Result): QueryDataRow[];
|
|
21
|
+
export declare function runtimeFor(dbName: string): SingleConnectionRuntime;
|
|
22
|
+
export declare function testRuntimeFor(connection: Connection): SingleConnectionRuntime<Connection>;
|
|
23
|
+
export declare const allDatabases: string[];
|
|
24
|
+
declare type RuntimeDatabaseNames = typeof allDatabases[number];
|
|
25
|
+
export declare class RuntimeList {
|
|
26
|
+
runtimeMap: Map<string, SingleConnectionRuntime<Connection>>;
|
|
27
|
+
runtimeList: Array<[string, SingleConnectionRuntime]>;
|
|
28
|
+
constructor();
|
|
29
|
+
constructor(databaseList: RuntimeDatabaseNames[]);
|
|
30
|
+
constructor(externalConnections: SingleConnectionRuntime[]);
|
|
31
|
+
closeAll(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|