@milaboratories/pframes-rs-node 1.1.3 → 1.1.5

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.
Files changed (47) hide show
  1. package/README.md +3 -3
  2. package/export/addon-def.ts +27 -34
  3. package/export/addon.ts +6 -8
  4. package/export/dump.ts +37 -48
  5. package/export/export.ts +4 -6
  6. package/export/index.ts +2 -2
  7. package/export/node-pre-gyp.d.ts +1 -1
  8. package/export/tests/pframes.test.ts +247 -315
  9. package/export/tests/setup.ts +6 -15
  10. package/export/wrapper.ts +147 -212
  11. package/package.json +44 -42
  12. package/export_dist/addon-def.d.ts +0 -40
  13. package/export_dist/addon-def.d.ts.map +0 -1
  14. package/export_dist/addon.cjs +0 -24
  15. package/export_dist/addon.cjs.map +0 -1
  16. package/export_dist/addon.d.ts +0 -4
  17. package/export_dist/addon.d.ts.map +0 -1
  18. package/export_dist/addon.js +0 -21
  19. package/export_dist/addon.js.map +0 -1
  20. package/export_dist/dump.cjs +0 -115
  21. package/export_dist/dump.cjs.map +0 -1
  22. package/export_dist/dump.d.ts +0 -12
  23. package/export_dist/dump.d.ts.map +0 -1
  24. package/export_dist/dump.js +0 -107
  25. package/export_dist/dump.js.map +0 -1
  26. package/export_dist/export.cjs +0 -15
  27. package/export_dist/export.cjs.map +0 -1
  28. package/export_dist/export.d.ts +0 -3
  29. package/export_dist/export.d.ts.map +0 -1
  30. package/export_dist/export.js +0 -13
  31. package/export_dist/export.js.map +0 -1
  32. package/export_dist/index.cjs +0 -13
  33. package/export_dist/index.cjs.map +0 -1
  34. package/export_dist/index.d.ts +0 -3
  35. package/export_dist/index.d.ts.map +0 -1
  36. package/export_dist/index.js +0 -3
  37. package/export_dist/index.js.map +0 -1
  38. package/export_dist/tests/pframes.test.d.ts +0 -2
  39. package/export_dist/tests/pframes.test.d.ts.map +0 -1
  40. package/export_dist/tests/setup.d.ts +0 -2
  41. package/export_dist/tests/setup.d.ts.map +0 -1
  42. package/export_dist/wrapper.cjs +0 -542
  43. package/export_dist/wrapper.cjs.map +0 -1
  44. package/export_dist/wrapper.d.ts +0 -51
  45. package/export_dist/wrapper.d.ts.map +0 -1
  46. package/export_dist/wrapper.js +0 -539
  47. package/export_dist/wrapper.js.map +0 -1
@@ -1,26 +1,26 @@
1
1
  // Node.js core modules
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import process from 'node:process';
5
- import { tmpdir } from 'node:os';
6
- import type { Buffer } from 'node:buffer';
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
+ import { tmpdir } from "node:os";
6
+ import type { Buffer } from "node:buffer";
7
7
 
8
8
  // Testing framework
9
- import { describe, test } from 'vitest';
9
+ import { describe, test } from "vitest";
10
10
 
11
11
  // Project types and modules
12
- import type { PFrameInternal } from '@milaboratories/pl-model-middle-layer';
12
+ import type { PFrameInternal } from "@milaboratories/pl-model-middle-layer";
13
13
  import type {
14
14
  PObjectId,
15
15
  PTableColumnSpec,
16
16
  PTableSorting,
17
17
  PTableVector,
18
- QueryData,
19
- UniqueValuesResponse
20
- } from '@milaboratories/pl-model-common';
21
- import { PFrameFactory } from '..';
22
- import { PFrame } from '../wrapper';
23
- import { ulid } from 'ulid';
18
+ DataQuery,
19
+ UniqueValuesResponse,
20
+ } from "@milaboratories/pl-model-common";
21
+ import { PFrameFactory } from "..";
22
+ import { PFrame } from "../wrapper";
23
+ import { ulid } from "ulid";
24
24
 
25
25
  // ============================================================================
26
26
  // Test Utility Functions
@@ -30,8 +30,8 @@ import { ulid } from 'ulid';
30
30
  * Get the path to a test case directory
31
31
  */
32
32
  function getTestCaseDataPath(testCase: string): string {
33
- const currentDirectoryPath = path.relative('.', __dirname);
34
- const testDataPath = path.join(currentDirectoryPath, 'test_data');
33
+ const currentDirectoryPath = path.relative(".", __dirname);
34
+ const testDataPath = path.join(currentDirectoryPath, "test_data");
35
35
  return path.join(testDataPath, testCase);
36
36
  }
37
37
 
@@ -59,27 +59,21 @@ function readJsonTestFile(testCase: string, fileName: string): any {
59
59
  /**
60
60
  * Create a standard data source for tests that reads from test files
61
61
  */
62
- function createTestDataSource(
63
- testCase: string
64
- ): PFrameInternal.PFrameDataSourceV2 {
62
+ function createTestDataSource(testCase: string): PFrameInternal.PFrameDataSourceV2 {
65
63
  return {
66
- preloadBlob: function (
67
- blobIds: PFrameInternal.PFrameBlobId[]
68
- ): Promise<void> {
64
+ preloadBlob: function (blobIds: PFrameInternal.PFrameBlobId[]): Promise<void> {
69
65
  return new Promise((resolve) => {
70
66
  if (new Set(blobIds).size !== blobIds.length) {
71
- throw new Error('preload requires array of unique values');
67
+ throw new Error("preload requires array of unique values");
72
68
  }
73
69
  resolve();
74
70
  });
75
71
  },
76
- resolveBlobContent: function (
77
- blobId: PFrameInternal.PFrameBlobId
78
- ): Promise<Uint8Array> {
72
+ resolveBlobContent: function (blobId: PFrameInternal.PFrameBlobId): Promise<Uint8Array> {
79
73
  return new Promise((resolve) => {
80
74
  resolve(readTestFile(testCase, blobId));
81
75
  });
82
- }
76
+ },
83
77
  };
84
78
  }
85
79
 
@@ -89,8 +83,7 @@ function createTestDataSource(
89
83
  function createFailingDataSource(): PFrameInternal.PFrameDataSourceV2 {
90
84
  return {
91
85
  preloadBlob: (): Promise<void> => Promise.resolve(),
92
- resolveBlobContent: (): Promise<Uint8Array> =>
93
- Promise.reject(new Error('fail'))
86
+ resolveBlobContent: (): Promise<Uint8Array> => Promise.reject(new Error("fail")),
94
87
  };
95
88
  }
96
89
 
@@ -102,7 +95,7 @@ async function readPFrame(testCase: string): Promise<PFrame> {
102
95
  const dataSource = createTestDataSource(testCase);
103
96
  const pframe = PFrameFactory.createPFrame({
104
97
  frameId: ulid() as PFrameInternal.PFrameId,
105
- spillPath: tmpdir() /*, logger: console.log */
98
+ spillPath: tmpdir() /*, logger: console.log */,
106
99
  });
107
100
  pframe.setDataSource(dataSource);
108
101
 
@@ -110,12 +103,12 @@ async function readPFrame(testCase: string): Promise<PFrame> {
110
103
  const files = fs.readdirSync(testCasePath);
111
104
 
112
105
  for (const file of files) {
113
- if (file.endsWith('.spec')) {
114
- const columnId = file.replace('.spec', '') as PObjectId;
106
+ if (file.endsWith(".spec")) {
107
+ const columnId = file.replace(".spec", "") as PObjectId;
115
108
  const columnSpec = readJsonTestFile(testCase, file);
116
109
  pframe.addColumnSpec(columnId, columnSpec);
117
110
 
118
- const dataInfoFile = file.replace('.spec', '.datainfo');
111
+ const dataInfoFile = file.replace(".spec", ".datainfo");
119
112
  if (files.includes(dataInfoFile)) {
120
113
  const dataInfo = readJsonTestFile(testCase, dataInfoFile);
121
114
  await pframe.setColumnData(columnId, dataInfo);
@@ -130,18 +123,18 @@ async function readPFrame(testCase: string): Promise<PFrame> {
130
123
  // Test Suites
131
124
  // ============================================================================
132
125
 
133
- describe('PFrame Column Operations', () => {
134
- test.concurrent('find_columns_request', async ({ expect }) => {
135
- const testCase = 'find_columns_request';
126
+ describe("PFrame Column Operations", () => {
127
+ test.concurrent("find_columns_request", async ({ expect }) => {
128
+ const testCase = "find_columns_request";
136
129
 
137
- const columnId = 'column1' as PObjectId;
138
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
139
- const request = readJsonTestFile(testCase, 'request.json');
140
- const expectedResponse = readJsonTestFile(testCase, 'response.json');
130
+ const columnId = "column1" as PObjectId;
131
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
132
+ const request = readJsonTestFile(testCase, "request.json");
133
+ const expectedResponse = readJsonTestFile(testCase, "response.json");
141
134
 
142
135
  using pframe = PFrameFactory.createPFrame({
143
136
  frameId: ulid() as PFrameInternal.PFrameId,
144
- spillPath: tmpdir()
137
+ spillPath: tmpdir(),
145
138
  });
146
139
  pframe.addColumnSpec(columnId, columnSpec);
147
140
 
@@ -149,58 +142,56 @@ describe('PFrame Column Operations', () => {
149
142
  expect(actualResponse).toEqual(expectedResponse);
150
143
  });
151
144
 
152
- test.concurrent('get_column_spec_request', async ({ expect }) => {
153
- const testCase = 'get_column_spec_request';
145
+ test.concurrent("get_column_spec_request", async ({ expect }) => {
146
+ const testCase = "get_column_spec_request";
154
147
 
155
- const columnId = 'column1' as PObjectId;
156
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
157
- const expectedResponse = readJsonTestFile(testCase, 'response.json');
148
+ const columnId = "column1" as PObjectId;
149
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
150
+ const expectedResponse = readJsonTestFile(testCase, "response.json");
158
151
 
159
152
  using pframe = PFrameFactory.createPFrame({
160
153
  frameId: ulid() as PFrameInternal.PFrameId,
161
- spillPath: tmpdir()
154
+ spillPath: tmpdir(),
162
155
  });
163
156
  pframe.addColumnSpec(columnId, columnSpec);
164
157
 
165
158
  const actualResponse = await pframe.getColumnSpec(columnId);
166
159
  expect(actualResponse).toEqual(expectedResponse);
167
160
 
168
- const unknownColumnId = 'unknown_column1' as PObjectId;
161
+ const unknownColumnId = "unknown_column1" as PObjectId;
169
162
  const unknownColumnSpec = await pframe.getColumnSpec(unknownColumnId);
170
163
  expect(unknownColumnSpec).toBeNull();
171
164
 
172
165
  const columnList = await pframe.listColumns();
173
- expect(columnList).toEqual([
174
- { columnId: columnId, spec: columnSpec, hasData: false }
175
- ]);
166
+ expect(columnList).toEqual([{ columnId: columnId, spec: columnSpec, hasData: false }]);
176
167
  });
177
168
 
178
- test.concurrent('delete_column_request', async ({ expect }) => {
179
- const testCase = 'delete_column_request';
169
+ test.concurrent("delete_column_request", async ({ expect }) => {
170
+ const testCase = "delete_column_request";
180
171
 
181
- const request = readJsonTestFile(testCase, 'request.json');
182
- const expectedResponse = readJsonTestFile(testCase, 'response.json');
172
+ const request = readJsonTestFile(testCase, "request.json");
173
+ const expectedResponse = readJsonTestFile(testCase, "response.json");
183
174
 
184
175
  using pframe = PFrameFactory.createPFrame({
185
176
  frameId: ulid() as PFrameInternal.PFrameId,
186
- spillPath: tmpdir()
177
+ spillPath: tmpdir(),
187
178
  });
188
179
 
189
180
  const actualResponse = await pframe.deleteColumn(request);
190
181
  expect(actualResponse).toEqual(expectedResponse);
191
182
  });
192
183
 
193
- test.concurrent('set_column_data_request', async ({ expect }) => {
194
- const testCase = 'set_column_data_request';
184
+ test.concurrent("set_column_data_request", async ({ expect }) => {
185
+ const testCase = "set_column_data_request";
195
186
 
196
- const columnId = 'column1' as PObjectId;
197
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
198
- const dataInfo = readJsonTestFile(testCase, 'column.datainfo');
187
+ const columnId = "column1" as PObjectId;
188
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
189
+ const dataInfo = readJsonTestFile(testCase, "column.datainfo");
199
190
  const dataSource = createTestDataSource(testCase);
200
191
 
201
192
  using pframe = PFrameFactory.createPFrame({
202
193
  frameId: ulid() as PFrameInternal.PFrameId,
203
- spillPath: tmpdir()
194
+ spillPath: tmpdir(),
204
195
  });
205
196
  pframe.setDataSource(dataSource);
206
197
 
@@ -208,33 +199,31 @@ describe('PFrame Column Operations', () => {
208
199
  await pframe.setColumnData(columnId, dataInfo);
209
200
 
210
201
  const columnList = await pframe.listColumns();
211
- expect(columnList).toEqual([
212
- { columnId: columnId, spec: columnSpec, hasData: true }
213
- ]);
202
+ expect(columnList).toEqual([{ columnId: columnId, spec: columnSpec, hasData: true }]);
214
203
  });
215
204
 
216
- test.concurrent('unique_values_request', async ({ expect }) => {
217
- const testCase = 'unique_values_request';
205
+ test.concurrent("unique_values_request", async ({ expect }) => {
206
+ const testCase = "unique_values_request";
218
207
 
219
- const columnId = 'column' as PObjectId;
220
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
221
- const dataInfo = readJsonTestFile(testCase, 'column.datainfo');
208
+ const columnId = "column" as PObjectId;
209
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
210
+ const dataInfo = readJsonTestFile(testCase, "column.datainfo");
222
211
  const dataSource = createTestDataSource(testCase);
223
- const request = readJsonTestFile(testCase, 'request.json');
212
+ const request = readJsonTestFile(testCase, "request.json");
224
213
 
225
214
  const expectedResponse: UniqueValuesResponse = {
226
215
  values: {
227
- type: 'Long',
216
+ type: "Long",
228
217
  data: new BigInt64Array([BigInt(10), BigInt(11), BigInt(12)]),
229
218
  isNA: new Uint8Array(),
230
- absent: new Uint8Array()
219
+ absent: new Uint8Array(),
231
220
  },
232
- overflow: false
221
+ overflow: false,
233
222
  };
234
223
 
235
224
  using pframe = PFrameFactory.createPFrame({
236
225
  frameId: ulid() as PFrameInternal.PFrameId,
237
- spillPath: tmpdir()
226
+ spillPath: tmpdir(),
238
227
  });
239
228
  pframe.setDataSource(dataSource);
240
229
 
@@ -246,448 +235,394 @@ describe('PFrame Column Operations', () => {
246
235
  });
247
236
  });
248
237
 
249
- describe('PFrame Table Creation', () => {
238
+ describe("PFrame Table Creation", () => {
250
239
  // Expected responses for table creation tests
251
240
  const createTableExpectedResponses = {
252
241
  request1: [
253
242
  {
254
- type: 'Int' as const,
243
+ type: "Int" as const,
255
244
  data: new Int32Array([10]),
256
245
  isNA: new Uint8Array(),
257
- absent: new Uint8Array()
246
+ absent: new Uint8Array(),
258
247
  },
259
248
  {
260
- type: 'Float' as const,
249
+ type: "Float" as const,
261
250
  data: new Float32Array([10.0]),
262
251
  isNA: new Uint8Array(),
263
- absent: new Uint8Array()
264
- }
252
+ absent: new Uint8Array(),
253
+ },
265
254
  ] as PTableVector[],
266
255
  request2: [
267
256
  {
268
- type: 'Long' as const,
257
+ type: "Long" as const,
269
258
  data: new BigInt64Array([BigInt(10)]),
270
259
  isNA: new Uint8Array(),
271
- absent: new Uint8Array()
260
+ absent: new Uint8Array(),
272
261
  },
273
262
  {
274
- type: 'Double' as const,
263
+ type: "Double" as const,
275
264
  data: new Float64Array([10.0]),
276
265
  isNA: new Uint8Array(),
277
- absent: new Uint8Array()
278
- }
266
+ absent: new Uint8Array(),
267
+ },
279
268
  ] as PTableVector[],
280
269
  request3: [
281
270
  {
282
- type: 'String' as const,
283
- data: ['10'],
271
+ type: "String" as const,
272
+ data: ["10"],
284
273
  isNA: new Uint8Array(),
285
- absent: new Uint8Array()
274
+ absent: new Uint8Array(),
286
275
  },
287
276
  {
288
- type: 'Bytes' as const,
277
+ type: "Bytes" as const,
289
278
  data: [new Uint8Array([49, 48])],
290
279
  isNA: new Uint8Array(),
291
- absent: new Uint8Array()
292
- }
280
+ absent: new Uint8Array(),
281
+ },
293
282
  ] as PTableVector[],
294
283
  request4: [
295
284
  {
296
- type: 'String' as const,
297
- data: ['10'],
285
+ type: "String" as const,
286
+ data: ["10"],
298
287
  isNA: new Uint8Array(),
299
- absent: new Uint8Array()
288
+ absent: new Uint8Array(),
300
289
  },
301
290
  {
302
- type: 'Float' as const,
291
+ type: "Float" as const,
303
292
  data: new Float32Array([NaN]),
304
293
  isNA: new Uint8Array([128]),
305
- absent: new Uint8Array()
306
- }
307
- ] as PTableVector[]
294
+ absent: new Uint8Array(),
295
+ },
296
+ ] as PTableVector[],
308
297
  };
309
298
 
310
- test.concurrent('create_table_request_1', async ({ expect }) => {
311
- const testCase = 'create_table_request_1';
312
- const request = readJsonTestFile(testCase, 'request.json');
299
+ test.concurrent("create_table_request_1", async ({ expect }) => {
300
+ const testCase = "create_table_request_1";
301
+ const request = readJsonTestFile(testCase, "request.json");
313
302
  const expectedResponse = createTableExpectedResponses.request1;
314
303
 
315
304
  using pframe = await readPFrame(testCase);
316
- using table = pframe.createTable(
317
- ulid() as PFrameInternal.PTableId,
318
- request
319
- );
305
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
320
306
 
321
- const columnIndices = Array.from(
322
- { length: table.getSpec().length },
323
- (_, i) => i
324
- );
307
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
325
308
  const actualResponse = await table.getData(columnIndices);
326
309
  expect(actualResponse).toEqual(expectedResponse);
327
310
  });
328
311
 
329
- test.concurrent('create_table_request_2', async ({ expect }) => {
330
- const testCase = 'create_table_request_2';
331
- const request = readJsonTestFile(testCase, 'request.json');
312
+ test.concurrent("create_table_request_2", async ({ expect }) => {
313
+ const testCase = "create_table_request_2";
314
+ const request = readJsonTestFile(testCase, "request.json");
332
315
  const expectedResponse = createTableExpectedResponses.request2;
333
316
 
334
317
  using pframe = await readPFrame(testCase);
335
- using table = pframe.createTable(
336
- ulid() as PFrameInternal.PTableId,
337
- request
338
- );
318
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
339
319
 
340
- const columnIndices = Array.from(
341
- { length: table.getSpec().length },
342
- (_, i) => i
343
- );
320
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
344
321
  const actualResponse = await table.getData(columnIndices);
345
322
  expect(actualResponse).toEqual(expectedResponse);
346
323
  });
347
324
 
348
- test.concurrent('create_table_request_3', async ({ expect }) => {
349
- const testCase = 'create_table_request_3';
350
- const request = readJsonTestFile(testCase, 'request.json');
325
+ test.concurrent("create_table_request_3", async ({ expect }) => {
326
+ const testCase = "create_table_request_3";
327
+ const request = readJsonTestFile(testCase, "request.json");
351
328
  const expectedResponse = createTableExpectedResponses.request3;
352
329
 
353
330
  using pframe = await readPFrame(testCase);
354
- using table = pframe.createTable(
355
- ulid() as PFrameInternal.PTableId,
356
- request
357
- );
331
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
358
332
 
359
- const columnIndices = Array.from(
360
- { length: table.getSpec().length },
361
- (_, i) => i
362
- );
333
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
363
334
  const actualResponse = await table.getData(columnIndices);
364
335
  expect(actualResponse).toEqual(expectedResponse);
365
336
  });
366
337
 
367
- test.concurrent('create_table_request_4', async ({ expect }) => {
368
- const testCase = 'create_table_request_4';
369
- const request = readJsonTestFile(testCase, 'request.json');
338
+ test.concurrent("create_table_request_4", async ({ expect }) => {
339
+ const testCase = "create_table_request_4";
340
+ const request = readJsonTestFile(testCase, "request.json");
370
341
  const expectedResponse = createTableExpectedResponses.request4;
371
342
 
372
343
  using pframe = await readPFrame(testCase);
373
- using table = pframe.createTable(
374
- ulid() as PFrameInternal.PTableId,
375
- request
376
- );
344
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
377
345
 
378
- const columnIndices = Array.from(
379
- { length: table.getSpec().length },
380
- (_, i) => i
381
- );
346
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
382
347
  const actualResponse = await table.getData(columnIndices);
383
348
  expect(actualResponse).toEqual(expectedResponse);
384
349
  });
385
350
 
386
- test.concurrent('create_table_request_fail', async ({ expect }) => {
387
- const testCase = 'create_table_request_fail';
351
+ test.concurrent("create_table_request_fail", async ({ expect }) => {
352
+ const testCase = "create_table_request_fail";
388
353
 
389
- const columnId = 'column' as PObjectId;
390
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
391
- const dataInfo = readJsonTestFile(testCase, 'column.datainfo');
354
+ const columnId = "column" as PObjectId;
355
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
356
+ const dataInfo = readJsonTestFile(testCase, "column.datainfo");
392
357
  const dataSource = createFailingDataSource();
393
- const request = readJsonTestFile(testCase, 'request.json');
358
+ const request = readJsonTestFile(testCase, "request.json");
394
359
 
395
360
  using pframe = PFrameFactory.createPFrame({
396
361
  frameId: ulid() as PFrameInternal.PFrameId,
397
- spillPath: tmpdir()
362
+ spillPath: tmpdir(),
398
363
  });
399
364
  pframe.setDataSource(dataSource);
400
365
 
401
366
  pframe.addColumnSpec(columnId, columnSpec);
402
367
  await pframe.setColumnData(columnId, dataInfo);
403
368
 
404
- using table = pframe.createTable(
405
- ulid() as PFrameInternal.PTableId,
406
- request
407
- );
369
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
408
370
 
409
371
  await expect(table.getShape()).rejects.toThrow();
410
372
  });
411
373
 
412
- // QueryData requests for createTableV2 tests
374
+ // DataQuery requests for createTableV2 tests
413
375
  const createTableV2Requests = {
414
376
  request1: {
415
377
  tableSpec: [
416
378
  {
417
- type: 'axis',
418
- id: { name: 'axis', type: 'Int' },
419
- spec: { name: 'axis', type: 'Int' }
379
+ type: "axis",
380
+ id: { name: "axis", type: "Int" },
381
+ spec: { name: "axis", type: "Int" },
420
382
  },
421
383
  {
422
- type: 'column',
423
- id: 'column',
384
+ type: "column",
385
+ id: "column",
424
386
  spec: {
425
- kind: 'PColumn',
426
- axesSpec: [{ name: 'axis', type: 'Int' }],
427
- name: 'column',
428
- valueType: 'Float'
429
- }
430
- }
387
+ kind: "PColumn",
388
+ axesSpec: [{ name: "axis", type: "Int" }],
389
+ name: "column",
390
+ valueType: "Float",
391
+ },
392
+ },
431
393
  ] as PTableColumnSpec[],
432
- dataQuery: { type: 'column', columnId: 'column' } as QueryData
394
+ dataQuery: { type: "column", column: "column" } as DataQuery,
433
395
  },
434
396
  request2: {
435
397
  tableSpec: [
436
398
  {
437
- type: 'axis',
438
- id: { name: 'axis', type: 'Long' },
439
- spec: { name: 'axis', type: 'Long' }
399
+ type: "axis",
400
+ id: { name: "axis", type: "Long" },
401
+ spec: { name: "axis", type: "Long" },
440
402
  },
441
403
  {
442
- type: 'column',
443
- id: 'column',
404
+ type: "column",
405
+ id: "column",
444
406
  spec: {
445
- kind: 'PColumn',
446
- axesSpec: [{ name: 'axis', type: 'Long' }],
447
- name: 'column',
448
- valueType: 'Double'
449
- }
450
- }
407
+ kind: "PColumn",
408
+ axesSpec: [{ name: "axis", type: "Long" }],
409
+ name: "column",
410
+ valueType: "Double",
411
+ },
412
+ },
451
413
  ] as PTableColumnSpec[],
452
- dataQuery: { type: 'column', columnId: 'column' } as QueryData
414
+ dataQuery: { type: "column", column: "column" } as DataQuery,
453
415
  },
454
416
  request3: {
455
417
  tableSpec: [
456
418
  {
457
- type: 'axis',
458
- id: { name: 'axis', type: 'String' },
459
- spec: { name: 'axis', type: 'String' }
419
+ type: "axis",
420
+ id: { name: "axis", type: "String" },
421
+ spec: { name: "axis", type: "String" },
460
422
  },
461
423
  {
462
- type: 'column',
463
- id: 'column',
424
+ type: "column",
425
+ id: "column",
464
426
  spec: {
465
- kind: 'PColumn',
466
- axesSpec: [{ name: 'axis', type: 'String' }],
467
- name: 'column',
468
- valueType: 'Bytes'
469
- }
470
- }
427
+ kind: "PColumn",
428
+ axesSpec: [{ name: "axis", type: "String" }],
429
+ name: "column",
430
+ valueType: "Bytes",
431
+ },
432
+ },
471
433
  ] as PTableColumnSpec[],
472
- dataQuery: { type: 'column', columnId: 'column' } as QueryData
434
+ dataQuery: { type: "column", column: "column" } as DataQuery,
473
435
  },
474
436
  request4: {
475
437
  tableSpec: [
476
438
  {
477
- type: 'axis',
478
- id: { name: 'axis', type: 'String' },
479
- spec: { name: 'axis', type: 'String' }
439
+ type: "axis",
440
+ id: { name: "axis", type: "String" },
441
+ spec: { name: "axis", type: "String" },
480
442
  },
481
443
  {
482
- type: 'column',
483
- id: 'column',
444
+ type: "column",
445
+ id: "column",
484
446
  spec: {
485
- kind: 'PColumn',
486
- axesSpec: [{ name: 'axis', type: 'String' }],
487
- name: 'column',
488
- valueType: 'Float'
489
- }
490
- }
447
+ kind: "PColumn",
448
+ axesSpec: [{ name: "axis", type: "String" }],
449
+ name: "column",
450
+ valueType: "Float",
451
+ },
452
+ },
491
453
  ] as PTableColumnSpec[],
492
- dataQuery: { type: 'column', columnId: 'column' } as QueryData
493
- }
454
+ dataQuery: { type: "column", column: "column" } as DataQuery,
455
+ },
494
456
  };
495
457
 
496
- test.concurrent('create_table_by_data_query_1', async ({ expect }) => {
497
- const testCase = 'create_table_request_1';
458
+ test.concurrent("create_table_by_data_query_1", async ({ expect }) => {
459
+ const testCase = "create_table_request_1";
498
460
  const expectedResponse = createTableExpectedResponses.request1;
499
- const queryDataRequest = createTableV2Requests.request1;
461
+ const DataqueryRequest = createTableV2Requests.request1;
500
462
 
501
463
  using pframe = await readPFrame(testCase);
502
- using table = pframe.createTableV2(
503
- ulid() as PFrameInternal.PTableId,
504
- queryDataRequest
505
- );
464
+ using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
506
465
 
507
- const columnIndices = Array.from(
508
- { length: table.getSpec().length },
509
- (_, i) => i
510
- );
466
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
511
467
  const actualResponse = await table.getData(columnIndices);
512
468
  expect(actualResponse).toEqual(expectedResponse);
513
469
  });
514
470
 
515
- test.concurrent('create_table_by_data_query_2', async ({ expect }) => {
516
- const testCase = 'create_table_request_2';
471
+ test.concurrent("create_table_by_data_query_2", async ({ expect }) => {
472
+ const testCase = "create_table_request_2";
517
473
  const expectedResponse = createTableExpectedResponses.request2;
518
- const queryDataRequest = createTableV2Requests.request2;
474
+ const DataqueryRequest = createTableV2Requests.request2;
519
475
 
520
476
  using pframe = await readPFrame(testCase);
521
- using table = pframe.createTableV2(
522
- ulid() as PFrameInternal.PTableId,
523
- queryDataRequest
524
- );
477
+ using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
525
478
 
526
- const columnIndices = Array.from(
527
- { length: table.getSpec().length },
528
- (_, i) => i
529
- );
479
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
530
480
  const actualResponse = await table.getData(columnIndices);
531
481
  expect(actualResponse).toEqual(expectedResponse);
532
482
  });
533
483
 
534
- test.concurrent('create_table_by_data_query_3', async ({ expect }) => {
535
- const testCase = 'create_table_request_3';
484
+ test.concurrent("create_table_by_data_query_3", async ({ expect }) => {
485
+ const testCase = "create_table_request_3";
536
486
  const expectedResponse = createTableExpectedResponses.request3;
537
- const queryDataRequest = createTableV2Requests.request3;
487
+ const DataqueryRequest = createTableV2Requests.request3;
538
488
 
539
489
  using pframe = await readPFrame(testCase);
540
- using table = pframe.createTableV2(
541
- ulid() as PFrameInternal.PTableId,
542
- queryDataRequest
543
- );
490
+ using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
544
491
 
545
- const columnIndices = Array.from(
546
- { length: table.getSpec().length },
547
- (_, i) => i
548
- );
492
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
549
493
  const actualResponse = await table.getData(columnIndices);
550
494
  expect(actualResponse).toEqual(expectedResponse);
551
495
  });
552
496
 
553
- test.concurrent('create_table_by_data_query_4', async ({ expect }) => {
554
- const testCase = 'create_table_request_4';
497
+ test.concurrent("create_table_by_data_query_4", async ({ expect }) => {
498
+ const testCase = "create_table_request_4";
555
499
  const expectedResponse = createTableExpectedResponses.request4;
556
- const queryDataRequest = createTableV2Requests.request4;
500
+ const DataqueryRequest = createTableV2Requests.request4;
557
501
 
558
502
  using pframe = await readPFrame(testCase);
559
- using table = pframe.createTableV2(
560
- ulid() as PFrameInternal.PTableId,
561
- queryDataRequest
562
- );
503
+ using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
563
504
 
564
- const columnIndices = Array.from(
565
- { length: table.getSpec().length },
566
- (_, i) => i
567
- );
505
+ const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
568
506
  const actualResponse = await table.getData(columnIndices);
569
507
  expect(actualResponse).toEqual(expectedResponse);
570
508
  });
571
509
 
572
- test.concurrent('create_table_by_data_query_fail', async ({ expect }) => {
573
- const testCase = 'create_table_request_fail';
510
+ test.concurrent("create_table_by_data_query_fail", async ({ expect }) => {
511
+ const testCase = "create_table_request_fail";
574
512
 
575
- const columnId = 'column' as PObjectId;
576
- const columnSpec = readJsonTestFile(testCase, 'column.spec');
577
- const dataInfo = readJsonTestFile(testCase, 'column.datainfo');
513
+ const columnId = "column" as PObjectId;
514
+ const columnSpec = readJsonTestFile(testCase, "column.spec");
515
+ const dataInfo = readJsonTestFile(testCase, "column.datainfo");
578
516
  const dataSource = createFailingDataSource();
579
517
 
580
518
  using pframe = PFrameFactory.createPFrame({
581
519
  frameId: ulid() as PFrameInternal.PFrameId,
582
- spillPath: tmpdir()
520
+ spillPath: tmpdir(),
583
521
  });
584
522
  pframe.setDataSource(dataSource);
585
523
 
586
524
  pframe.addColumnSpec(columnId, columnSpec);
587
525
  await pframe.setColumnData(columnId, dataInfo);
588
526
 
589
- // Construct QueryData request for the failing column
590
- const queryDataRequest = {
527
+ // Construct DataQuery request for the failing column
528
+ const DataqueryRequest = {
591
529
  tableSpec: [
592
530
  {
593
- type: 'axis',
594
- id: { name: 'axis', type: 'Long' },
595
- spec: { name: 'axis', type: 'Long' }
531
+ type: "axis",
532
+ id: { name: "axis", type: "Long" },
533
+ spec: { name: "axis", type: "Long" },
596
534
  },
597
535
  {
598
- type: 'column',
599
- id: 'column',
536
+ type: "column",
537
+ id: "column",
600
538
  spec: {
601
- kind: 'PColumn',
602
- axesSpec: [{ name: 'axis', type: 'Long' }],
603
- name: 'column',
604
- valueType: 'Long'
605
- }
606
- }
539
+ kind: "PColumn",
540
+ axesSpec: [{ name: "axis", type: "Long" }],
541
+ name: "column",
542
+ valueType: "Long",
543
+ },
544
+ },
607
545
  ] as PTableColumnSpec[],
608
546
  dataQuery: {
609
- type: 'column',
610
- columnId: 'column'
611
- } as QueryData
547
+ type: "column",
548
+ column: "column",
549
+ } as DataQuery,
612
550
  };
613
551
 
614
552
  using table = (pframe as unknown as PFrame).createTableV2(
615
553
  ulid() as PFrameInternal.PTableId,
616
- queryDataRequest
554
+ DataqueryRequest,
617
555
  );
618
556
 
619
557
  await expect(table.getShape()).rejects.toThrow();
620
558
  });
621
559
  });
622
560
 
623
- describe('PFrame Table Operations', () => {
624
- test.concurrent('sort_table_request', async ({ expect }) => {
625
- const testCase = 'sort_table_request';
561
+ describe("PFrame Table Operations", () => {
562
+ test.concurrent("sort_table_request", async ({ expect }) => {
563
+ const testCase = "sort_table_request";
626
564
 
627
- const request = readJsonTestFile(testCase, 'request.json');
628
- const sorting: PTableSorting[] = readJsonTestFile(testCase, 'sorting.json');
565
+ const request = readJsonTestFile(testCase, "request.json");
566
+ const sorting: PTableSorting[] = readJsonTestFile(testCase, "sorting.json");
629
567
 
630
568
  // Expected response for full sorted data
631
569
  let expectedFullResponse: PTableVector[] = [
632
570
  {
633
- type: 'Long', // Axis A1 - all values present
571
+ type: "Long", // Axis A1 - all values present
634
572
  data: new BigInt64Array([BigInt(0), BigInt(0), BigInt(1), BigInt(2)]),
635
573
  isNA: new Uint8Array(),
636
- absent: new Uint8Array()
574
+ absent: new Uint8Array(),
637
575
  },
638
576
  {
639
- type: 'String', // Axis A2 - positions 2,3 absent (no record in column2 for A1=1,2)
640
- data: ['FloatOne', 'FloatTwo', null, null],
577
+ type: "String", // Axis A2 - positions 2,3 absent (no record in column2 for A1=1,2)
578
+ data: ["FloatOne", "FloatTwo", null, null],
641
579
  isNA: new Uint8Array([48]),
642
- absent: new Uint8Array()
580
+ absent: new Uint8Array(),
643
581
  },
644
582
  {
645
- type: 'String', // Column column1 - positions 0,1 are NA (no data for A1=0)
646
- data: [null, null, 'IntOne', 'IntTwo'],
583
+ type: "String", // Column column1 - positions 0,1 are NA (no data for A1=0)
584
+ data: [null, null, "IntOne", "IntTwo"],
647
585
  isNA: new Uint8Array([192]),
648
- absent: new Uint8Array()
586
+ absent: new Uint8Array(),
649
587
  },
650
588
  {
651
- type: 'Float', // Column column2 - positions 2,3 are NA (no data for A1=1,2)
589
+ type: "Float", // Column column2 - positions 2,3 are NA (no data for A1=1,2)
652
590
  data: new Float32Array([1.0, 2.0, NaN, NaN]),
653
591
  isNA: new Uint8Array([48]),
654
- absent: new Uint8Array()
655
- }
592
+ absent: new Uint8Array(),
593
+ },
656
594
  ];
657
595
 
658
596
  // Expected response for range query (rows 1-2, reordered columns)
659
597
  const expectedRangeResponse: PTableVector[] = [
660
598
  {
661
- type: 'Float', // Column column2 - position 1 is NA
599
+ type: "Float", // Column column2 - position 1 is NA
662
600
  data: new Float32Array([2.0, NaN]),
663
601
  isNA: new Uint8Array([64]),
664
- absent: new Uint8Array()
602
+ absent: new Uint8Array(),
665
603
  },
666
604
  {
667
- type: 'String', // Column column1 - position 0 is NA
668
- data: [null, 'IntOne'],
605
+ type: "String", // Column column1 - position 0 is NA
606
+ data: [null, "IntOne"],
669
607
  isNA: new Uint8Array([128]),
670
- absent: new Uint8Array()
608
+ absent: new Uint8Array(),
671
609
  },
672
610
  {
673
- type: 'String', // Axis A2 - position 1 is absent
674
- data: ['FloatTwo', null],
611
+ type: "String", // Axis A2 - position 1 is absent
612
+ data: ["FloatTwo", null],
675
613
  isNA: new Uint8Array([64]),
676
- absent: new Uint8Array()
614
+ absent: new Uint8Array(),
677
615
  },
678
616
  {
679
- type: 'Long', // Axis A1 - all present
617
+ type: "Long", // Axis A1 - all present
680
618
  data: new BigInt64Array([BigInt(0), BigInt(1)]),
681
619
  isNA: new Uint8Array(),
682
- absent: new Uint8Array()
683
- }
620
+ absent: new Uint8Array(),
621
+ },
684
622
  ];
685
623
 
686
624
  using pframe = await readPFrame(testCase);
687
- using table = pframe.createTable(
688
- ulid() as PFrameInternal.PTableId,
689
- request
690
- );
625
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
691
626
 
692
627
  using sortedTable = table.sort(ulid() as PFrameInternal.PTableId, sorting);
693
628
  const footprint = await sortedTable.getFootprint();
@@ -695,7 +630,7 @@ describe('PFrame Table Operations', () => {
695
630
 
696
631
  // Test full sorted data
697
632
  const columnIndices = sortedTable.getColumnIndices(
698
- Array.from(sorting, (entry) => entry.column)
633
+ Array.from(sorting, (entry) => entry.column),
699
634
  );
700
635
  let actualResponse = await sortedTable.getData(columnIndices);
701
636
  expect(actualResponse).toEqual(expectedFullResponse);
@@ -703,31 +638,28 @@ describe('PFrame Table Operations', () => {
703
638
  // Test range query with reordered columns
704
639
  actualResponse = await sortedTable.getData(
705
640
  [columnIndices[3], columnIndices[2], columnIndices[1], columnIndices[0]],
706
- { range: { offset: 1, length: 2 } }
641
+ { range: { offset: 1, length: 2 } },
707
642
  );
708
643
  expect(actualResponse).toEqual(expectedRangeResponse);
709
644
  });
710
645
  });
711
646
 
712
- describe('PFrame Complex Operations', () => {
713
- test.concurrent('complex_join', async ({ expect }) => {
714
- const testCase = 'complex_join';
647
+ describe("PFrame Complex Operations", () => {
648
+ test.concurrent("complex_join", async ({ expect }) => {
649
+ const testCase = "complex_join";
715
650
  using pframe = await readPFrame(testCase);
716
651
 
717
- const request = readJsonTestFile(testCase, 'request.json');
718
- using table = pframe.createTable(
719
- ulid() as PFrameInternal.PTableId,
720
- request
721
- );
652
+ const request = readJsonTestFile(testCase, "request.json");
653
+ using table = pframe.createTable(ulid() as PFrameInternal.PTableId, request);
722
654
 
723
655
  const shape = await table.getShape();
724
656
  expect(shape).toEqual({
725
657
  columns: 6,
726
- rows: 7124
658
+ rows: 7124,
727
659
  });
728
660
 
729
661
  // Test profiling functionality (platform-dependent)
730
- if (process.platform === 'win32') {
662
+ if (process.platform === "win32") {
731
663
  expect(PFrameFactory.pprofDump()).rejects.toThrow();
732
664
  } else {
733
665
  const profile = await PFrameFactory.pprofDump();
@@ -738,12 +670,12 @@ describe('PFrame Complex Operations', () => {
738
670
 
739
671
  // Test out of bounds range
740
672
  const result = await table.getData([0], {
741
- range: { offset: 10000, length: 20000 }
673
+ range: { offset: 10000, length: 20000 },
742
674
  });
743
675
  expect(result).toMatchObject([{ data: [] }]);
744
676
 
745
677
  const result2 = await table.getData([0], {
746
- range: { offset: 7123, length: 2 }
678
+ range: { offset: 7123, length: 2 },
747
679
  });
748
680
  expect(result2[0].data.length).toBe(1);
749
681
  });