@loaders.gl/arrow 4.0.0-alpha.24 → 4.0.0-alpha.26

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 (48) hide show
  1. package/dist/arrow-loader.d.ts +1 -1
  2. package/dist/arrow-loader.d.ts.map +1 -1
  3. package/dist/arrow-worker.js +36 -14
  4. package/dist/dist.min.js +36 -14
  5. package/dist/es5/arrow-loader.js +1 -1
  6. package/dist/es5/arrow-loader.js.map +1 -1
  7. package/dist/es5/arrow-writer.js +1 -1
  8. package/dist/es5/index.js.map +1 -1
  9. package/dist/es5/lib/arrow-table-batch.js +2 -2
  10. package/dist/es5/lib/arrow-table-batch.js.map +1 -1
  11. package/dist/es5/lib/arrow-table.js +2 -0
  12. package/dist/es5/lib/arrow-table.js.map +1 -0
  13. package/dist/es5/lib/convert-table.js.map +1 -1
  14. package/dist/es5/lib/parse-arrow-in-batches.js +1 -1
  15. package/dist/es5/lib/parse-arrow-in-batches.js.map +1 -1
  16. package/dist/es5/lib/parse-arrow-sync.js.map +1 -1
  17. package/dist/esm/arrow-loader.js +1 -1
  18. package/dist/esm/arrow-loader.js.map +1 -1
  19. package/dist/esm/arrow-writer.js +1 -1
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/lib/arrow-table-batch.js +2 -2
  22. package/dist/esm/lib/arrow-table-batch.js.map +1 -1
  23. package/dist/esm/lib/arrow-table.js +2 -0
  24. package/dist/esm/lib/arrow-table.js.map +1 -0
  25. package/dist/esm/lib/convert-table.js.map +1 -1
  26. package/dist/esm/lib/parse-arrow-in-batches.js +2 -2
  27. package/dist/esm/lib/parse-arrow-in-batches.js.map +1 -1
  28. package/dist/esm/lib/parse-arrow-sync.js.map +1 -1
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/lib/arrow-table-batch.d.ts +2 -2
  32. package/dist/lib/arrow-table-batch.d.ts.map +1 -1
  33. package/dist/lib/arrow-table.d.ts +23 -0
  34. package/dist/lib/arrow-table.d.ts.map +1 -0
  35. package/dist/lib/convert-table.d.ts +2 -1
  36. package/dist/lib/convert-table.d.ts.map +1 -1
  37. package/dist/lib/parse-arrow-in-batches.d.ts +1 -1
  38. package/dist/lib/parse-arrow-in-batches.d.ts.map +1 -1
  39. package/dist/lib/parse-arrow-sync.d.ts +2 -1
  40. package/dist/lib/parse-arrow-sync.d.ts.map +1 -1
  41. package/package.json +4 -4
  42. package/src/arrow-loader.ts +1 -1
  43. package/src/index.ts +6 -1
  44. package/src/lib/arrow-table-batch.ts +4 -3
  45. package/src/lib/arrow-table.ts +26 -0
  46. package/src/lib/convert-table.ts +2 -1
  47. package/src/lib/parse-arrow-in-batches.ts +3 -3
  48. package/src/lib/parse-arrow-sync.ts +2 -1
@@ -1,5 +1,5 @@
1
1
  import type { Loader, LoaderOptions } from '@loaders.gl/loader-utils';
2
- import type { ArrowTable } from '@loaders.gl/schema';
2
+ import type { ArrowTable } from './lib/arrow-table';
3
3
  export type ArrowLoaderOptions = LoaderOptions & {
4
4
  arrow?: {
5
5
  shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAMnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;KAChG,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAoBrE,CAAC"}
1
+ {"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAMlD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;KAChG,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAoBrE,CAAC"}
@@ -561,10 +561,12 @@
561
561
  switch (table.shape) {
562
562
  case "array-row-table":
563
563
  case "object-row-table":
564
- case "geojson-row-table":
565
564
  return table.data.length;
565
+ case "geojson-table":
566
+ return table.features.length;
566
567
  case "arrow-table":
567
- return table.data.numRows;
568
+ const arrowTable = table.data;
569
+ return arrowTable.numRows;
568
570
  case "columnar-table":
569
571
  for (const column of Object.values(table.data)) {
570
572
  return column.length || 0;
@@ -580,14 +582,16 @@
580
582
  const columnIndex = getTableColumnIndex(table, columnName);
581
583
  return table.data[rowIndex][columnIndex];
582
584
  case "object-row-table":
583
- case "geojson-row-table":
584
585
  return table.data[rowIndex][columnName];
586
+ case "geojson-table":
587
+ return table.features[rowIndex][columnName];
585
588
  case "columnar-table":
586
589
  const column = table.data[columnName];
587
590
  return column[rowIndex];
588
591
  case "arrow-table":
589
- const arrowColumnIndex = table.data.schema.fields.findIndex((field) => field.name === columnName);
590
- return table.data.getChildAt(arrowColumnIndex)?.get(rowIndex);
592
+ const arrowTable = table.data;
593
+ const arrowColumnIndex = arrowTable.schema.fields.findIndex((field) => field.name === columnName);
594
+ return arrowTable.getChildAt(arrowColumnIndex)?.get(rowIndex);
591
595
  default:
592
596
  throw new Error("todo");
593
597
  }
@@ -604,7 +608,6 @@
604
608
  case "object-row-table":
605
609
  return copy ? Object.fromEntries(Object.entries(table.data[rowIndex])) : table.data[rowIndex];
606
610
  case "array-row-table":
607
- case "geojson-row-table":
608
611
  if (table.schema) {
609
612
  const objectRow2 = target || {};
610
613
  for (let i = 0; i < table.schema.fields.length; i++) {
@@ -613,6 +616,15 @@
613
616
  return objectRow2;
614
617
  }
615
618
  throw new Error("no schema");
619
+ case "geojson-table":
620
+ if (table.schema) {
621
+ const objectRow2 = target || {};
622
+ for (let i = 0; i < table.schema.fields.length; i++) {
623
+ objectRow2[table.schema.fields[i].name] = table.features[rowIndex][i];
624
+ }
625
+ return objectRow2;
626
+ }
627
+ throw new Error("no schema");
616
628
  case "columnar-table":
617
629
  if (table.schema) {
618
630
  const objectRow2 = target || {};
@@ -628,9 +640,10 @@
628
640
  return objectRow2;
629
641
  }
630
642
  case "arrow-table":
643
+ const arrowTable = table.data;
631
644
  const objectRow = target || {};
632
- const row = table.data.get(rowIndex);
633
- const schema = table.data.schema;
645
+ const row = arrowTable.get(rowIndex);
646
+ const schema = arrowTable.schema;
634
647
  for (let i = 0; i < schema.fields.length; i++) {
635
648
  objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
636
649
  }
@@ -644,7 +657,6 @@
644
657
  case "array-row-table":
645
658
  return copy ? Array.from(table.data[rowIndex]) : table.data[rowIndex];
646
659
  case "object-row-table":
647
- case "geojson-row-table":
648
660
  if (table.schema) {
649
661
  const arrayRow2 = target || [];
650
662
  for (let i = 0; i < table.schema.fields.length; i++) {
@@ -653,6 +665,15 @@
653
665
  return arrayRow2;
654
666
  }
655
667
  return Object.values(table.data[rowIndex]);
668
+ case "geojson-table":
669
+ if (table.schema) {
670
+ const arrayRow2 = target || [];
671
+ for (let i = 0; i < table.schema.fields.length; i++) {
672
+ arrayRow2[i] = table.features[rowIndex][table.schema.fields[i].name];
673
+ }
674
+ return arrayRow2;
675
+ }
676
+ return Object.values(table.features[rowIndex]);
656
677
  case "columnar-table":
657
678
  if (table.schema) {
658
679
  const arrayRow2 = target || [];
@@ -670,9 +691,10 @@
670
691
  return arrayRow2;
671
692
  }
672
693
  case "arrow-table":
694
+ const arrowTable = table.data;
673
695
  const arrayRow = target || [];
674
- const row = table.data.get(rowIndex);
675
- const schema = table.data.schema;
696
+ const row = arrowTable.get(rowIndex);
697
+ const schema = arrowTable.schema;
676
698
  for (let i = 0; i < schema.fields.length; i++) {
677
699
  arrayRow[i] = row?.[schema.fields[i].name];
678
700
  }
@@ -11479,7 +11501,7 @@ return true;`);
11479
11501
  RecordBatchStreamWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
11480
11502
 
11481
11503
  // src/arrow-loader.ts
11482
- var VERSION = true ? "4.0.0-alpha.24" : "latest";
11504
+ var VERSION = true ? "4.0.0-alpha.26" : "latest";
11483
11505
  var ArrowLoader = {
11484
11506
  name: "Apache Arrow",
11485
11507
  id: "arrow",
@@ -11549,7 +11571,7 @@ return true;`);
11549
11571
  const arrowTabledBatch = {
11550
11572
  shape: "arrow-table",
11551
11573
  batchType: "data",
11552
- data: recordBatch,
11574
+ data: new Table([recordBatch]),
11553
11575
  length: recordBatch.data.length
11554
11576
  };
11555
11577
  yield arrowTabledBatch;
@@ -11578,7 +11600,7 @@ return true;`);
11578
11600
  return {
11579
11601
  shape: "arrow-table",
11580
11602
  batchType: "data",
11581
- data: recordBatch,
11603
+ data: new Table([recordBatch]),
11582
11604
  length: batch.length
11583
11605
  };
11584
11606
  }
package/dist/dist.min.js CHANGED
@@ -406,10 +406,12 @@
406
406
  switch (table.shape) {
407
407
  case "array-row-table":
408
408
  case "object-row-table":
409
- case "geojson-row-table":
410
409
  return table.data.length;
410
+ case "geojson-table":
411
+ return table.features.length;
411
412
  case "arrow-table":
412
- return table.data.numRows;
413
+ const arrowTable = table.data;
414
+ return arrowTable.numRows;
413
415
  case "columnar-table":
414
416
  for (const column of Object.values(table.data)) {
415
417
  return column.length || 0;
@@ -425,14 +427,16 @@
425
427
  const columnIndex = getTableColumnIndex(table, columnName);
426
428
  return table.data[rowIndex][columnIndex];
427
429
  case "object-row-table":
428
- case "geojson-row-table":
429
430
  return table.data[rowIndex][columnName];
431
+ case "geojson-table":
432
+ return table.features[rowIndex][columnName];
430
433
  case "columnar-table":
431
434
  const column = table.data[columnName];
432
435
  return column[rowIndex];
433
436
  case "arrow-table":
434
- const arrowColumnIndex = table.data.schema.fields.findIndex((field) => field.name === columnName);
435
- return table.data.getChildAt(arrowColumnIndex)?.get(rowIndex);
437
+ const arrowTable = table.data;
438
+ const arrowColumnIndex = arrowTable.schema.fields.findIndex((field) => field.name === columnName);
439
+ return arrowTable.getChildAt(arrowColumnIndex)?.get(rowIndex);
436
440
  default:
437
441
  throw new Error("todo");
438
442
  }
@@ -449,7 +453,6 @@
449
453
  case "object-row-table":
450
454
  return copy ? Object.fromEntries(Object.entries(table.data[rowIndex])) : table.data[rowIndex];
451
455
  case "array-row-table":
452
- case "geojson-row-table":
453
456
  if (table.schema) {
454
457
  const objectRow2 = target || {};
455
458
  for (let i = 0; i < table.schema.fields.length; i++) {
@@ -458,6 +461,15 @@
458
461
  return objectRow2;
459
462
  }
460
463
  throw new Error("no schema");
464
+ case "geojson-table":
465
+ if (table.schema) {
466
+ const objectRow2 = target || {};
467
+ for (let i = 0; i < table.schema.fields.length; i++) {
468
+ objectRow2[table.schema.fields[i].name] = table.features[rowIndex][i];
469
+ }
470
+ return objectRow2;
471
+ }
472
+ throw new Error("no schema");
461
473
  case "columnar-table":
462
474
  if (table.schema) {
463
475
  const objectRow2 = target || {};
@@ -473,9 +485,10 @@
473
485
  return objectRow2;
474
486
  }
475
487
  case "arrow-table":
488
+ const arrowTable = table.data;
476
489
  const objectRow = target || {};
477
- const row = table.data.get(rowIndex);
478
- const schema = table.data.schema;
490
+ const row = arrowTable.get(rowIndex);
491
+ const schema = arrowTable.schema;
479
492
  for (let i = 0; i < schema.fields.length; i++) {
480
493
  objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
481
494
  }
@@ -489,7 +502,6 @@
489
502
  case "array-row-table":
490
503
  return copy ? Array.from(table.data[rowIndex]) : table.data[rowIndex];
491
504
  case "object-row-table":
492
- case "geojson-row-table":
493
505
  if (table.schema) {
494
506
  const arrayRow2 = target || [];
495
507
  for (let i = 0; i < table.schema.fields.length; i++) {
@@ -498,6 +510,15 @@
498
510
  return arrayRow2;
499
511
  }
500
512
  return Object.values(table.data[rowIndex]);
513
+ case "geojson-table":
514
+ if (table.schema) {
515
+ const arrayRow2 = target || [];
516
+ for (let i = 0; i < table.schema.fields.length; i++) {
517
+ arrayRow2[i] = table.features[rowIndex][table.schema.fields[i].name];
518
+ }
519
+ return arrayRow2;
520
+ }
521
+ return Object.values(table.features[rowIndex]);
501
522
  case "columnar-table":
502
523
  if (table.schema) {
503
524
  const arrayRow2 = target || [];
@@ -515,9 +536,10 @@
515
536
  return arrayRow2;
516
537
  }
517
538
  case "arrow-table":
539
+ const arrowTable = table.data;
518
540
  const arrayRow = target || [];
519
- const row = table.data.get(rowIndex);
520
- const schema = table.data.schema;
541
+ const row = arrowTable.get(rowIndex);
542
+ const schema = arrowTable.schema;
521
543
  for (let i = 0; i < schema.fields.length; i++) {
522
544
  arrayRow[i] = row?.[schema.fields[i].name];
523
545
  }
@@ -12487,7 +12509,7 @@ return true;`);
12487
12509
  const arrowTabledBatch = {
12488
12510
  shape: "arrow-table",
12489
12511
  batchType: "data",
12490
- data: recordBatch,
12512
+ data: new Table([recordBatch]),
12491
12513
  length: recordBatch.data.length
12492
12514
  };
12493
12515
  yield arrowTabledBatch;
@@ -12536,8 +12558,8 @@ return true;`);
12536
12558
  var ArrowTableBatchAggregator;
12537
12559
  var init_arrow_table_batch = __esm({
12538
12560
  "src/lib/arrow-table-batch.ts"() {
12539
- init_Arrow_dom();
12540
12561
  init_src();
12562
+ init_Arrow_dom();
12541
12563
  ArrowTableBatchAggregator = class extends ColumnarTableBatchAggregator {
12542
12564
  constructor(schema, options) {
12543
12565
  super(schema, options);
@@ -12555,7 +12577,7 @@ return true;`);
12555
12577
  return {
12556
12578
  shape: "arrow-table",
12557
12579
  batchType: "data",
12558
- data: recordBatch,
12580
+ data: new Table([recordBatch]),
12559
12581
  length: batch.length
12560
12582
  };
12561
12583
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ArrowLoader = void 0;
7
- var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
7
+ var VERSION = typeof "4.0.0-alpha.26" !== 'undefined' ? "4.0.0-alpha.26" : 'latest';
8
8
  var ArrowLoader = {
9
9
  name: 'Apache Arrow',
10
10
  id: 'arrow',
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-loader.js","names":["VERSION","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape","exports"],"sources":["../../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":";;;;;;AAMA,IAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AASpE,IAAMC,WAA0D,GAAG;EACxEC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEL,OAAO;EAEhBM,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC;AAACC,OAAA,CAAAb,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"arrow-loader.js","names":["VERSION","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape","exports"],"sources":["../../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from './lib/arrow-table';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":";;;;;;AAMA,IAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AASpE,IAAMC,WAA0D,GAAG;EACxEC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEL,OAAO;EAEhBM,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC;AAACC,OAAA,CAAAb,WAAA,GAAAA,WAAA"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ArrowWriter = void 0;
7
7
  var _encodeArrow = require("./lib/encode-arrow");
8
- var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
8
+ var VERSION = typeof "4.0.0-alpha.26" !== 'undefined' ? "4.0.0-alpha.26" : 'latest';
9
9
  var ArrowWriter = {
10
10
  name: 'Apache Arrow',
11
11
  id: 'arrow',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schema","require","_arrowLoader","_parseArrowSync","_interopRequireDefault","_parseArrowInBatches","_arrowTableBatch","_types","_arrowWriter","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","TableBatchBuilder","ArrowBatch","ArrowTableBatchAggregator","ArrowLoader","ArrowWorkerLoader","parse","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arraybuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseSync","stop","_x","_x2","parseInBatches","parseArrowInBatches","exports"],"sources":["../../src/index.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArrowLoaderOptions} from './arrow-loader';\nimport {ArrowTable, ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {ArrowLoader as ArrowWorkerLoader} from './arrow-loader';\nimport parseSync from './lib/parse-arrow-sync';\nimport {parseArrowInBatches} from './lib/parse-arrow-in-batches';\n\nimport {ArrowTableBatchAggregator} from './lib/arrow-table-batch';\n\n// Make the ArrowBatch type available\nTableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;\n\n// Types\nexport {VECTOR_TYPES} from './types';\n\n// Arrow writer\n\nexport {ArrowWriter} from './arrow-writer';\n\n// Arrow loader\n\nexport type {ArrowLoaderOptions};\nexport {ArrowWorkerLoader};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseSync(arraybuffer, options),\n parseSync,\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AAEA,IAAAK,gBAAA,GAAAL,OAAA;AAMA,IAAAM,MAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AAA2C,SAAAQ,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA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A;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAClE,IAAAC,uBAAS,EAACR,WAAW,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAK,IAAA;QAAA;MAAA,GAAAV,OAAA;IAAA;IAAA,SAAAL,MAAAgB,EAAA,EAAAC,GAAA;MAAA,OAAAhB,MAAA,CAAApB,KAAA,OAAAI,SAAA;IAAA;IAAA,OAAAe,KAAA;EAAA;EACjCc,SAAS,EAATA,uBAAS;EACTI,cAAc,EAAEC;AAAmB,EACpC;AAACC,OAAA,CAAAtB,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"index.js","names":["_schema","require","_arrowLoader","_parseArrowSync","_interopRequireDefault","_parseArrowInBatches","_arrowTableBatch","_types","_arrowWriter","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","TableBatchBuilder","ArrowBatch","ArrowTableBatchAggregator","ArrowLoader","ArrowWorkerLoader","parse","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arraybuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseSync","stop","_x","_x2","parseInBatches","parseArrowInBatches","exports"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArrowLoaderOptions} from './arrow-loader';\nimport type {ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {ArrowTable} from './lib/arrow-table';\n\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {ArrowLoader as ArrowWorkerLoader} from './arrow-loader';\nimport parseSync from './lib/parse-arrow-sync';\nimport {parseArrowInBatches} from './lib/parse-arrow-in-batches';\n\nimport {ArrowTableBatchAggregator} from './lib/arrow-table-batch';\n\n// Make the ArrowBatch type available\nTableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;\n\n// Types\nexport type {ArrowTable, ArrowTableBatch} from './lib/arrow-table';\nexport {VECTOR_TYPES} from './types';\n\n// Arrow writer\n\nexport {ArrowWriter} from './arrow-writer';\n\n// Arrow loader\n\nexport type {ArrowLoaderOptions};\nexport {ArrowWorkerLoader};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseSync(arraybuffer, options),\n parseSync,\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AAEA,IAAAK,gBAAA,GAAAL,OAAA;AAOA,IAAAM,MAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AAA2C,SAAAQ,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAA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OAAAe,KAAA;EAAA;EACjCc,SAAS,EAATA,uBAAS;EACTI,cAAc,EAAEC;AAAmB,EACpC;AAACC,OAAA,CAAAtB,WAAA,GAAAA,WAAA"}
@@ -13,8 +13,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _apacheArrow = require("apache-arrow");
17
16
  var _schema = require("@loaders.gl/schema");
17
+ var _apacheArrow = require("apache-arrow");
18
18
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
19
19
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
20
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -48,7 +48,7 @@ var ArrowTableBatchAggregator = function (_ColumnarTableBatchAg) {
48
48
  return {
49
49
  shape: 'arrow-table',
50
50
  batchType: 'data',
51
- data: recordBatch,
51
+ data: new _apacheArrow.Table([recordBatch]),
52
52
  length: batch.length
53
53
  };
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-table-batch.js","names":["_apacheArrow","require","_schema","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","ArrowTableBatchAggregator","_ColumnarTableBatchAg","_inherits2","_super","schema","options","_this","_classCallCheck2","_defineProperty2","_assertThisInitialized2","arrowSchema","_createClass2","key","getBatch","batch","_get2","getArrowSchema","arrowVectors","getArrowVectors","data","recordBatch","RecordBatch","makeData","type","Struct","fields","children","map","_ref","shape","batchType","ColumnarTableBatchAggregator","exports","arrowFields","field","Float32Array","metadata","Map","arrowField","Field","Float32","nullable","push","Error","Schema","_iterator","_step","vector","arrowVector","makeVector"],"sources":["../../../src/lib/arrow-table-batch.ts"],"sourcesContent":["import type {ArrowTableBatch} from '@loaders.gl/schema';\nimport {\n Schema,\n Field,\n RecordBatch,\n Struct,\n makeVector,\n makeData,\n Vector,\n Float32\n} from 'apache-arrow';\nimport {ColumnarTableBatchAggregator} from '@loaders.gl/schema';\n\nexport class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {\n arrowSchema: Schema | null;\n\n constructor(schema, options) {\n super(schema, options);\n this.arrowSchema = null;\n }\n\n getBatch(): ArrowTableBatch | null {\n const batch = super.getBatch();\n if (batch) {\n // Get the arrow schema\n this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);\n\n // Get arrow format vectors\n const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);\n\n // Create the record batch\n const recordBatch = new RecordBatch(\n this.arrowSchema,\n makeData({\n type: new Struct(this.arrowSchema.fields),\n children: arrowVectors.map(({data}) => data[0])\n })\n );\n\n return {\n shape: 'arrow-table',\n batchType: 'data',\n data: recordBatch,\n length: batch.length\n };\n }\n\n return null;\n }\n}\n\n// Convert from a simple loaders.gl schema to an Arrow schema\nfunction getArrowSchema(schema): Schema {\n const arrowFields: Field[] = [];\n for (const key in schema) {\n const field = schema[key];\n if (field.type === Float32Array) {\n // TODO - just store the original field as metadata?\n const metadata = new Map(); // field;\n // arrow: new Field(name, nullable, metadata)\n const arrowField = new Field(field.name, new Float32(), field.nullable, metadata);\n arrowFields.push(arrowField);\n }\n }\n if (arrowFields.length === 0) {\n throw new Error('No arrow convertible fields');\n }\n\n return new Schema(arrowFields);\n}\n\n// Convert from simple loaders.gl arrays to arrow vectors\nfunction getArrowVectors(arrowSchema, data): Vector[] {\n const arrowVectors: any[] = [];\n for (const field of arrowSchema.fields) {\n const vector = data[field.name];\n if (vector instanceof Float32Array) {\n const arrowVector = makeVector(vector);\n arrowVectors.push(arrowVector);\n }\n }\n if (arrowSchema.fields.length !== arrowVectors.length) {\n throw new Error('Some columns not arrow convertible');\n }\n return arrowVectors;\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAUA,IAAAC,OAAA,GAAAD,OAAA;AAAgE,SAAAE,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,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AAC;MAChC;IACF;EAAC,SAAAtF,GAAA;IAAAmF,SAAA,CAAAzF,CAAA,CAAAM,GAAA;EAAA;IAAAmF,SAAA,CAAAvF,CAAA;EAAA;EACD,IAAIoD,WAAW,CAACe,MAAM,CAAC5E,MAAM,KAAKoE,YAAY,CAACpE,MAAM,EAAE;IACrD,MAAM,IAAI8F,KAAK,CAAC,oCAAoC,CAAC;EACvD;EACA,OAAO1B,YAAY;AACrB"}
1
+ {"version":3,"file":"arrow-table-batch.js","names":["_schema","require","_apacheArrow","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","ArrowTableBatchAggregator","_ColumnarTableBatchAg","_inherits2","_super","schema","options","_this","_classCallCheck2","_defineProperty2","_assertThisInitialized2","arrowSchema","_createClass2","key","getBatch","batch","_get2","getArrowSchema","arrowVectors","getArrowVectors","data","recordBatch","RecordBatch","makeData","type","Struct","fields","children","map","_ref","shape","batchType","ApacheArrowTable","ColumnarTableBatchAggregator","exports","arrowFields","field","Float32Array","metadata","Map","arrowField","Field","Float32","nullable","push","Error","Schema","_iterator","_step","vector","arrowVector","makeVector"],"sources":["../../../src/lib/arrow-table-batch.ts"],"sourcesContent":["import {ColumnarTableBatchAggregator} from '@loaders.gl/schema';\nimport type {ArrowTableBatch} from './arrow-table';\nimport {\n Table as ApacheArrowTable,\n Schema,\n Field,\n RecordBatch,\n Struct,\n makeVector,\n makeData,\n Vector,\n Float32\n} from 'apache-arrow';\n\nexport class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {\n arrowSchema: Schema | null;\n\n constructor(schema, options) {\n super(schema, options);\n this.arrowSchema = null;\n }\n\n getBatch(): ArrowTableBatch | null {\n const batch = super.getBatch();\n if (batch) {\n // Get the arrow schema\n this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);\n\n // Get arrow format vectors\n const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);\n\n // Create the record batch\n const recordBatch = new RecordBatch(\n this.arrowSchema,\n makeData({\n type: new Struct(this.arrowSchema.fields),\n children: arrowVectors.map(({data}) => data[0])\n })\n );\n\n return {\n shape: 'arrow-table',\n batchType: 'data',\n data: new ApacheArrowTable([recordBatch]),\n length: batch.length\n };\n }\n\n return null;\n }\n}\n\n// Convert from a simple loaders.gl schema to an Arrow schema\nfunction getArrowSchema(schema): Schema {\n const arrowFields: Field[] = [];\n for (const key in schema) {\n const field = schema[key];\n if (field.type === Float32Array) {\n // TODO - just store the original field as metadata?\n const metadata = new Map(); // field;\n // arrow: new Field(name, nullable, metadata)\n const arrowField = new Field(field.name, new Float32(), field.nullable, metadata);\n arrowFields.push(arrowField);\n }\n }\n if (arrowFields.length === 0) {\n throw new Error('No arrow convertible fields');\n }\n\n return new Schema(arrowFields);\n}\n\n// Convert from simple loaders.gl arrays to arrow vectors\nfunction getArrowVectors(arrowSchema, data): Vector[] {\n const arrowVectors: any[] = [];\n for (const field of arrowSchema.fields) {\n const vector = data[field.name];\n if (vector instanceof Float32Array) {\n const arrowVector = makeVector(vector);\n arrowVectors.push(arrowVector);\n }\n }\n if (arrowSchema.fields.length !== arrowVectors.length) {\n throw new Error('Some columns not arrow convertible');\n }\n return arrowVectors;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAUsB,SAAAE,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA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,GAAG,IAAAC,uBAAU,EAACF,MAAM,CAAC;QACtC/B,YAAY,CAAC0B,IAAI,CAACM,WAAW,CAAC;MAChC;IACF;EAAC,SAAAvF,GAAA;IAAAoF,SAAA,CAAA1F,CAAA,CAAAM,GAAA;EAAA;IAAAoF,SAAA,CAAAxF,CAAA;EAAA;EACD,IAAIoD,WAAW,CAACe,MAAM,CAAC5E,MAAM,KAAKoE,YAAY,CAACpE,MAAM,EAAE;IACrD,MAAM,IAAI+F,KAAK,CAAC,oCAAoC,CAAC;EACvD;EACA,OAAO3B,YAAY;AACrB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=arrow-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-table.js","names":[],"sources":["../../../src/lib/arrow-table.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Batch, Schema} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\n\n/**\n * A table organized as an Apache Arrow table\n * @note This is a variant of the type from loaders.gl/schema\n */\nexport type ArrowTable = {\n shape: 'arrow-table';\n schema?: Schema;\n data: ApacheArrowTable;\n};\n\n/**\n * Batch for a table organized as an Apache Arrow table\n * @note This is a variant of the type from loaders.gl/schema\n */\nexport type ArrowTableBatch = Batch & {\n shape: 'arrow-table';\n schemaType?: 'explicit' | 'deduced';\n schema?: Schema;\n data: ApacheArrowTable; // ApacheRecordBatch;\n length: number;\n};\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"convert-table.js","names":["convertApacheArrowToArrowTable","arrowTable","shape","data","convertArrowToColumnarTable","table","columnarTable","_iterator","_createForOfIteratorHelper","schema","fields","_step","s","n","done","field","value","arrowColumn","getChild","name","values","toArray","err","e","f","convertColumnarToRowFormatTable","tableKeys","Object","keys","tableRowsCount","length","rowFormatTable","index","tableItem","keyIndex","fieldName","push"],"sources":["../../../src/lib/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {ColumnarTable, ObjectRowTable, ArrowTable} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\n\n/**\n * Wrap an apache arrow table in a loaders.gl table wrapper.\n * From this additional conversions are available.\n * @param arrowTable\n * @returns\n */\nexport function convertApacheArrowToArrowTable(arrowTable: ApacheArrowTable): ArrowTable {\n return {\n shape: 'arrow-table',\n data: arrowTable\n };\n}\n\n/**\n * Convert an Apache Arrow table to a ColumnarTable\n * @note Currently does not convert schema\n */\nexport function convertArrowToColumnarTable(table: ArrowTable): ColumnarTable {\n // TODO - avoid calling `getColumn` on columns we are not interested in?\n // Add options object?\n\n const arrowTable = table.data;\n const columnarTable = {};\n\n for (const field of arrowTable.schema.fields) {\n // This (is intended to) coalesce all record batches into a single typed array\n const arrowColumn = arrowTable.getChild(field.name);\n const values = arrowColumn?.toArray();\n columnarTable[field.name] = values;\n }\n\n return {\n shape: 'columnar-table',\n data: columnarTable\n };\n}\n\n/**\n *\n * @note - should be part of schema module\n */\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = Object.keys(columnarTable);\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const rowFormatTable: {}[] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const tableItem = {};\n for (let keyIndex = 0; keyIndex < tableKeys.length; keyIndex++) {\n const fieldName = tableKeys[keyIndex];\n tableItem[fieldName] = columnarTable[fieldName][index];\n }\n rowFormatTable.push(tableItem);\n }\n\n return {\n shape: 'object-row-table',\n data: rowFormatTable\n };\n}\n"],"mappings":";;;;;;;;;;;AAUO,SAASA,8BAA8BA,CAACC,UAA4B,EAAc;EACvF,OAAO;IACLC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAEF;EACR,CAAC;AACH;AAMO,SAASG,2BAA2BA,CAACC,KAAiB,EAAiB;EAI5E,IAAMJ,UAAU,GAAGI,KAAK,CAACF,IAAI;EAC7B,IAAMG,aAAa,GAAG,CAAC,CAAC;EAAC,I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D;IACAD,cAAc,CAACK,IAAI,CAACH,SAAS,CAAC;EAChC;EAEA,OAAO;IACL/B,KAAK,EAAE,kBAAkB;IACzBC,IAAI,EAAE4B;EACR,CAAC;AACH"}
1
+ {"version":3,"file":"convert-table.js","names":["convertApacheArrowToArrowTable","arrowTable","shape","data","convertArrowToColumnarTable","table","columnarTable","_iterator","_createForOfIteratorHelper","schema","fields","_step","s","n","done","field","value","arrowColumn","getChild","name","values","toArray","err","e","f","convertColumnarToRowFormatTable","tableKeys","Object","keys","tableRowsCount","length","rowFormatTable","index","tableItem","keyIndex","fieldName","push"],"sources":["../../../src/lib/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\nimport type {ArrowTable} from './arrow-table';\n\n/**\n * Wrap an apache arrow table in a loaders.gl table wrapper.\n * From this additional conversions are available.\n * @param arrowTable\n * @returns\n */\nexport function convertApacheArrowToArrowTable(arrowTable: ApacheArrowTable): ArrowTable {\n return {\n shape: 'arrow-table',\n data: arrowTable\n };\n}\n\n/**\n * Convert an Apache Arrow table to a ColumnarTable\n * @note Currently does not convert schema\n */\nexport function convertArrowToColumnarTable(table: ArrowTable): ColumnarTable {\n // TODO - avoid calling `getColumn` on columns we are not interested in?\n // Add options object?\n\n const arrowTable = table.data;\n const columnarTable = {};\n\n for (const field of arrowTable.schema.fields) {\n // This (is intended to) coalesce all record batches into a single typed array\n const arrowColumn = arrowTable.getChild(field.name);\n const values = arrowColumn?.toArray();\n columnarTable[field.name] = values;\n }\n\n return {\n shape: 'columnar-table',\n data: columnarTable\n };\n}\n\n/**\n *\n * @note - should be part of schema module\n */\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = Object.keys(columnarTable);\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const rowFormatTable: {}[] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const tableItem = {};\n for (let keyIndex = 0; keyIndex < tableKeys.length; keyIndex++) {\n const fieldName = tableKeys[keyIndex];\n tableItem[fieldName] = columnarTable[fieldName][index];\n }\n rowFormatTable.push(tableItem);\n }\n\n return {\n shape: 'object-row-table',\n data: rowFormatTable\n };\n}\n"],"mappings":";;;;;;;;;;;AAWO,SAASA,8BAA8BA,CAACC,UAA4B,EAAc;EACvF,OAAO;IACLC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAEF;EACR,CAAC;AACH;AAMO,SAASG,2BAA2BA,CAACC,KAAiB,EAAiB;EAI5E,IAAMJ,UAAU,GAAGI,KAAK,CAACF,IAAI;EAC7B,IAAMG,aAAa,GAAG,CAAC,CAAC;EAAC,IAAAC,SAAA,GAAAC,0BAAA,CAELP,UAAU,CAACQ,MAAM,CAACC,MAAM;IAAAC,KAAA;EAAA;IAA5C,KAAAJ,SAAA,CAAAK,CAAA,MAAAD,KAAA,GAAAJ,SAAA,CAAAM,CAAA,IAAAC,IAAA,GAA8C;MAAA,IAAnCC,KAAK,GAAAJ,KAAA,CAAAK,KAAA;MAEd,IAAMC,WAAW,GAAGhB,UAAU,CAACiB,QAAQ,CAACH,KAAK,CAACI,IAAI,CAAC;MACnD,IAAMC,MAAM,GAAGH,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEI,OAAO,CAAC,CAAC;MACrCf,aAAa,CAACS,KAAK,CAACI,IAAI,CAAC,GAAGC,MAAM;IACpC;EAAC,SAAAE,GAAA;IAAAf,SAAA,CAAAgB,CAAA,CAAAD,GAAA;EAAA;IAAAf,SAAA,CAAAiB,CAAA;EAAA;EAED,OAAO;IACLtB,KAAK,EAAE,gBAAgB;IACvBC,IAAI,EAAEG;EACR,CAAC;AACH;AAMO,SAASmB,+BAA+BA,CAACnB,aAA4B,EAAkB;EAC5F,IAAMoB,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACtB,aAAa,CAAC;EAC5C,IAAMuB,cAAc,GAAGvB,aAAa,CAACoB,SAAS,CAAC,CAAC,CAAC,CAAC,CAACI,MAAM;EAEzD,IAAMC,cAAoB,GAAG,EAAE;EAE/B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGH,cAAc,EAAEG,KAAK,EAAE,EAAE;IACnD,IAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,IAAIC,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGR,SAAS,CAACI,MAAM,EAAEI,QAAQ,EAAE,EAAE;MAC9D,IAAMC,SAAS,GAAGT,SAAS,CAACQ,QAAQ,CAAC;MACrCD,SAAS,CAACE,SAAS,CAAC,GAAG7B,aAAa,CAAC6B,SAAS,CAAC,CAACH,KAAK,CAAC;IACxD;IACAD,cAAc,CAACK,IAAI,CAACH,SAAS,CAAC;EAChC;EAEA,OAAO;IACL/B,KAAK,EAAE,kBAAkB;IACzBC,IAAI,EAAE4B;EACR,CAAC;AACH"}
@@ -51,7 +51,7 @@ function parseArrowInBatches(asyncIterator) {
51
51
  arrowTabledBatch = {
52
52
  shape: 'arrow-table',
53
53
  batchType: 'data',
54
- data: recordBatch,
54
+ data: new _apacheArrow.Table([recordBatch]),
55
55
  length: recordBatch.data.length
56
56
  };
57
57
  _context.next = 20;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-in-batches.js","names":["_apacheArrow","require","_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","AsyncFromSyncIteratorContinuation","r","Object","Promise","reject","done","resolve","value","then","n","next","prototype","apply","arguments","return","_return","ret","throw","_throw","thr","parseArrowInBatches","makeArrowAsyncIterator","_makeArrowAsyncIterator","_wrapAsyncGenerator2","default","_regenerator","mark","_callee","readers","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","reader","_iteratorAbruptCompletion2","_didIteratorError2","_iteratorError2","_iterator2","_step2","recordBatch","arrowTabledBatch","wrap","_callee$","_context","prev","RecordBatchReader","readAll","_awaitAsyncGenerator2","sent","shape","batchType","data","length","t0","finish","abrupt","t1","stop"],"sources":["../../../src/lib/parse-arrow-in-batches.ts"],"sourcesContent":["// TODO - this import defeats the sophisticated typescript checking in ArrowJS\nimport {ArrowTableBatch} from '@loaders.gl/schema';\nimport {RecordBatchReader} from 'apache-arrow';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrowTableBatch> {\n // Creates the appropriate RecordBatchReader subclasses from the input\n // This will also close the underlying source in case of early termination or errors\n\n // As an optimization, return a non-async iterator\n /*\n if (isIterable(readers)) {\n function* makeArrowIterator() {\n for (const reader of readers) {\n for (const batch of reader) {\n yield processBatch(batch, reader);\n }\n break; // only processing one stream of batches\n }\n }\n const arrowIterator = makeArrowIterator();\n }\n */\n\n async function* makeArrowAsyncIterator(): AsyncIterator<ArrowTableBatch> {\n // @ts-ignore\n const readers = RecordBatchReader.readAll(asyncIterator);\n for await (const reader of readers) {\n for await (const recordBatch of reader) {\n const arrowTabledBatch: ArrowTableBatch = {\n shape: 'arrow-table',\n batchType: 'data',\n data: recordBatch,\n length: recordBatch.data.length\n };\n // processBatch(recordBatch);\n yield arrowTabledBatch;\n }\n break; // only processing one stream of batches\n }\n }\n\n return makeArrowAsyncIterator() as any; // as AsyncIterator<ArrowTableBatch>;\n}\n\n// function processBatch(batch: RecordBatch): ArrowTableBatch {\n// const values = {};\n// batch.schema.fields.forEach(({name}, index) => {\n// values[name] = batch.getChildAt(index)?.toArray();\n// });\n// return {\n\n// };\n// }\n"],"mappings":";;;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAA+C,SAAAC,eAAAC,QAAA,QAAAC,MAAA,EAAAC,KAAA,EAAAC,IAAA,EAAAC,KAAA,iCAAAC,MAAA,KAAAH,KAAA,GAAAG,MAAA,CAAAC,aAAA,EAAAH,IAAA,GAAAE,MAAA,CAAAE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D,QAAA,CAAAa,EAAA,GAAAb,QAAA;YAAAd,iBAAA;YAAAC,cAAA,GAAAa,QAAA,CAAAa,EAAA;UAAA;YAAAb,QAAA,CAAAC,IAAA;YAAAD,QAAA,CAAAC,IAAA;YAAA,MAAAhB,yBAAA,IAAAG,SAAA,CAAAlB,MAAA;cAAA8B,QAAA,CAAAlC,IAAA;cAAA;YAAA;YAAAkC,QAAA,CAAAlC,IAAA;YAAA,WAAAsC,qBAAA,CAAAxB,OAAA,EAAAQ,SAAA,CAAAlB,MAAA;UAAA;YAAA8B,QAAA,CAAAC,IAAA;YAAA,KAAAf,iBAAA;cAAAc,QAAA,CAAAlC,IAAA;cAAA;YAAA;YAAA,MAAAqB,cAAA;UAAA;YAAA,OAAAa,QAAA,CAAAW,MAAA;UAAA;YAAA,OAAAX,QAAA,CAAAW,MAAA;UAAA;UAAA;YAAA,OAAAX,QAAA,CAAAc,IAAA;QAAA;MAAA,GAAA/B,OAAA;IAAA,CAI3B;IAAA,OAAAL,uBAAA,CAAAV,KAAA,OAAAC,SAAA;EAAA;EAED,OAAOQ,sBAAsB,CAAC,CAAC;AACjC"}
1
+ {"version":3,"file":"parse-arrow-in-batches.js","names":["_apacheArrow","require","_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","AsyncFromSyncIteratorContinuation","r","Object","Promise","reject","done","resolve","value","then","n","next","prototype","apply","arguments","return","_return","ret","throw","_throw","thr","parseArrowInBatches","makeArrowAsyncIterator","_makeArrowAsyncIterator","_wrapAsyncGenerator2","default","_regenerator","mark","_callee","readers","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","reader","_iteratorAbruptCompletion2","_didIteratorError2","_iteratorError2","_iterator2","_step2","recordBatch","arrowTabledBatch","wrap","_callee$","_context","prev","RecordBatchReader","readAll","_awaitAsyncGenerator2","sent","shape","batchType","data","ApacheArrowTable","length","t0","finish","abrupt","t1","stop"],"sources":["../../../src/lib/parse-arrow-in-batches.ts"],"sourcesContent":["// TODO - this import defeats the sophisticated typescript checking in ArrowJS\nimport type {ArrowTableBatch} from './arrow-table';\nimport {RecordBatchReader, Table as ApacheArrowTable} from 'apache-arrow';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrowTableBatch> {\n // Creates the appropriate RecordBatchReader subclasses from the input\n // This will also close the underlying source in case of early termination or errors\n\n // As an optimization, return a non-async iterator\n /*\n if (isIterable(readers)) {\n function* makeArrowIterator() {\n for (const reader of readers) {\n for (const batch of reader) {\n yield processBatch(batch, reader);\n }\n break; // only processing one stream of batches\n }\n }\n const arrowIterator = makeArrowIterator();\n }\n */\n\n async function* makeArrowAsyncIterator(): AsyncIterator<ArrowTableBatch> {\n // @ts-ignore\n const readers = RecordBatchReader.readAll(asyncIterator);\n for await (const reader of readers) {\n for await (const recordBatch of reader) {\n const arrowTabledBatch: ArrowTableBatch = {\n shape: 'arrow-table',\n batchType: 'data',\n data: new ApacheArrowTable([recordBatch]),\n length: recordBatch.data.length\n };\n // processBatch(recordBatch);\n yield arrowTabledBatch;\n }\n break; // only processing one stream of batches\n }\n }\n\n return makeArrowAsyncIterator() as any; // as AsyncIterator<ArrowTableBatch>;\n}\n\n// function processBatch(batch: RecordBatch): ArrowTableBatch {\n// const values = {};\n// batch.schema.fields.forEach(({name}, index) => {\n// values[name] = batch.getChildAt(index)?.toArray();\n// });\n// return {\n\n// };\n// }\n"],"mappings":";;;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAA0E,SAAAC,eAAAC,QAAA,QAAAC,MAAA,EAAAC,KAAA,EAAAC,IAAA,EAAAC,KAAA,iCAAAC,MAAA,KAAAH,KAAA,GAAAG,MAAA,CAAAC,aAAA,EAAAH,IAAA,GAAAE,MAAA,CAAAE,QAAA,GAAAH,KAAA,WAAAF,KAAA,aAAAD,MAAA,G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CAAAc,EAAA,GAAAd,QAAA;YAAAd,iBAAA;YAAAC,cAAA,GAAAa,QAAA,CAAAc,EAAA;UAAA;YAAAd,QAAA,CAAAC,IAAA;YAAAD,QAAA,CAAAC,IAAA;YAAA,MAAAhB,yBAAA,IAAAG,SAAA,CAAAlB,MAAA;cAAA8B,QAAA,CAAAlC,IAAA;cAAA;YAAA;YAAAkC,QAAA,CAAAlC,IAAA;YAAA,WAAAsC,qBAAA,CAAAxB,OAAA,EAAAQ,SAAA,CAAAlB,MAAA;UAAA;YAAA8B,QAAA,CAAAC,IAAA;YAAA,KAAAf,iBAAA;cAAAc,QAAA,CAAAlC,IAAA;cAAA;YAAA;YAAA,MAAAqB,cAAA;UAAA;YAAA,OAAAa,QAAA,CAAAY,MAAA;UAAA;YAAA,OAAAZ,QAAA,CAAAY,MAAA;UAAA;UAAA;YAAA,OAAAZ,QAAA,CAAAe,IAAA;QAAA;MAAA,GAAAhC,OAAA;IAAA,CAI3B;IAAA,OAAAL,uBAAA,CAAAV,KAAA,OAAAC,SAAA;EAAA;EAED,OAAOQ,sBAAsB,CAAC,CAAC;AACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-sync.js","names":["_schema","require","_apacheArrow","_convertTable","parseArrowSync","arrayBuffer","options","_options$arrow","apacheArrowTable","tableFromIPC","Uint8Array","arrowTable","convertApacheArrowToArrowTable","shape","arrow","convertArrowToColumnarTable","columnarTable","convertTable","Error"],"sources":["../../../src/lib/parse-arrow-sync.ts"],"sourcesContent":["import type {ArrowTable, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport {convertTable} from '@loaders.gl/schema';\nimport {tableFromIPC} from 'apache-arrow';\nimport type {ArrowLoaderOptions} from '../arrow-loader';\nimport {convertApacheArrowToArrowTable, convertArrowToColumnarTable} from './convert-table';\n\n// Parses arrow to a columnar table\nexport default function parseArrowSync(\n arrayBuffer,\n options?: ArrowLoaderOptions\n): ArrowTable | ColumnarTable | ObjectRowTable {\n const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);\n const arrowTable = convertApacheArrowToArrowTable(apacheArrowTable);\n\n const shape = options?.arrow?.shape || 'arrow-table';\n switch (shape) {\n case 'arrow-table':\n return arrowTable;\n\n case 'columnar-table':\n return convertArrowToColumnarTable(arrowTable);\n\n case 'object-row-table':\n const columnarTable = convertArrowToColumnarTable(arrowTable);\n return convertTable(columnarTable, 'object-row-table');\n\n default:\n // TODO\n throw new Error(shape);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAGe,SAASG,cAAcA,CACpCC,WAAW,EACXC,OAA4B,EACiB;EAAA,IAAAC,cAAA;EAC7C,IAAMC,gBAAgB,GAAG,IAAAC,yBAAY,EAAC,CAAC,IAAIC,UAAU,CAACL,WAAW,CAAC,CAAC,CAAC;EACpE,IAAMM,UAAU,GAAG,IAAAC,4CAA8B,EAACJ,gBAAgB,CAAC;EAEnE,IAAMK,KAAK,GAAG,CAAAP,OAAO,aAAPA,OAAO,wBAAAC,cAAA,GAAPD,OAAO,CAAEQ,KAAK,cAAAP,cAAA,uBAAdA,cAAA,CAAgBM,KAAK,KAAI,aAAa;EACpD,QAAQA,KAAK;IACX,KAAK,aAAa;MAChB,OAAOF,UAAU;IAEnB,KAAK,gBAAgB;MACnB,OAAO,IAAAI,yCAA2B,EAACJ,UAAU,CAAC;IAEhD,KAAK,kBAAkB;MACrB,IAAMK,aAAa,GAAG,IAAAD,yCAA2B,EAACJ,UAAU,CAAC;MAC7D,OAAO,IAAAM,oBAAY,EAACD,aAAa,EAAE,kBAAkB,CAAC;IAExD;MAEE,MAAM,IAAIE,KAAK,CAACL,KAAK,CAAC;EAC1B;AACF"}
1
+ {"version":3,"file":"parse-arrow-sync.js","names":["_schema","require","_apacheArrow","_convertTable","parseArrowSync","arrayBuffer","options","_options$arrow","apacheArrowTable","tableFromIPC","Uint8Array","arrowTable","convertApacheArrowToArrowTable","shape","arrow","convertArrowToColumnarTable","columnarTable","convertTable","Error"],"sources":["../../../src/lib/parse-arrow-sync.ts"],"sourcesContent":["import type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {ArrowTable} from './arrow-table';\nimport {convertTable} from '@loaders.gl/schema';\nimport {tableFromIPC} from 'apache-arrow';\nimport type {ArrowLoaderOptions} from '../arrow-loader';\nimport {convertApacheArrowToArrowTable, convertArrowToColumnarTable} from './convert-table';\n\n// Parses arrow to a columnar table\nexport default function parseArrowSync(\n arrayBuffer,\n options?: ArrowLoaderOptions\n): ArrowTable | ColumnarTable | ObjectRowTable {\n const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);\n const arrowTable = convertApacheArrowToArrowTable(apacheArrowTable);\n\n const shape = options?.arrow?.shape || 'arrow-table';\n switch (shape) {\n case 'arrow-table':\n return arrowTable;\n\n case 'columnar-table':\n return convertArrowToColumnarTable(arrowTable);\n\n case 'object-row-table':\n const columnarTable = convertArrowToColumnarTable(arrowTable);\n return convertTable(columnarTable, 'object-row-table');\n\n default:\n // TODO\n throw new Error(shape);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAGe,SAASG,cAAcA,CACpCC,WAAW,EACXC,OAA4B,EACiB;EAAA,IAAAC,cAAA;EAC7C,IAAMC,gBAAgB,GAAG,IAAAC,yBAAY,EAAC,CAAC,IAAIC,UAAU,CAACL,WAAW,CAAC,CAAC,CAAC;EACpE,IAAMM,UAAU,GAAG,IAAAC,4CAA8B,EAACJ,gBAAgB,CAAC;EAEnE,IAAMK,KAAK,GAAG,CAAAP,OAAO,aAAPA,OAAO,wBAAAC,cAAA,GAAPD,OAAO,CAAEQ,KAAK,cAAAP,cAAA,uBAAdA,cAAA,CAAgBM,KAAK,KAAI,aAAa;EACpD,QAAQA,KAAK;IACX,KAAK,aAAa;MAChB,OAAOF,UAAU;IAEnB,KAAK,gBAAgB;MACnB,OAAO,IAAAI,yCAA2B,EAACJ,UAAU,CAAC;IAEhD,KAAK,kBAAkB;MACrB,IAAMK,aAAa,GAAG,IAAAD,yCAA2B,EAACJ,UAAU,CAAC;MAC7D,OAAO,IAAAM,oBAAY,EAACD,aAAa,EAAE,kBAAkB,CAAC;IAExD;MAEE,MAAM,IAAIE,KAAK,CAACL,KAAK,CAAC;EAC1B;AACF"}
@@ -1,4 +1,4 @@
1
- const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
1
+ const VERSION = typeof "4.0.0-alpha.26" !== 'undefined' ? "4.0.0-alpha.26" : 'latest';
2
2
  export const ArrowLoader = {
3
3
  name: 'Apache Arrow',
4
4
  id: 'arrow',
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-loader.js","names":["VERSION","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape"],"sources":["../../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":"AAMA,MAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAS3E,OAAO,MAAMC,WAA0D,GAAG;EACxEC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEL,OAAO;EAEhBM,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC"}
1
+ {"version":3,"file":"arrow-loader.js","names":["VERSION","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape"],"sources":["../../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from './lib/arrow-table';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":"AAMA,MAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAS3E,OAAO,MAAMC,WAA0D,GAAG;EACxEC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEL,OAAO;EAEhBM,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { encodeArrowSync } from './lib/encode-arrow';
2
- const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
2
+ const VERSION = typeof "4.0.0-alpha.26" !== 'undefined' ? "4.0.0-alpha.26" : 'latest';
3
3
  export const ArrowWriter = {
4
4
  name: 'Apache Arrow',
5
5
  id: 'arrow',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["TableBatchBuilder","ArrowLoader","ArrowWorkerLoader","parseSync","parseArrowInBatches","ArrowTableBatchAggregator","ArrowBatch","VECTOR_TYPES","ArrowWriter","parse","arraybuffer","options","parseInBatches"],"sources":["../../src/index.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArrowLoaderOptions} from './arrow-loader';\nimport {ArrowTable, ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {ArrowLoader as ArrowWorkerLoader} from './arrow-loader';\nimport parseSync from './lib/parse-arrow-sync';\nimport {parseArrowInBatches} from './lib/parse-arrow-in-batches';\n\nimport {ArrowTableBatchAggregator} from './lib/arrow-table-batch';\n\n// Make the ArrowBatch type available\nTableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;\n\n// Types\nexport {VECTOR_TYPES} from './types';\n\n// Arrow writer\n\nexport {ArrowWriter} from './arrow-writer';\n\n// Arrow loader\n\nexport type {ArrowLoaderOptions};\nexport {ArrowWorkerLoader};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseSync(arraybuffer, options),\n parseSync,\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":"AAGA,SAAQA,iBAAiB,QAAO,oBAAoB;AACpD,SAAQC,WAAW,IAAIC,iBAAiB,QAAO,gBAAgB;AAC/D,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAAQC,mBAAmB,QAAO,8BAA8B;AAEhE,SAAQC,yBAAyB,QAAO,yBAAyB;AAGjEL,iBAAiB,CAACM,UAAU,GAAGD,yBAAyB;AAGxD,SAAQE,YAAY,QAAO,SAAS;AAIpC,SAAQC,WAAW,QAAO,gBAAgB;AAK1C,SAAQN,iBAAiB;AAGzB,OAAO,MAAMD,WAIZ,GAAG;EACF,GAAGC,iBAAiB;EACpBO,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAA4B,KAClER,SAAS,CAACO,WAAW,EAAEC,OAAO,CAAC;EACjCR,SAAS;EACTS,cAAc,EAAER;AAClB,CAAC"}
1
+ {"version":3,"file":"index.js","names":["TableBatchBuilder","ArrowLoader","ArrowWorkerLoader","parseSync","parseArrowInBatches","ArrowTableBatchAggregator","ArrowBatch","VECTOR_TYPES","ArrowWriter","parse","arraybuffer","options","parseInBatches"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArrowLoaderOptions} from './arrow-loader';\nimport type {ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {ArrowTable} from './lib/arrow-table';\n\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {ArrowLoader as ArrowWorkerLoader} from './arrow-loader';\nimport parseSync from './lib/parse-arrow-sync';\nimport {parseArrowInBatches} from './lib/parse-arrow-in-batches';\n\nimport {ArrowTableBatchAggregator} from './lib/arrow-table-batch';\n\n// Make the ArrowBatch type available\nTableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;\n\n// Types\nexport type {ArrowTable, ArrowTableBatch} from './lib/arrow-table';\nexport {VECTOR_TYPES} from './types';\n\n// Arrow writer\n\nexport {ArrowWriter} from './arrow-writer';\n\n// Arrow loader\n\nexport type {ArrowLoaderOptions};\nexport {ArrowWorkerLoader};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseSync(arraybuffer, options),\n parseSync,\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":"AAOA,SAAQA,iBAAiB,QAAO,oBAAoB;AACpD,SAAQC,WAAW,IAAIC,iBAAiB,QAAO,gBAAgB;AAC/D,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAAQC,mBAAmB,QAAO,8BAA8B;AAEhE,SAAQC,yBAAyB,QAAO,yBAAyB;AAGjEL,iBAAiB,CAACM,UAAU,GAAGD,yBAAyB;AAIxD,SAAQE,YAAY,QAAO,SAAS;AAIpC,SAAQC,WAAW,QAAO,gBAAgB;AAK1C,SAAQN,iBAAiB;AAGzB,OAAO,MAAMD,WAIZ,GAAG;EACF,GAAGC,iBAAiB;EACpBO,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAA4B,KAClER,SAAS,CAACO,WAAW,EAAEC,OAAO,CAAC;EACjCR,SAAS;EACTS,cAAc,EAAER;AAClB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Schema, Field, RecordBatch, Struct, makeVector, makeData, Float32 } from 'apache-arrow';
3
2
  import { ColumnarTableBatchAggregator } from '@loaders.gl/schema';
3
+ import { Table as ApacheArrowTable, Schema, Field, RecordBatch, Struct, makeVector, makeData, Float32 } from 'apache-arrow';
4
4
  export class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
5
5
  constructor(schema, options) {
6
6
  super(schema, options);
@@ -24,7 +24,7 @@ export class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
24
24
  return {
25
25
  shape: 'arrow-table',
26
26
  batchType: 'data',
27
- data: recordBatch,
27
+ data: new ApacheArrowTable([recordBatch]),
28
28
  length: batch.length
29
29
  };
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-table-batch.js","names":["Schema","Field","RecordBatch","Struct","makeVector","makeData","Float32","ColumnarTableBatchAggregator","ArrowTableBatchAggregator","constructor","schema","options","_defineProperty","arrowSchema","getBatch","batch","getArrowSchema","arrowVectors","getArrowVectors","data","recordBatch","type","fields","children","map","_ref","shape","batchType","length","arrowFields","key","field","Float32Array","metadata","Map","arrowField","name","nullable","push","Error","vector","arrowVector"],"sources":["../../../src/lib/arrow-table-batch.ts"],"sourcesContent":["import type {ArrowTableBatch} from '@loaders.gl/schema';\nimport {\n Schema,\n Field,\n RecordBatch,\n Struct,\n makeVector,\n makeData,\n Vector,\n Float32\n} from 'apache-arrow';\nimport {ColumnarTableBatchAggregator} from '@loaders.gl/schema';\n\nexport class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {\n arrowSchema: Schema | null;\n\n constructor(schema, options) {\n super(schema, options);\n this.arrowSchema = null;\n }\n\n getBatch(): ArrowTableBatch | null {\n const batch = super.getBatch();\n if (batch) {\n // Get the arrow schema\n this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);\n\n // Get arrow format vectors\n const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);\n\n // Create the record batch\n const recordBatch = new RecordBatch(\n this.arrowSchema,\n makeData({\n type: new Struct(this.arrowSchema.fields),\n children: arrowVectors.map(({data}) => data[0])\n })\n );\n\n return {\n shape: 'arrow-table',\n batchType: 'data',\n data: recordBatch,\n length: batch.length\n };\n }\n\n return null;\n }\n}\n\n// Convert from a simple loaders.gl schema to an Arrow schema\nfunction getArrowSchema(schema): Schema {\n const arrowFields: Field[] = [];\n for (const key in schema) {\n const field = schema[key];\n if (field.type === Float32Array) {\n // TODO - just store the original field as metadata?\n const metadata = new Map(); // field;\n // arrow: new Field(name, nullable, metadata)\n const arrowField = new Field(field.name, new Float32(), field.nullable, metadata);\n arrowFields.push(arrowField);\n }\n }\n if (arrowFields.length === 0) {\n throw new Error('No arrow convertible fields');\n }\n\n return new Schema(arrowFields);\n}\n\n// Convert from simple loaders.gl arrays to arrow vectors\nfunction getArrowVectors(arrowSchema, data): Vector[] {\n const arrowVectors: any[] = [];\n for (const field of arrowSchema.fields) {\n const vector = data[field.name];\n if (vector instanceof Float32Array) {\n const arrowVector = makeVector(vector);\n arrowVectors.push(arrowVector);\n }\n }\n if (arrowSchema.fields.length !== arrowVectors.length) {\n throw new Error('Some columns not arrow convertible');\n }\n return arrowVectors;\n}\n"],"mappings":";AACA,SACEA,MAAM,EACNC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,UAAU,EACVC,QAAQ,EAERC,OAAO,QACF,cAAc;AACrB,SAAQC,4BAA4B,QAAO,oBAAoB;AAE/D,OAAO,MAAMC,yBAAyB,SAASD,4BAA4B,CAAC;EAG1EE,WAAWA,CAACC,MAAM,EAAEC,OAAO,EAAE;IAC3B,KAAK,CAACD,MAAM,EAAEC,OAAO,CAAC;IAACC,eAAA;IACvB,IAAI,CAACC,WAAW,GAA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CAACS,IAAI,CAACH,UAAU,CAAC;IAC9B;EACF;EACA,IAAIN,WAAW,CAACD,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIW,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAO,IAAIvC,MAAM,CAAC6B,WAAW,CAAC;AAChC;AAGA,SAASX,eAAeA,CAACL,WAAW,EAAEM,IAAI,EAAY;EACpD,MAAMF,YAAmB,GAAG,EAAE;EAC9B,KAAK,MAAMc,KAAK,IAAIlB,WAAW,CAACS,MAAM,EAAE;IACtC,MAAMkB,MAAM,GAAGrB,IAAI,CAACY,KAAK,CAACK,IAAI,CAAC;IAC/B,IAAII,MAAM,YAAYR,YAAY,EAAE;MAClC,MAAMS,WAAW,GAAGrC,UAAU,CAACoC,MAAM,CAAC;MACtCvB,YAAY,CAACqB,IAAI,CAACG,WAAW,CAAC;IAChC;EACF;EACA,IAAI5B,WAAW,CAACS,MAAM,CAACM,MAAM,KAAKX,YAAY,CAACW,MAAM,EAAE;IACrD,MAAM,IAAIW,KAAK,CAAC,oCAAoC,CAAC;EACvD;EACA,OAAOtB,YAAY;AACrB"}
1
+ {"version":3,"file":"arrow-table-batch.js","names":["ColumnarTableBatchAggregator","Table","ApacheArrowTable","Schema","Field","RecordBatch","Struct","makeVector","makeData","Float32","ArrowTableBatchAggregator","constructor","schema","options","_defineProperty","arrowSchema","getBatch","batch","getArrowSchema","arrowVectors","getArrowVectors","data","recordBatch","type","fields","children","map","_ref","shape","batchType","length","arrowFields","key","field","Float32Array","metadata","Map","arrowField","name","nullable","push","Error","vector","arrowVector"],"sources":["../../../src/lib/arrow-table-batch.ts"],"sourcesContent":["import {ColumnarTableBatchAggregator} from '@loaders.gl/schema';\nimport type {ArrowTableBatch} from './arrow-table';\nimport {\n Table as ApacheArrowTable,\n Schema,\n Field,\n RecordBatch,\n Struct,\n makeVector,\n makeData,\n Vector,\n Float32\n} from 'apache-arrow';\n\nexport class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {\n arrowSchema: Schema | null;\n\n constructor(schema, options) {\n super(schema, options);\n this.arrowSchema = null;\n }\n\n getBatch(): ArrowTableBatch | null {\n const batch = super.getBatch();\n if (batch) {\n // Get the arrow schema\n this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);\n\n // Get arrow format vectors\n const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);\n\n // Create the record batch\n const recordBatch = new RecordBatch(\n this.arrowSchema,\n makeData({\n type: new Struct(this.arrowSchema.fields),\n children: arrowVectors.map(({data}) => data[0])\n })\n );\n\n return {\n shape: 'arrow-table',\n batchType: 'data',\n data: new ApacheArrowTable([recordBatch]),\n length: batch.length\n };\n }\n\n return null;\n }\n}\n\n// Convert from a simple loaders.gl schema to an Arrow schema\nfunction getArrowSchema(schema): Schema {\n const arrowFields: Field[] = [];\n for (const key in schema) {\n const field = schema[key];\n if (field.type === Float32Array) {\n // TODO - just store the original field as metadata?\n const metadata = new Map(); // field;\n // arrow: new Field(name, nullable, metadata)\n const arrowField = new Field(field.name, new Float32(), field.nullable, metadata);\n arrowFields.push(arrowField);\n }\n }\n if (arrowFields.length === 0) {\n throw new Error('No arrow convertible fields');\n }\n\n return new Schema(arrowFields);\n}\n\n// Convert from simple loaders.gl arrays to arrow vectors\nfunction getArrowVectors(arrowSchema, data): Vector[] {\n const arrowVectors: any[] = [];\n for (const field of arrowSchema.fields) {\n const vector = data[field.name];\n if (vector instanceof Float32Array) {\n const arrowVector = makeVector(vector);\n arrowVectors.push(arrowVector);\n }\n }\n if (arrowSchema.fields.length !== arrowVectors.length) {\n throw new Error('Some columns not arrow convertible');\n }\n return arrowVectors;\n}\n"],"mappings":";AAAA,SAAQA,4BAA4B,QAAO,oBAAoB;AAE/D,SACEC,KAAK,IAAIC,gBAAgB,EACzBC,MAAM,EACNC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,UAAU,EACVC,QAAQ,EAERC,OAAO,QACF,cAAc;AAErB,OAAO,MAAMC,yBAAyB,SAAS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AIC,GAAG,CAAC,CAAC;MAE1B,MAAMC,UAAU,GAAG,IAAIjC,KAAK,CAAC6B,KAAK,CAACK,IAAI,EAAE,IAAI7B,OAAO,CAAC,CAAC,EAAEwB,KAAK,CAACM,QAAQ,EAAEJ,QAAQ,CAAC;MACjFJ,WAAW,CAACS,IAAI,CAACH,UAAU,CAAC;IAC9B;EACF;EACA,IAAIN,WAAW,CAACD,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIW,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAO,IAAItC,MAAM,CAAC4B,WAAW,CAAC;AAChC;AAGA,SAASX,eAAeA,CAACL,WAAW,EAAEM,IAAI,EAAY;EACpD,MAAMF,YAAmB,GAAG,EAAE;EAC9B,KAAK,MAAMc,KAAK,IAAIlB,WAAW,CAACS,MAAM,EAAE;IACtC,MAAMkB,MAAM,GAAGrB,IAAI,CAACY,KAAK,CAACK,IAAI,CAAC;IAC/B,IAAII,MAAM,YAAYR,YAAY,EAAE;MAClC,MAAMS,WAAW,GAAGpC,UAAU,CAACmC,MAAM,CAAC;MACtCvB,YAAY,CAACqB,IAAI,CAACG,WAAW,CAAC;IAChC;EACF;EACA,IAAI5B,WAAW,CAACS,MAAM,CAACM,MAAM,KAAKX,YAAY,CAACW,MAAM,EAAE;IACrD,MAAM,IAAIW,KAAK,CAAC,oCAAoC,CAAC;EACvD;EACA,OAAOtB,YAAY;AACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=arrow-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-table.js","names":[],"sources":["../../../src/lib/arrow-table.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Batch, Schema} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\n\n/**\n * A table organized as an Apache Arrow table\n * @note This is a variant of the type from loaders.gl/schema\n */\nexport type ArrowTable = {\n shape: 'arrow-table';\n schema?: Schema;\n data: ApacheArrowTable;\n};\n\n/**\n * Batch for a table organized as an Apache Arrow table\n * @note This is a variant of the type from loaders.gl/schema\n */\nexport type ArrowTableBatch = Batch & {\n shape: 'arrow-table';\n schemaType?: 'explicit' | 'deduced';\n schema?: Schema;\n data: ApacheArrowTable; // ApacheRecordBatch;\n length: number;\n};\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"convert-table.js","names":["convertApacheArrowToArrowTable","arrowTable","shape","data","convertArrowToColumnarTable","table","columnarTable","field","schema","fields","arrowColumn","getChild","name","values","toArray","convertColumnarToRowFormatTable","tableKeys","Object","keys","tableRowsCount","length","rowFormatTable","index","tableItem","keyIndex","fieldName","push"],"sources":["../../../src/lib/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {ColumnarTable, ObjectRowTable, ArrowTable} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\n\n/**\n * Wrap an apache arrow table in a loaders.gl table wrapper.\n * From this additional conversions are available.\n * @param arrowTable\n * @returns\n */\nexport function convertApacheArrowToArrowTable(arrowTable: ApacheArrowTable): ArrowTable {\n return {\n shape: 'arrow-table',\n data: arrowTable\n };\n}\n\n/**\n * Convert an Apache Arrow table to a ColumnarTable\n * @note Currently does not convert schema\n */\nexport function convertArrowToColumnarTable(table: ArrowTable): ColumnarTable {\n // TODO - avoid calling `getColumn` on columns we are not interested in?\n // Add options object?\n\n const arrowTable = table.data;\n const columnarTable = {};\n\n for (const field of arrowTable.schema.fields) {\n // This (is intended to) coalesce all record batches into a single typed array\n const arrowColumn = arrowTable.getChild(field.name);\n const values = arrowColumn?.toArray();\n columnarTable[field.name] = values;\n }\n\n return {\n shape: 'columnar-table',\n data: columnarTable\n };\n}\n\n/**\n *\n * @note - should be part of schema module\n */\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = Object.keys(columnarTable);\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const rowFormatTable: {}[] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const tableItem = {};\n for (let keyIndex = 0; keyIndex < tableKeys.length; keyIndex++) {\n const fieldName = tableKeys[keyIndex];\n tableItem[fieldName] = columnarTable[fieldName][index];\n }\n rowFormatTable.push(tableItem);\n }\n\n return {\n shape: 'object-row-table',\n data: rowFormatTable\n };\n}\n"],"mappings":"AAUA,OAAO,SAASA,8BAA8BA,CAACC,UAA4B,EAAc;EACvF,OAAO;IACLC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAEF;EACR,CAAC;AACH;AAMA,OAAO,SAASG,2BAA2BA,CAACC,KAAiB,EAAiB;EAI5E,MAAMJ,UAAU,GAAGI,KAAK,CAACF,IAAI;EAC7B,MAAMG,aAAa,GAAG,CAAC,CAAC;EAExB,KAAK,MAAMC,KAAK,IAAIN,UAAU,CAACO,MAAM,CAACC,MAAM,EAAE;IAE5C,MAAMC,WAAW,GAAGT,UAAU,CAACU,QAAQ,CAACJ,KAAK,CAACK,IAAI,CAAC;IACnD,MAAMC,MAAM,GAAGH,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEI,OAAO,CAAC,CAAC;IACrCR,aAAa,CAACC,KAAK,CAACK,IAAI,CAAC,GAAGC,MAAM;EACpC;EAEA,OAAO;IACLX,KAAK,EAAE,gBAAgB;IACvBC,IAAI,EAAEG;EACR,CAAC;AACH;AAMA,OAAO,SAASS,+BAA+BA,CAACT,aAA4B,EAAkB;EAC5F,MAAMU,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACZ,aAAa,CAAC;EAC5C,MAAMa,cAAc,GAAGb,aAAa,CAACU,SAAS,CAAC,CAAC,CAAC,CAAC,CAACI,MAAM;EAEzD,MAAMC,cAAoB,GAAG,EAAE;EAE/B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGH,cAAc,EAAEG,KAAK,EAAE,EAAE;IACnD,MAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,IAAIC,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGR,SAAS,CAACI,MAAM,EAAEI,QAAQ,EAAE,EAAE;MAC9D,MAAMC,SAAS,GAAGT,SAAS,CAACQ,QAAQ,CAAC;MACrCD,SAAS,CAACE,SAAS,CAAC,GAAGnB,aAAa,CAACmB,SAAS,CAAC,CAACH,KAAK,CAAC;IACxD;IACAD,cAAc,CAACK,IAAI,CAACH,SAAS,CAAC;EAChC;EAEA,OAAO;IACLrB,KAAK,EAAE,kBAAkB;IACzBC,IAAI,EAAEkB;EACR,CAAC;AACH"}
1
+ {"version":3,"file":"convert-table.js","names":["convertApacheArrowToArrowTable","arrowTable","shape","data","convertArrowToColumnarTable","table","columnarTable","field","schema","fields","arrowColumn","getChild","name","values","toArray","convertColumnarToRowFormatTable","tableKeys","Object","keys","tableRowsCount","length","rowFormatTable","index","tableItem","keyIndex","fieldName","push"],"sources":["../../../src/lib/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {Table as ApacheArrowTable} from 'apache-arrow';\nimport type {ArrowTable} from './arrow-table';\n\n/**\n * Wrap an apache arrow table in a loaders.gl table wrapper.\n * From this additional conversions are available.\n * @param arrowTable\n * @returns\n */\nexport function convertApacheArrowToArrowTable(arrowTable: ApacheArrowTable): ArrowTable {\n return {\n shape: 'arrow-table',\n data: arrowTable\n };\n}\n\n/**\n * Convert an Apache Arrow table to a ColumnarTable\n * @note Currently does not convert schema\n */\nexport function convertArrowToColumnarTable(table: ArrowTable): ColumnarTable {\n // TODO - avoid calling `getColumn` on columns we are not interested in?\n // Add options object?\n\n const arrowTable = table.data;\n const columnarTable = {};\n\n for (const field of arrowTable.schema.fields) {\n // This (is intended to) coalesce all record batches into a single typed array\n const arrowColumn = arrowTable.getChild(field.name);\n const values = arrowColumn?.toArray();\n columnarTable[field.name] = values;\n }\n\n return {\n shape: 'columnar-table',\n data: columnarTable\n };\n}\n\n/**\n *\n * @note - should be part of schema module\n */\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = Object.keys(columnarTable);\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const rowFormatTable: {}[] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const tableItem = {};\n for (let keyIndex = 0; keyIndex < tableKeys.length; keyIndex++) {\n const fieldName = tableKeys[keyIndex];\n tableItem[fieldName] = columnarTable[fieldName][index];\n }\n rowFormatTable.push(tableItem);\n }\n\n return {\n shape: 'object-row-table',\n data: rowFormatTable\n };\n}\n"],"mappings":"AAWA,OAAO,SAASA,8BAA8BA,CAACC,UAA4B,EAAc;EACvF,OAAO;IACLC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAEF;EACR,CAAC;AACH;AAMA,OAAO,SAASG,2BAA2BA,CAACC,KAAiB,EAAiB;EAI5E,MAAMJ,UAAU,GAAGI,KAAK,CAACF,IAAI;EAC7B,MAAMG,aAAa,GAAG,CAAC,CAAC;EAExB,KAAK,MAAMC,KAAK,IAAIN,UAAU,CAACO,MAAM,CAACC,MAAM,EAAE;IAE5C,MAAMC,WAAW,GAAGT,UAAU,CAACU,QAAQ,CAACJ,KAAK,CAACK,IAAI,CAAC;IACnD,MAAMC,MAAM,GAAGH,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEI,OAAO,CAAC,CAAC;IACrCR,aAAa,CAACC,KAAK,CAACK,IAAI,CAAC,GAAGC,MAAM;EACpC;EAEA,OAAO;IACLX,KAAK,EAAE,gBAAgB;IACvBC,IAAI,EAAEG;EACR,CAAC;AACH;AAMA,OAAO,SAASS,+BAA+BA,CAACT,aAA4B,EAAkB;EAC5F,MAAMU,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACZ,aAAa,CAAC;EAC5C,MAAMa,cAAc,GAAGb,aAAa,CAACU,SAAS,CAAC,CAAC,CAAC,CAAC,CAACI,MAAM;EAEzD,MAAMC,cAAoB,GAAG,EAAE;EAE/B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGH,cAAc,EAAEG,KAAK,EAAE,EAAE;IACnD,MAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,IAAIC,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGR,SAAS,CAACI,MAAM,EAAEI,QAAQ,EAAE,EAAE;MAC9D,MAAMC,SAAS,GAAGT,SAAS,CAACQ,QAAQ,CAAC;MACrCD,SAAS,CAACE,SAAS,CAAC,GAAGnB,aAAa,CAACmB,SAAS,CAAC,CAACH,KAAK,CAAC;IACxD;IACAD,cAAc,CAACK,IAAI,CAACH,SAAS,CAAC;EAChC;EAEA,OAAO;IACLrB,KAAK,EAAE,kBAAkB;IACzBC,IAAI,EAAEkB;EACR,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { RecordBatchReader } from 'apache-arrow';
1
+ import { RecordBatchReader, Table as ApacheArrowTable } from 'apache-arrow';
2
2
  export function parseArrowInBatches(asyncIterator) {
3
3
  async function* makeArrowAsyncIterator() {
4
4
  const readers = RecordBatchReader.readAll(asyncIterator);
@@ -7,7 +7,7 @@ export function parseArrowInBatches(asyncIterator) {
7
7
  const arrowTabledBatch = {
8
8
  shape: 'arrow-table',
9
9
  batchType: 'data',
10
- data: recordBatch,
10
+ data: new ApacheArrowTable([recordBatch]),
11
11
  length: recordBatch.data.length
12
12
  };
13
13
  yield arrowTabledBatch;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-in-batches.js","names":["RecordBatchReader","parseArrowInBatches","asyncIterator","makeArrowAsyncIterator","readers","readAll","reader","recordBatch","arrowTabledBatch","shape","batchType","data","length"],"sources":["../../../src/lib/parse-arrow-in-batches.ts"],"sourcesContent":["// TODO - this import defeats the sophisticated typescript checking in ArrowJS\nimport {ArrowTableBatch} from '@loaders.gl/schema';\nimport {RecordBatchReader} from 'apache-arrow';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrowTableBatch> {\n // Creates the appropriate RecordBatchReader subclasses from the input\n // This will also close the underlying source in case of early termination or errors\n\n // As an optimization, return a non-async iterator\n /*\n if (isIterable(readers)) {\n function* makeArrowIterator() {\n for (const reader of readers) {\n for (const batch of reader) {\n yield processBatch(batch, reader);\n }\n break; // only processing one stream of batches\n }\n }\n const arrowIterator = makeArrowIterator();\n }\n */\n\n async function* makeArrowAsyncIterator(): AsyncIterator<ArrowTableBatch> {\n // @ts-ignore\n const readers = RecordBatchReader.readAll(asyncIterator);\n for await (const reader of readers) {\n for await (const recordBatch of reader) {\n const arrowTabledBatch: ArrowTableBatch = {\n shape: 'arrow-table',\n batchType: 'data',\n data: recordBatch,\n length: recordBatch.data.length\n };\n // processBatch(recordBatch);\n yield arrowTabledBatch;\n }\n break; // only processing one stream of batches\n }\n }\n\n return makeArrowAsyncIterator() as any; // as AsyncIterator<ArrowTableBatch>;\n}\n\n// function processBatch(batch: RecordBatch): ArrowTableBatch {\n// const values = {};\n// batch.schema.fields.forEach(({name}, index) => {\n// values[name] = batch.getChildAt(index)?.toArray();\n// });\n// return {\n\n// };\n// }\n"],"mappings":"AAEA,SAAQA,iBAAiB,QAAO,cAAc;AAK9C,OAAO,SAASC,mBAAmBA,CACjCC,aAAiE,EACjC;EAmBhC,gBAAgBC,sBAAsBA,CAAA,EAAmC;IAEvE,MAAMC,OAAO,GAAGJ,iBAAiB,CAACK,OAAO,CAACH,aAAa,CAAC;IACxD,WAAW,MAAMI,MAAM,IAAIF,OAAO,EAAE;MAClC,WAAW,MAAMG,WAAW,IAAID,MAAM,EAAE;QACtC,MAAME,gBAAiC,GAAG;UACxCC,KAAK,EAAE,aAAa;UACpBC,SAAS,EAAE,MAAM;UACjBC,IAAI,EAAEJ,WAAW;UACjBK,MAAM,EAAEL,WAAW,CAACI,IAAI,CAACC;QAC3B,CAAC;QAED,MAAMJ,gBAAgB;MACxB;MACA;IACF;EACF;EAEA,OAAOL,sBAAsB,CAAC,CAAC;AACjC"}
1
+ {"version":3,"file":"parse-arrow-in-batches.js","names":["RecordBatchReader","Table","ApacheArrowTable","parseArrowInBatches","asyncIterator","makeArrowAsyncIterator","readers","readAll","reader","recordBatch","arrowTabledBatch","shape","batchType","data","length"],"sources":["../../../src/lib/parse-arrow-in-batches.ts"],"sourcesContent":["// TODO - this import defeats the sophisticated typescript checking in ArrowJS\nimport type {ArrowTableBatch} from './arrow-table';\nimport {RecordBatchReader, Table as ApacheArrowTable} from 'apache-arrow';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrowTableBatch> {\n // Creates the appropriate RecordBatchReader subclasses from the input\n // This will also close the underlying source in case of early termination or errors\n\n // As an optimization, return a non-async iterator\n /*\n if (isIterable(readers)) {\n function* makeArrowIterator() {\n for (const reader of readers) {\n for (const batch of reader) {\n yield processBatch(batch, reader);\n }\n break; // only processing one stream of batches\n }\n }\n const arrowIterator = makeArrowIterator();\n }\n */\n\n async function* makeArrowAsyncIterator(): AsyncIterator<ArrowTableBatch> {\n // @ts-ignore\n const readers = RecordBatchReader.readAll(asyncIterator);\n for await (const reader of readers) {\n for await (const recordBatch of reader) {\n const arrowTabledBatch: ArrowTableBatch = {\n shape: 'arrow-table',\n batchType: 'data',\n data: new ApacheArrowTable([recordBatch]),\n length: recordBatch.data.length\n };\n // processBatch(recordBatch);\n yield arrowTabledBatch;\n }\n break; // only processing one stream of batches\n }\n }\n\n return makeArrowAsyncIterator() as any; // as AsyncIterator<ArrowTableBatch>;\n}\n\n// function processBatch(batch: RecordBatch): ArrowTableBatch {\n// const values = {};\n// batch.schema.fields.forEach(({name}, index) => {\n// values[name] = batch.getChildAt(index)?.toArray();\n// });\n// return {\n\n// };\n// }\n"],"mappings":"AAEA,SAAQA,iBAAiB,EAAEC,KAAK,IAAIC,gBAAgB,QAAO,cAAc;AAKzE,OAAO,SAASC,mBAAmBA,CACjCC,aAAiE,EACjC;EAmBhC,gBAAgBC,sBAAsBA,CAAA,EAAmC;IAEvE,MAAMC,OAAO,GAAGN,iBAAiB,CAACO,OAAO,CAACH,aAAa,CAAC;IACxD,WAAW,MAAMI,MAAM,IAAIF,OAAO,EAAE;MAClC,WAAW,MAAMG,WAAW,IAAID,MAAM,EAAE;QACtC,MAAME,gBAAiC,GAAG;UACxCC,KAAK,EAAE,aAAa;UACpBC,SAAS,EAAE,MAAM;UACjBC,IAAI,EAAE,IAAIX,gBAAgB,CAAC,CAACO,WAAW,CAAC,CAAC;UACzCK,MAAM,EAAEL,WAAW,CAACI,IAAI,CAACC;QAC3B,CAAC;QAED,MAAMJ,gBAAgB;MACxB;MACA;IACF;EACF;EAEA,OAAOL,sBAAsB,CAAC,CAAC;AACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-sync.js","names":["convertTable","tableFromIPC","convertApacheArrowToArrowTable","convertArrowToColumnarTable","parseArrowSync","arrayBuffer","options","_options$arrow","apacheArrowTable","Uint8Array","arrowTable","shape","arrow","columnarTable","Error"],"sources":["../../../src/lib/parse-arrow-sync.ts"],"sourcesContent":["import type {ArrowTable, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport {convertTable} from '@loaders.gl/schema';\nimport {tableFromIPC} from 'apache-arrow';\nimport type {ArrowLoaderOptions} from '../arrow-loader';\nimport {convertApacheArrowToArrowTable, convertArrowToColumnarTable} from './convert-table';\n\n// Parses arrow to a columnar table\nexport default function parseArrowSync(\n arrayBuffer,\n options?: ArrowLoaderOptions\n): ArrowTable | ColumnarTable | ObjectRowTable {\n const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);\n const arrowTable = convertApacheArrowToArrowTable(apacheArrowTable);\n\n const shape = options?.arrow?.shape || 'arrow-table';\n switch (shape) {\n case 'arrow-table':\n return arrowTable;\n\n case 'columnar-table':\n return convertArrowToColumnarTable(arrowTable);\n\n case 'object-row-table':\n const columnarTable = convertArrowToColumnarTable(arrowTable);\n return convertTable(columnarTable, 'object-row-table');\n\n default:\n // TODO\n throw new Error(shape);\n }\n}\n"],"mappings":"AACA,SAAQA,YAAY,QAAO,oBAAoB;AAC/C,SAAQC,YAAY,QAAO,cAAc;AAEzC,SAAQC,8BAA8B,EAAEC,2BAA2B,QAAO,iBAAiB;AAG3F,eAAe,SAASC,cAAcA,CACpCC,WAAW,EACXC,OAA4B,EACiB;EAAA,IAAAC,cAAA;EAC7C,MAAMC,gBAAgB,GAAGP,YAAY,CAAC,CAAC,IAAIQ,UAAU,CAACJ,WAAW,CAAC,CAAC,CAAC;EACpE,MAAMK,UAAU,GAAGR,8BAA8B,CAACM,gBAAgB,CAAC;EAEnE,MAAMG,KAAK,GAAG,CAAAL,OAAO,aAAPA,OAAO,wBAAAC,cAAA,GAAPD,OAAO,CAAEM,KAAK,cAAAL,cAAA,uBAAdA,cAAA,CAAgBI,KAAK,KAAI,aAAa;EACpD,QAAQA,KAAK;IACX,KAAK,aAAa;MAChB,OAAOD,UAAU;IAEnB,KAAK,gBAAgB;MACnB,OAAOP,2BAA2B,CAACO,UAAU,CAAC;IAEhD,KAAK,kBAAkB;MACrB,MAAMG,aAAa,GAAGV,2BAA2B,CAACO,UAAU,CAAC;MAC7D,OAAOV,YAAY,CAACa,aAAa,EAAE,kBAAkB,CAAC;IAExD;MAEE,MAAM,IAAIC,KAAK,CAACH,KAAK,CAAC;EAC1B;AACF"}
1
+ {"version":3,"file":"parse-arrow-sync.js","names":["convertTable","tableFromIPC","convertApacheArrowToArrowTable","convertArrowToColumnarTable","parseArrowSync","arrayBuffer","options","_options$arrow","apacheArrowTable","Uint8Array","arrowTable","shape","arrow","columnarTable","Error"],"sources":["../../../src/lib/parse-arrow-sync.ts"],"sourcesContent":["import type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';\nimport type {ArrowTable} from './arrow-table';\nimport {convertTable} from '@loaders.gl/schema';\nimport {tableFromIPC} from 'apache-arrow';\nimport type {ArrowLoaderOptions} from '../arrow-loader';\nimport {convertApacheArrowToArrowTable, convertArrowToColumnarTable} from './convert-table';\n\n// Parses arrow to a columnar table\nexport default function parseArrowSync(\n arrayBuffer,\n options?: ArrowLoaderOptions\n): ArrowTable | ColumnarTable | ObjectRowTable {\n const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);\n const arrowTable = convertApacheArrowToArrowTable(apacheArrowTable);\n\n const shape = options?.arrow?.shape || 'arrow-table';\n switch (shape) {\n case 'arrow-table':\n return arrowTable;\n\n case 'columnar-table':\n return convertArrowToColumnarTable(arrowTable);\n\n case 'object-row-table':\n const columnarTable = convertArrowToColumnarTable(arrowTable);\n return convertTable(columnarTable, 'object-row-table');\n\n default:\n // TODO\n throw new Error(shape);\n }\n}\n"],"mappings":"AAEA,SAAQA,YAAY,QAAO,oBAAoB;AAC/C,SAAQC,YAAY,QAAO,cAAc;AAEzC,SAAQC,8BAA8B,EAAEC,2BAA2B,QAAO,iBAAiB;AAG3F,eAAe,SAASC,cAAcA,CACpCC,WAAW,EACXC,OAA4B,EACiB;EAAA,IAAAC,cAAA;EAC7C,MAAMC,gBAAgB,GAAGP,YAAY,CAAC,CAAC,IAAIQ,UAAU,CAACJ,WAAW,CAAC,CAAC,CAAC;EACpE,MAAMK,UAAU,GAAGR,8BAA8B,CAACM,gBAAgB,CAAC;EAEnE,MAAMG,KAAK,GAAG,CAAAL,OAAO,aAAPA,OAAO,wBAAAC,cAAA,GAAPD,OAAO,CAAEM,KAAK,cAAAL,cAAA,uBAAdA,cAAA,CAAgBI,KAAK,KAAI,aAAa;EACpD,QAAQA,KAAK;IACX,KAAK,aAAa;MAChB,OAAOD,UAAU;IAEnB,KAAK,gBAAgB;MACnB,OAAOP,2BAA2B,CAACO,UAAU,CAAC;IAEhD,KAAK,kBAAkB;MACrB,MAAMG,aAAa,GAAGV,2BAA2B,CAACO,UAAU,CAAC;MAC7D,OAAOV,YAAY,CAACa,aAAa,EAAE,kBAAkB,CAAC;IAExD;MAEE,MAAM,IAAIC,KAAK,CAACH,KAAK,CAAC;EAC1B;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { LoaderWithParser } from '@loaders.gl/loader-utils';
2
2
  import type { ArrowLoaderOptions } from './arrow-loader';
3
- import { ArrowTable, ArrowTableBatch, ColumnarTable, ObjectRowTable } from '@loaders.gl/schema';
3
+ import type { ArrowTableBatch, ColumnarTable, ObjectRowTable } from '@loaders.gl/schema';
4
+ import type { ArrowTable } from './lib/arrow-table';
4
5
  import { ArrowLoader as ArrowWorkerLoader } from './arrow-loader';
6
+ export type { ArrowTable, ArrowTableBatch } from './lib/arrow-table';
5
7
  export { VECTOR_TYPES } from './types';
6
8
  export { ArrowWriter } from './arrow-writer';
7
9
  export type { ArrowLoaderOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAC,WAAW,IAAI,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAUhE,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAIrC,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAI3C,YAAY,EAAC,kBAAkB,EAAC,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,CAAC;AAE3B,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,gBAAgB,CACxC,UAAU,GAAG,aAAa,GAAG,cAAc,EAC3C,eAAe,EACf,kBAAkB,CAOnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAC,eAAe,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAC,WAAW,IAAI,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAUhE,YAAY,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAIrC,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAI3C,YAAY,EAAC,kBAAkB,EAAC,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,CAAC;AAE3B,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,gBAAgB,CACxC,UAAU,GAAG,aAAa,GAAG,cAAc,EAC3C,eAAe,EACf,kBAAkB,CAOnB,CAAC"}
@@ -1,6 +1,6 @@
1
- import type { ArrowTableBatch } from '@loaders.gl/schema';
2
- import { Schema } from 'apache-arrow';
3
1
  import { ColumnarTableBatchAggregator } from '@loaders.gl/schema';
2
+ import type { ArrowTableBatch } from './arrow-table';
3
+ import { Schema } from 'apache-arrow';
4
4
  export declare class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
5
5
  arrowSchema: Schema | null;
6
6
  constructor(schema: any, options: any);
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-table-batch.d.ts","sourceRoot":"","sources":["../../src/lib/arrow-table-batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,MAAM,EAQP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,4BAA4B,EAAC,MAAM,oBAAoB,CAAC;AAEhE,qBAAa,yBAA0B,SAAQ,4BAA4B;IACzE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEf,MAAM,KAAA,EAAE,OAAO,KAAA;IAK3B,QAAQ,IAAI,eAAe,GAAG,IAAI;CA4BnC"}
1
+ {"version":3,"file":"arrow-table-batch.d.ts","sourceRoot":"","sources":["../../src/lib/arrow-table-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,MAAM,EAQP,MAAM,cAAc,CAAC;AAEtB,qBAAa,yBAA0B,SAAQ,4BAA4B;IACzE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEf,MAAM,KAAA,EAAE,OAAO,KAAA;IAK3B,QAAQ,IAAI,eAAe,GAAG,IAAI;CA4BnC"}
@@ -0,0 +1,23 @@
1
+ import type { Batch, Schema } from '@loaders.gl/schema';
2
+ import type { Table as ApacheArrowTable } from 'apache-arrow';
3
+ /**
4
+ * A table organized as an Apache Arrow table
5
+ * @note This is a variant of the type from loaders.gl/schema
6
+ */
7
+ export type ArrowTable = {
8
+ shape: 'arrow-table';
9
+ schema?: Schema;
10
+ data: ApacheArrowTable;
11
+ };
12
+ /**
13
+ * Batch for a table organized as an Apache Arrow table
14
+ * @note This is a variant of the type from loaders.gl/schema
15
+ */
16
+ export type ArrowTableBatch = Batch & {
17
+ shape: 'arrow-table';
18
+ schemaType?: 'explicit' | 'deduced';
19
+ schema?: Schema;
20
+ data: ApacheArrowTable;
21
+ length: number;
22
+ };
23
+ //# sourceMappingURL=arrow-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-table.d.ts","sourceRoot":"","sources":["../../src/lib/arrow-table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,KAAK,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -1,5 +1,6 @@
1
- import type { ColumnarTable, ObjectRowTable, ArrowTable } from '@loaders.gl/schema';
1
+ import type { ColumnarTable, ObjectRowTable } from '@loaders.gl/schema';
2
2
  import type { Table as ApacheArrowTable } from 'apache-arrow';
3
+ import type { ArrowTable } from './arrow-table';
3
4
  /**
4
5
  * Wrap an apache arrow table in a loaders.gl table wrapper.
5
6
  * From this additional conversions are available.
@@ -1 +1 @@
1
- {"version":3,"file":"convert-table.d.ts","sourceRoot":"","sources":["../../src/lib/convert-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,gBAAgB,GAAG,UAAU,CAKvF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAkB5E;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,GAAG,cAAc,CAmB5F"}
1
+ {"version":3,"file":"convert-table.d.ts","sourceRoot":"","sources":["../../src/lib/convert-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,gBAAgB,GAAG,UAAU,CAKvF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAkB5E;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,GAAG,cAAc,CAmB5F"}
@@ -1,4 +1,4 @@
1
- import { ArrowTableBatch } from '@loaders.gl/schema';
1
+ import type { ArrowTableBatch } from './arrow-table';
2
2
  /**
3
3
  */
4
4
  export declare function parseArrowInBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrowTableBatch>;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-in-batches.d.ts","sourceRoot":"","sources":["../../src/lib/parse-arrow-in-batches.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAInD;GACG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,eAAe,CAAC,CAsChC"}
1
+ {"version":3,"file":"parse-arrow-in-batches.d.ts","sourceRoot":"","sources":["../../src/lib/parse-arrow-in-batches.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAInD;GACG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,eAAe,CAAC,CAsChC"}
@@ -1,4 +1,5 @@
1
- import type { ArrowTable, ColumnarTable, ObjectRowTable } from '@loaders.gl/schema';
1
+ import type { ColumnarTable, ObjectRowTable } from '@loaders.gl/schema';
2
+ import type { ArrowTable } from './arrow-table';
2
3
  import type { ArrowLoaderOptions } from '../arrow-loader';
3
4
  export default function parseArrowSync(arrayBuffer: any, options?: ArrowLoaderOptions): ArrowTable | ColumnarTable | ObjectRowTable;
4
5
  //# sourceMappingURL=parse-arrow-sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-arrow-sync.d.ts","sourceRoot":"","sources":["../../src/lib/parse-arrow-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAGlF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,WAAW,KAAA,EACX,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,GAAG,aAAa,GAAG,cAAc,CAoB7C"}
1
+ {"version":3,"file":"parse-arrow-sync.d.ts","sourceRoot":"","sources":["../../src/lib/parse-arrow-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIxD,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,WAAW,KAAA,EACX,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,GAAG,aAAa,GAAG,cAAc,CAoB7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/arrow",
3
- "version": "4.0.0-alpha.24",
3
+ "version": "4.0.0-alpha.26",
4
4
  "description": "Simple columnar table loader for the Apache Arrow format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -39,9 +39,9 @@
39
39
  "build-worker2": "esbuild src/workers/arrow-worker.ts --bundle --outfile=dist/arrow-worker.js --platform=browser --external:{stream}"
40
40
  },
41
41
  "dependencies": {
42
- "@loaders.gl/loader-utils": "4.0.0-alpha.24",
43
- "@loaders.gl/schema": "4.0.0-alpha.24",
42
+ "@loaders.gl/loader-utils": "4.0.0-alpha.26",
43
+ "@loaders.gl/schema": "4.0.0-alpha.26",
44
44
  "apache-arrow": "^13.0.0"
45
45
  },
46
- "gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
46
+ "gitHead": "91adce71f74dacc7c8bfc379f0d122f2beae70d9"
47
47
  }
@@ -1,6 +1,6 @@
1
1
  // loaders.gl, MIT license
2
2
  import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
3
- import type {ArrowTable} from '@loaders.gl/schema';
3
+ import type {ArrowTable} from './lib/arrow-table';
4
4
 
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
package/src/index.ts CHANGED
@@ -1,6 +1,10 @@
1
+ // loaders.gl, MIT
2
+
1
3
  import type {LoaderWithParser} from '@loaders.gl/loader-utils';
2
4
  import type {ArrowLoaderOptions} from './arrow-loader';
3
- import {ArrowTable, ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';
5
+ import type {ArrowTableBatch, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';
6
+ import type {ArrowTable} from './lib/arrow-table';
7
+
4
8
  import {TableBatchBuilder} from '@loaders.gl/schema';
5
9
  import {ArrowLoader as ArrowWorkerLoader} from './arrow-loader';
6
10
  import parseSync from './lib/parse-arrow-sync';
@@ -12,6 +16,7 @@ import {ArrowTableBatchAggregator} from './lib/arrow-table-batch';
12
16
  TableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;
13
17
 
14
18
  // Types
19
+ export type {ArrowTable, ArrowTableBatch} from './lib/arrow-table';
15
20
  export {VECTOR_TYPES} from './types';
16
21
 
17
22
  // Arrow writer
@@ -1,5 +1,7 @@
1
- import type {ArrowTableBatch} from '@loaders.gl/schema';
1
+ import {ColumnarTableBatchAggregator} from '@loaders.gl/schema';
2
+ import type {ArrowTableBatch} from './arrow-table';
2
3
  import {
4
+ Table as ApacheArrowTable,
3
5
  Schema,
4
6
  Field,
5
7
  RecordBatch,
@@ -9,7 +11,6 @@ import {
9
11
  Vector,
10
12
  Float32
11
13
  } from 'apache-arrow';
12
- import {ColumnarTableBatchAggregator} from '@loaders.gl/schema';
13
14
 
14
15
  export class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
15
16
  arrowSchema: Schema | null;
@@ -40,7 +41,7 @@ export class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
40
41
  return {
41
42
  shape: 'arrow-table',
42
43
  batchType: 'data',
43
- data: recordBatch,
44
+ data: new ApacheArrowTable([recordBatch]),
44
45
  length: batch.length
45
46
  };
46
47
  }
@@ -0,0 +1,26 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import type {Batch, Schema} from '@loaders.gl/schema';
4
+ import type {Table as ApacheArrowTable} from 'apache-arrow';
5
+
6
+ /**
7
+ * A table organized as an Apache Arrow table
8
+ * @note This is a variant of the type from loaders.gl/schema
9
+ */
10
+ export type ArrowTable = {
11
+ shape: 'arrow-table';
12
+ schema?: Schema;
13
+ data: ApacheArrowTable;
14
+ };
15
+
16
+ /**
17
+ * Batch for a table organized as an Apache Arrow table
18
+ * @note This is a variant of the type from loaders.gl/schema
19
+ */
20
+ export type ArrowTableBatch = Batch & {
21
+ shape: 'arrow-table';
22
+ schemaType?: 'explicit' | 'deduced';
23
+ schema?: Schema;
24
+ data: ApacheArrowTable; // ApacheRecordBatch;
25
+ length: number;
26
+ };
@@ -1,6 +1,7 @@
1
1
  // loaders.gl, MIT license
2
- import type {ColumnarTable, ObjectRowTable, ArrowTable} from '@loaders.gl/schema';
2
+ import type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';
3
3
  import type {Table as ApacheArrowTable} from 'apache-arrow';
4
+ import type {ArrowTable} from './arrow-table';
4
5
 
5
6
  /**
6
7
  * Wrap an apache arrow table in a loaders.gl table wrapper.
@@ -1,6 +1,6 @@
1
1
  // TODO - this import defeats the sophisticated typescript checking in ArrowJS
2
- import {ArrowTableBatch} from '@loaders.gl/schema';
3
- import {RecordBatchReader} from 'apache-arrow';
2
+ import type {ArrowTableBatch} from './arrow-table';
3
+ import {RecordBatchReader, Table as ApacheArrowTable} from 'apache-arrow';
4
4
  // import {isIterable} from '@loaders.gl/core';
5
5
 
6
6
  /**
@@ -34,7 +34,7 @@ export function parseArrowInBatches(
34
34
  const arrowTabledBatch: ArrowTableBatch = {
35
35
  shape: 'arrow-table',
36
36
  batchType: 'data',
37
- data: recordBatch,
37
+ data: new ApacheArrowTable([recordBatch]),
38
38
  length: recordBatch.data.length
39
39
  };
40
40
  // processBatch(recordBatch);
@@ -1,4 +1,5 @@
1
- import type {ArrowTable, ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';
1
+ import type {ColumnarTable, ObjectRowTable} from '@loaders.gl/schema';
2
+ import type {ArrowTable} from './arrow-table';
2
3
  import {convertTable} from '@loaders.gl/schema';
3
4
  import {tableFromIPC} from 'apache-arrow';
4
5
  import type {ArrowLoaderOptions} from '../arrow-loader';