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