Skip to content

Commit 4d56d7e

Browse files
committed
update tests
1 parent 47a3389 commit 4d56d7e

File tree

2 files changed

+30
-39
lines changed

2 files changed

+30
-39
lines changed

src/tests/__snapshots__/query.test.ts.snap

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,28 @@ Array [
387387

388388
exports[`boilingdata with DuckDB run single query with scan cursor over the size 1`] = `Array []`;
389389

390+
exports[`boilingdata with Glue Tables can do partition filter push down 1`] = `
391+
Array [
392+
Object {
393+
"status": "Catalog Error: Table with name nyctaxis does not exist!
394+
Did you mean \\"temp.information_schema.tables\\"?
395+
LINE 1: SELECT * FROM \\"default\\".nyctaxis WHERE year = 2009 AN...
396+
^",
397+
},
398+
]
399+
`;
400+
401+
exports[`boilingdata with Glue Tables can read S3 object paths from Glue Table 1`] = `
402+
Array [
403+
Object {
404+
"status": "Catalog Error: Table with name nyctaxis does not exist!
405+
Did you mean \\"system.information_schema.tables\\"?
406+
LINE 1: SELECT * FROM \\"default\\".nyctaxis LIMIT 10;
407+
^",
408+
},
409+
]
410+
`;
411+
390412
exports[`boilingdata with promise method can run simple promise based query 1`] = `
391413
Array [
392414
Object {

src/tests/query.test.ts

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ const username = process.env["BD_USERNAME"];
1111
const password = process.env["BD_PASSWORD"];
1212
if (!password || !username) throw new Error("Set BD_USERNAME and BD_PASSWORD envs");
1313

14-
function waitAfterClose(): Promise<void> {
15-
return new Promise(resolve => setTimeout(resolve, 1000));
16-
}
17-
1814
const globalCallbacks = globalCallbacksList
1915
.map((cb: string) => ({ [cb]: (d: unknown) => logger.info(d) }))
2016
.reduce((obj, item) => ({ ...obj, ...item }), {});
@@ -28,20 +24,13 @@ let bdInstance: BoilingData; // = new BoilingData({ username, password, globalC
2824

2925
describe("boilingdata with DuckDB", () => {
3026
beforeAll(async () => {
31-
bdInstance = new BoilingData({
32-
username,
33-
password,
34-
globalCallbacks,
35-
logLevel,
36-
endpointUrl: "wss://4rpyi2ae3f.execute-api.eu-west-1.amazonaws.com/prodbd/",
37-
});
27+
bdInstance = new BoilingData({ username, password, globalCallbacks, logLevel });
3828
await bdInstance.connect();
3929
logger.info("connected.");
4030
});
4131

4232
afterAll(async () => {
4333
await bdInstance.close();
44-
await waitAfterClose();
4534
logger.info("connection closed.");
4635
});
4736

@@ -93,7 +82,6 @@ describe.skip("boilingdata with SQLite3", () => {
9382

9483
afterAll(async () => {
9584
await bdInstance.close();
96-
await waitAfterClose();
9785
logger.info("connection closed.");
9886
});
9987

@@ -123,7 +111,6 @@ describe("boilingdata with promise method", () => {
123111

124112
afterAll(async () => {
125113
await bdInstance.close();
126-
await waitAfterClose();
127114
logger.info("connection closed.");
128115
});
129116

@@ -143,15 +130,14 @@ describe.skip("boilingdata with Glue Tables", () => {
143130

144131
afterAll(async () => {
145132
await bdInstance.close();
146-
await waitAfterClose();
147133
logger.info("connection closed.");
148134
});
149135

150136
it("can read S3 object paths from Glue Table", async () => {
151137
const rows = await new Promise<any[]>((resolve, _reject) => {
152138
const r: any[] = [];
153139
bdInstance.execQuery({
154-
sql: `SELECT * FROM glue.default.nyctaxis LIMIT 10;`,
140+
sql: `SELECT * FROM glue('default.flights_parquet') LIMIT 10;`,
155141
callbacks: {
156142
onData: (data: IBDDataResponse | unknown) => {
157143
if (isDataResponse(data)) data.data.map(row => r.push(row));
@@ -191,7 +177,6 @@ describe("BoilingData with S3 folders", () => {
191177

192178
afterAll(async () => {
193179
await bdInstance.close();
194-
await waitAfterClose();
195180
logger.info("connection closed.");
196181
});
197182

@@ -201,14 +186,14 @@ describe("BoilingData with S3 folders", () => {
201186
expect(rows).toMatchSnapshot();
202187
});
203188

204-
it.skip("query over folder with 80 gz.parquet files", async () => {
189+
it("query over folder with 80 gz.parquet files", async () => {
205190
// s3://isecurefi-serverless-analytics/NY-Pub/year=2009/month=12/type=yellow/
206191
const sql = `SELECT COUNT(*) FROM parquet_scan('s3://boilingdata-demo/test_folder2/');`;
207192
const rows = await bdInstance.execQueryPromise({ sql });
208193
expect(rows).toMatchInlineSnapshot(`
209194
Array [
210195
Object {
211-
"count_star()": 29166808,
196+
"count": 29166808,
212197
},
213198
]
214199
`);
@@ -227,21 +212,6 @@ describe("BoilingData with S3 folders", () => {
227212
`);
228213
});
229214

230-
it("query over example file without splitAccess", async () => {
231-
const rows = await bdInstance.execQueryPromise({
232-
splitAccess: false,
233-
splitSizeMB: 300,
234-
sql: `SELECT COUNT(*) AS splitAccess FROM parquet_scan('s3://boilingdata-demo/demo2.parquet');`,
235-
});
236-
expect(rows.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))).toMatchInlineSnapshot(`
237-
Array [
238-
Object {
239-
"splitaccess": 28160000,
240-
},
241-
]
242-
`);
243-
});
244-
245215
it("2x query over same example file", async () => {
246216
// s3://isecurefi-serverless-analytics/NY-Pub/year=2009/month=12/type=yellow/
247217
const sql = `SELECT COUNT(*) FROM ( SELECT * FROM parquet_scan('s3://boilingdata-demo/test_folder2/part-r-00426-6e222bd6-47be-424a-a29a-606961a23de1.gz.parquet') UNION ALL SELECT * FROM parquet_scan('s3://boilingdata-demo/test_folder2/part-r-00426-6e222bd6-47be-424a-a29a-606961a23de1.gz.parquet')) a;`;
@@ -255,27 +225,27 @@ describe("BoilingData with S3 folders", () => {
255225
`);
256226
});
257227

258-
it.skip("2x query over folder with 80 gz.parquet files (mem caching)", async () => {
228+
it("2x query over folder with 80 gz.parquet files (mem caching)", async () => {
259229
// s3://isecurefi-serverless-analytics/NY-Pub/year=2009/month=12/type=yellow/
260230
const sql = `SELECT COUNT(*) FROM ( SELECT * FROM parquet_scan('s3://boilingdata-demo/test_folder2/') UNION ALL SELECT * FROM parquet_scan('s3://boilingdata-demo/test_folder2/')) a;`;
261231
const rows = await bdInstance.execQueryPromise({ sql });
262232
expect(rows.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))).toMatchInlineSnapshot(`
263233
Array [
264234
Object {
265-
"count_star()": 58333616,
235+
"count": 58333616,
266236
},
267237
]
268238
`);
269239
});
270240

271-
it.skip("query over folder with 80 gz.parquet files (mem cached)", async () => {
241+
it("query over folder with 80 gz.parquet files (mem cached)", async () => {
272242
// s3://isecurefi-serverless-analytics/NY-Pub/year=2009/month=12/type=yellow/
273243
const sql = `SELECT COUNT(*) FROM parquet_scan('s3://boilingdata-demo/test_folder2/');`;
274244
const rows = await bdInstance.execQueryPromise({ sql });
275245
expect(rows.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))).toMatchInlineSnapshot(`
276246
Array [
277247
Object {
278-
"count_star()": 29166808,
248+
"count": 29166808,
279249
},
280250
]
281251
`);
@@ -291,7 +261,6 @@ describe("BoilingData JS query hooks", () => {
291261

292262
afterAll(async () => {
293263
await bdInstance.close();
294-
await waitAfterClose();
295264
logger.info("connection closed.");
296265
});
297266

0 commit comments

Comments
 (0)