@loaders.gl/arrow 4.0.0-alpha.25 → 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 (46) 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 +12 -8
  4. package/dist/dist.min.js +12 -8
  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 +1 -1
  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.map +1 -1
  15. package/dist/es5/lib/parse-arrow-sync.js.map +1 -1
  16. package/dist/esm/arrow-loader.js +1 -1
  17. package/dist/esm/arrow-loader.js.map +1 -1
  18. package/dist/esm/arrow-writer.js +1 -1
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/lib/arrow-table-batch.js +1 -1
  21. package/dist/esm/lib/arrow-table-batch.js.map +1 -1
  22. package/dist/esm/lib/arrow-table.js +2 -0
  23. package/dist/esm/lib/arrow-table.js.map +1 -0
  24. package/dist/esm/lib/convert-table.js.map +1 -1
  25. package/dist/esm/lib/parse-arrow-in-batches.js.map +1 -1
  26. package/dist/esm/lib/parse-arrow-sync.js.map +1 -1
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/lib/arrow-table-batch.d.ts +2 -2
  30. package/dist/lib/arrow-table-batch.d.ts.map +1 -1
  31. package/dist/lib/arrow-table.d.ts +23 -0
  32. package/dist/lib/arrow-table.d.ts.map +1 -0
  33. package/dist/lib/convert-table.d.ts +2 -1
  34. package/dist/lib/convert-table.d.ts.map +1 -1
  35. package/dist/lib/parse-arrow-in-batches.d.ts +1 -1
  36. package/dist/lib/parse-arrow-in-batches.d.ts.map +1 -1
  37. package/dist/lib/parse-arrow-sync.d.ts +2 -1
  38. package/dist/lib/parse-arrow-sync.d.ts.map +1 -1
  39. package/package.json +4 -4
  40. package/src/arrow-loader.ts +1 -1
  41. package/src/index.ts +6 -1
  42. package/src/lib/arrow-table-batch.ts +2 -2
  43. package/src/lib/arrow-table.ts +26 -0
  44. package/src/lib/convert-table.ts +2 -1
  45. package/src/lib/parse-arrow-in-batches.ts +1 -1
  46. 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"}
@@ -565,7 +565,8 @@
565
565
  case "geojson-table":
566
566
  return table.features.length;
567
567
  case "arrow-table":
568
- return table.data.numRows;
568
+ const arrowTable = table.data;
569
+ return arrowTable.numRows;
569
570
  case "columnar-table":
570
571
  for (const column of Object.values(table.data)) {
571
572
  return column.length || 0;
@@ -588,8 +589,9 @@
588
589
  const column = table.data[columnName];
589
590
  return column[rowIndex];
590
591
  case "arrow-table":
591
- const arrowColumnIndex = table.data.schema.fields.findIndex((field) => field.name === columnName);
592
- 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);
593
595
  default:
594
596
  throw new Error("todo");
595
597
  }
@@ -638,9 +640,10 @@
638
640
  return objectRow2;
639
641
  }
640
642
  case "arrow-table":
643
+ const arrowTable = table.data;
641
644
  const objectRow = target || {};
642
- const row = table.data.get(rowIndex);
643
- const schema = table.data.schema;
645
+ const row = arrowTable.get(rowIndex);
646
+ const schema = arrowTable.schema;
644
647
  for (let i = 0; i < schema.fields.length; i++) {
645
648
  objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
646
649
  }
@@ -688,9 +691,10 @@
688
691
  return arrayRow2;
689
692
  }
690
693
  case "arrow-table":
694
+ const arrowTable = table.data;
691
695
  const arrayRow = target || [];
692
- const row = table.data.get(rowIndex);
693
- const schema = table.data.schema;
696
+ const row = arrowTable.get(rowIndex);
697
+ const schema = arrowTable.schema;
694
698
  for (let i = 0; i < schema.fields.length; i++) {
695
699
  arrayRow[i] = row?.[schema.fields[i].name];
696
700
  }
@@ -11497,7 +11501,7 @@ return true;`);
11497
11501
  RecordBatchStreamWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
11498
11502
 
11499
11503
  // src/arrow-loader.ts
11500
- var VERSION = true ? "4.0.0-alpha.25" : "latest";
11504
+ var VERSION = true ? "4.0.0-alpha.26" : "latest";
11501
11505
  var ArrowLoader = {
11502
11506
  name: "Apache Arrow",
11503
11507
  id: "arrow",
package/dist/dist.min.js CHANGED
@@ -410,7 +410,8 @@
410
410
  case "geojson-table":
411
411
  return table.features.length;
412
412
  case "arrow-table":
413
- return table.data.numRows;
413
+ const arrowTable = table.data;
414
+ return arrowTable.numRows;
414
415
  case "columnar-table":
415
416
  for (const column of Object.values(table.data)) {
416
417
  return column.length || 0;
@@ -433,8 +434,9 @@
433
434
  const column = table.data[columnName];
434
435
  return column[rowIndex];
435
436
  case "arrow-table":
436
- const arrowColumnIndex = table.data.schema.fields.findIndex((field) => field.name === columnName);
437
- 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);
438
440
  default:
439
441
  throw new Error("todo");
440
442
  }
@@ -483,9 +485,10 @@
483
485
  return objectRow2;
484
486
  }
485
487
  case "arrow-table":
488
+ const arrowTable = table.data;
486
489
  const objectRow = target || {};
487
- const row = table.data.get(rowIndex);
488
- const schema = table.data.schema;
490
+ const row = arrowTable.get(rowIndex);
491
+ const schema = arrowTable.schema;
489
492
  for (let i = 0; i < schema.fields.length; i++) {
490
493
  objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
491
494
  }
@@ -533,9 +536,10 @@
533
536
  return arrayRow2;
534
537
  }
535
538
  case "arrow-table":
539
+ const arrowTable = table.data;
536
540
  const arrayRow = target || [];
537
- const row = table.data.get(rowIndex);
538
- const schema = table.data.schema;
541
+ const row = arrowTable.get(rowIndex);
542
+ const schema = arrowTable.schema;
539
543
  for (let i = 0; i < schema.fields.length; i++) {
540
544
  arrayRow[i] = row?.[schema.fields[i].name];
541
545
  }
@@ -12554,8 +12558,8 @@ return true;`);
12554
12558
  var ArrowTableBatchAggregator;
12555
12559
  var init_arrow_table_batch = __esm({
12556
12560
  "src/lib/arrow-table-batch.ts"() {
12557
- init_Arrow_dom();
12558
12561
  init_src();
12562
+ init_Arrow_dom();
12559
12563
  ArrowTableBatchAggregator = class extends ColumnarTableBatchAggregator {
12560
12564
  constructor(schema, options) {
12561
12565
  super(schema, options);
@@ -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.25" !== 'undefined' ? "4.0.0-alpha.25" : '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.25" !== 'undefined' ? "4.0.0-alpha.25" : '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};\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AA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAP3CY,yBAAiB,CAACC,UAAU,GAAGC,0CAAyB;AAejD,IAAMC,WAIZ,GAAAhB,aAAA,CAAAA,aAAA,KACIiB,wBAAiB;EACpBC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAX,OAAA,EAAAY,YAAA,CAAAZ,OAAA,CAAAa,IAAA,CAAE,SAAAC,QAAOC,WAAwB,EAAEC,OAA4B;MAAA,OAAAJ,YAAA,CAAAZ,OAAA,CAAAiB,IAAA,UAAAC,SAAAC,QAAA;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,QAA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A,OAAAJ,YAAA,CAAAZ,OAAA,CAAAiB,IAAA,UAAAC,SAAAC,QAAA;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"}
@@ -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; }
@@ -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","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 type {ArrowTableBatch} from '@loaders.gl/schema';\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';\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: 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":";;;;;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AA,CAAA7F,CAAA,IAAAC,IAAA,GAAwC;MAAA,IAA7BiF,KAAK,GAAAY,KAAA,CAAA5F,KAAA;MACd,IAAM6F,MAAM,GAAG7B,IAAI,CAACgB,KAAK,CAAC5D,IAAI,CAAC;MAC/B,IAAIyE,MAAM,YAAYZ,YAAY,EAAE;QAClC,IAAMa,WAAW,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"}
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 (arrowS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M;IAAAsB,KAAA;EAAA;IAAtC,KAAAD,SAAA,CAAA9F,CAAA,MAAA+F,KAAA,GAAAD,SAAA,CAAA7F,CAAA,IAAAC,IAAA,GAAwC;MAAA,IAA7BiF,KAAK,GAAAY,KAAA,CAAA5F,KAAA;MACd,IAAM6F,MAAM,GAAG7B,IAAI,CAACgB,KAAK,CAAC5D,IAAI,CAAC;MAC/B,IAAIyE,MAAM,YAAYZ,YAAY,EAAE;QAClC,IAAMa,WAAW,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-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,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"}
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"}
@@ -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","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 {ArrowTableBatch} from '@loaders.gl/schema';\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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AAAY,MAAA;UAAA;YAAA,OAAAZ,QAAA,CAAAa,MAAA;UAAA;YAAA5B,yBAAA;YAAAe,QAAA,CAAAlC,IAAA;YAAA;UAAA;YAAAkC,QAAA,CAAAlC,IAAA;YAAA;UAAA;YAAAkC,QAAA,CAAAC,IAAA;YAAAD,QAAA,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
+ {"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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MAAA;UAAA;YAAA,OAAAZ,QAAA,CAAAa,MAAA;UAAA;YAAA5B,yBAAA;YAAAe,QAAA,CAAAlC,IAAA;YAAA;UAAA;YAAAkC,QAAA,CAAAlC,IAAA;YAAA;UAAA;YAAAkC,QAAA,CAAAC,IAAA;YAAAD,QAAA,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.25" !== 'undefined' ? "4.0.0-alpha.25" : '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.25" !== 'undefined' ? "4.0.0-alpha.25" : '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 { Table as ApacheArrowTable, 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);
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-table-batch.js","names":["Table","ApacheArrowTable","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 Table as ApacheArrowTable,\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: 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":";AACA,SACEA,KAAK,IAAIC,gBAAgB,EACzBC,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,EAA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AG,IAAIlC,KAAK,CAAC8B,KAAK,CAACK,IAAI,EAAE,IAAI9B,OAAO,CAAC,CAAC,EAAEyB,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,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,IAA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EAAE;IACxB,MAAMqB,KAAK,GAAGrB,MAAM,CAACoB,GAAG,CAAC;IACzB,IAAIC,KAAK,CAACV,IAAI,KAAKW,YAAY,EAAE;MAE/B,MAAMC,QAAQ,GAAG,IAAIC,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 +1 @@
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 {ArrowTableBatch} from '@loaders.gl/schema';\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
+ {"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,EAEL,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.25",
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.25",
43
- "@loaders.gl/schema": "4.0.0-alpha.25",
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": "40135f391b869388dbbcd615bbe51178d0c370be"
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,4 +1,5 @@
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 {
3
4
  Table as ApacheArrowTable,
4
5
  Schema,
@@ -10,7 +11,6 @@ import {
10
11
  Vector,
11
12
  Float32
12
13
  } from 'apache-arrow';
13
- import {ColumnarTableBatchAggregator} from '@loaders.gl/schema';
14
14
 
15
15
  export class ArrowTableBatchAggregator extends ColumnarTableBatchAggregator {
16
16
  arrowSchema: Schema | null;
@@ -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,5 +1,5 @@
1
1
  // TODO - this import defeats the sophisticated typescript checking in ArrowJS
2
- import {ArrowTableBatch} from '@loaders.gl/schema';
2
+ import type {ArrowTableBatch} from './arrow-table';
3
3
  import {RecordBatchReader, Table as ApacheArrowTable} from 'apache-arrow';
4
4
  // import {isIterable} from '@loaders.gl/core';
5
5
 
@@ -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';