@loaders.gl/schema 3.4.0-alpha.1 → 3.4.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/category/mesh/mesh-types.d.ts +1 -3
- package/dist/category/mesh/mesh-types.d.ts.map +1 -1
- package/dist/es5/category/mesh/convert-mesh.js +0 -1
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/deduce-mesh-schema.js +0 -3
- package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/mesh/mesh-types.js.map +1 -1
- package/dist/es5/category/mesh/mesh-utils.js +0 -2
- package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
- package/dist/es5/category/table/deduce-table-schema.js +0 -1
- package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
- package/dist/es5/lib/batches/base-table-batch-aggregator.js +0 -1
- package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +1 -6
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/row-table-batch-aggregator.js +0 -4
- package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/table-batch-builder.js +6 -24
- package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/es5/lib/schema/impl/enum.js +4 -4
- package/dist/es5/lib/schema/impl/enum.js.map +1 -1
- package/dist/es5/lib/schema/impl/field.js.map +1 -1
- package/dist/es5/lib/schema/impl/schema.js +2 -6
- package/dist/es5/lib/schema/impl/schema.js.map +1 -1
- package/dist/es5/lib/schema/impl/type.js +9 -22
- package/dist/es5/lib/schema/impl/type.js.map +1 -1
- package/dist/es5/lib/schema/schema.js.map +1 -1
- package/dist/es5/lib/schema-utils/deduce-column-type.js +0 -1
- package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -1
- package/dist/es5/lib/utils/assert.js.map +1 -1
- package/dist/es5/lib/utils/async-queue.js +30 -34
- package/dist/es5/lib/utils/async-queue.js.map +1 -1
- package/dist/es5/lib/utils/row-utils.js +0 -1
- package/dist/es5/lib/utils/row-utils.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/category/mesh/convert-mesh.js +0 -1
- package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
- package/dist/esm/category/mesh/deduce-mesh-schema.js +0 -4
- package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/esm/category/mesh/mesh-to-arrow-table.js +0 -1
- package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/esm/category/mesh/mesh-types.js.map +1 -1
- package/dist/esm/category/mesh/mesh-utils.js +0 -3
- package/dist/esm/category/mesh/mesh-utils.js.map +1 -1
- package/dist/esm/category/table/deduce-table-schema.js +0 -2
- package/dist/esm/category/table/deduce-table-schema.js.map +1 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/esm/lib/arrow/get-type-info.js.map +1 -1
- package/dist/esm/lib/batches/base-table-batch-aggregator.js +0 -1
- package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/columnar-table-batch-aggregator.js +0 -3
- package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/row-table-batch-aggregator.js +0 -3
- package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/table-batch-builder.js +0 -12
- package/dist/esm/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/esm/lib/schema/impl/enum.js +3 -5
- package/dist/esm/lib/schema/impl/enum.js.map +1 -1
- package/dist/esm/lib/schema/impl/field.js.map +1 -1
- package/dist/esm/lib/schema/impl/schema.js +0 -4
- package/dist/esm/lib/schema/impl/schema.js.map +1 -1
- package/dist/esm/lib/schema/impl/type.js +0 -11
- package/dist/esm/lib/schema/impl/type.js.map +1 -1
- package/dist/esm/lib/schema/schema.js +1 -3
- package/dist/esm/lib/schema/schema.js.map +1 -1
- package/dist/esm/lib/schema-utils/deduce-column-type.js +0 -2
- package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -1
- package/dist/esm/lib/utils/assert.js +0 -1
- package/dist/esm/lib/utils/assert.js.map +1 -1
- package/dist/esm/lib/utils/async-queue.js +0 -3
- package/dist/esm/lib/utils/async-queue.js.map +1 -1
- package/dist/esm/lib/utils/row-utils.js +0 -2
- package/dist/esm/lib/utils/row-utils.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/batches/row-table-batch-aggregator.js +1 -1
- package/dist/lib/schema-utils/deduce-column-type.js +1 -1
- package/package.json +2 -2
- package/src/category/mesh/mesh-types.ts +1 -1
|
@@ -44,7 +44,5 @@ export type MeshAttribute = {
|
|
|
44
44
|
normalized?: boolean;
|
|
45
45
|
};
|
|
46
46
|
/** A map of mesh attributes keyed by attribute names */
|
|
47
|
-
export type MeshAttributes =
|
|
48
|
-
[attributeName: string]: MeshAttribute;
|
|
49
|
-
};
|
|
47
|
+
export type MeshAttributes = Record<string, MeshAttribute>;
|
|
50
48
|
//# sourceMappingURL=mesh-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-types.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/mesh-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAy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AC;KACpC,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -23,7 +23,6 @@ function convertMesh(mesh, shape, options) {
|
|
|
23
23
|
throw new Error("Unsupported shape ".concat(options === null || options === void 0 ? void 0 : options.shape));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
function convertMeshToColumnarTable(mesh) {
|
|
28
27
|
var columns = {};
|
|
29
28
|
for (var _i = 0, _Object$entries = Object.entries(mesh.attributes); _i < _Object$entries.length; _i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-mesh.js","names":["convertMesh","mesh","shape","options","convertMeshToColumnarTable","data","convertMeshToArrowTable","Error","columns","Object","entries","attributes","columnName","attribute","value","schema"],"sources":["../../../../src/category/mesh/convert-mesh.ts"],"sourcesContent":["import type {Mesh} from './mesh-types';\nimport type {ColumnarTable, ArrowTable} from '../table/table-types';\nimport {convertMeshToArrowTable} from './mesh-to-arrow-table';\n\ntype TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';\n\n/**\n * Convert a mesh to a specific shape\n */\nexport function convertMesh(\n mesh: Mesh,\n shape: TargetShape,\n options?: any\n): Mesh | ColumnarTable | ArrowTable {\n switch (shape || 'mesh') {\n case 'mesh':\n return mesh;\n case 'columnar-table':\n return convertMeshToColumnarTable(mesh);\n case 'arrow-table':\n return {\n shape: 'arrow-table',\n data: convertMeshToArrowTable(mesh)\n };\n default:\n throw new Error(`Unsupported shape ${options?.shape}`);\n }\n}\n\n/**\n * Convert a loaders.gl Mesh to a Columnar Table\n * @param mesh\n * @returns\n */\nexport function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable {\n const columns = {};\n\n for (const [columnName, attribute] of Object.entries(mesh.attributes)) {\n columns[columnName] = attribute.value;\n }\n\n return {\n shape: 'columnar-table',\n schema: mesh.schema,\n data: columns\n };\n}\n"],"mappings":";;;;;;;;;AAEA;AAOO,
|
|
1
|
+
{"version":3,"file":"convert-mesh.js","names":["_meshToArrowTable","require","convertMesh","mesh","shape","options","convertMeshToColumnarTable","data","convertMeshToArrowTable","Error","concat","columns","_i","_Object$entries","Object","entries","attributes","length","_Object$entries$_i","_slicedToArray2","default","columnName","attribute","value","schema"],"sources":["../../../../src/category/mesh/convert-mesh.ts"],"sourcesContent":["import type {Mesh} from './mesh-types';\nimport type {ColumnarTable, ArrowTable} from '../table/table-types';\nimport {convertMeshToArrowTable} from './mesh-to-arrow-table';\n\ntype TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';\n\n/**\n * Convert a mesh to a specific shape\n */\nexport function convertMesh(\n mesh: Mesh,\n shape: TargetShape,\n options?: any\n): Mesh | ColumnarTable | ArrowTable {\n switch (shape || 'mesh') {\n case 'mesh':\n return mesh;\n case 'columnar-table':\n return convertMeshToColumnarTable(mesh);\n case 'arrow-table':\n return {\n shape: 'arrow-table',\n data: convertMeshToArrowTable(mesh)\n };\n default:\n throw new Error(`Unsupported shape ${options?.shape}`);\n }\n}\n\n/**\n * Convert a loaders.gl Mesh to a Columnar Table\n * @param mesh\n * @returns\n */\nexport function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable {\n const columns = {};\n\n for (const [columnName, attribute] of Object.entries(mesh.attributes)) {\n columns[columnName] = attribute.value;\n }\n\n return {\n shape: 'columnar-table',\n schema: mesh.schema,\n data: columns\n };\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CACzBC,IAAU,EACVC,KAAkB,EAClBC,OAAa,EACsB;EACnC,QAAQD,KAAK,IAAI,MAAM;IACrB,KAAK,MAAM;MACT,OAAOD,IAAI;IACb,KAAK,gBAAgB;MACnB,OAAOG,0BAA0B,CAACH,IAAI,CAAC;IACzC,KAAK,aAAa;MAChB,OAAO;QACLC,KAAK,EAAE,aAAa;QACpBG,IAAI,EAAE,IAAAC,yCAAuB,EAACL,IAAI;MACpC,CAAC;IACH;MACE,MAAM,IAAIM,KAAK,sBAAAC,MAAA,CAAsBL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAED,KAAK,EAAG;EAAC;AAE7D;AAOO,SAASE,0BAA0BA,CAACH,IAAU,EAAiB;EACpE,IAAMQ,OAAO,GAAG,CAAC,CAAC;EAElB,SAAAC,EAAA,MAAAC,eAAA,GAAsCC,MAAM,CAACC,OAAO,CAACZ,IAAI,CAACa,UAAU,CAAC,EAAAJ,EAAA,GAAAC,eAAA,CAAAI,MAAA,EAAAL,EAAA,IAAE;IAAlE,IAAAM,kBAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAP,eAAA,CAAAD,EAAA;MAAOS,UAAU,GAAAH,kBAAA;MAAEI,SAAS,GAAAJ,kBAAA;IAC/BP,OAAO,CAACU,UAAU,CAAC,GAAGC,SAAS,CAACC,KAAK;EACvC;EAEA,OAAO;IACLnB,KAAK,EAAE,gBAAgB;IACvBoB,MAAM,EAAErB,IAAI,CAACqB,MAAM;IACnBjB,IAAI,EAAEI;EACR,CAAC;AACH"}
|
|
@@ -12,14 +12,12 @@ function deduceMeshSchema(attributes, metadata) {
|
|
|
12
12
|
var fields = deduceMeshFields(attributes);
|
|
13
13
|
return new _schema.Schema(fields, metadata);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
function deduceMeshField(attributeName, attribute, optionalMetadata) {
|
|
17
16
|
var type = (0, _arrowLikeTypeUtils.getArrowTypeFromTypedArray)(attribute.value);
|
|
18
17
|
var metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
|
|
19
18
|
var field = new _schema.Field(attributeName, new _schema.FixedSizeList(attribute.size, new _schema.Field('value', type)), false, metadata);
|
|
20
19
|
return field;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
function deduceMeshFields(attributes) {
|
|
24
22
|
var fields = [];
|
|
25
23
|
for (var attributeName in attributes) {
|
|
@@ -28,7 +26,6 @@ function deduceMeshFields(attributes) {
|
|
|
28
26
|
}
|
|
29
27
|
return fields;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
function makeMeshAttributeMetadata(attribute) {
|
|
33
30
|
var result = new Map();
|
|
34
31
|
if ('byteOffset' in attribute) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deduce-mesh-schema.js","names":["deduceMeshSchema","attributes","metadata","fields","deduceMeshFields","Schema","deduceMeshField","attributeName","attribute","optionalMetadata","type","getArrowTypeFromTypedArray","value","makeMeshAttributeMetadata","field","Field","FixedSizeList","size","push","result","Map","set","byteOffset","toString","byteStride","normalized"],"sources":["../../../../src/category/mesh/deduce-mesh-schema.ts"],"sourcesContent":["import {MeshAttribute, MeshAttributes} from './mesh-types';\nimport {Schema, Field, FixedSizeList} from '../../lib/schema/schema';\nimport {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils';\n\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(\n attributes: MeshAttributes,\n metadata?: Map<string, string>\n): Schema {\n const fields = deduceMeshFields(attributes);\n return new Schema(fields, metadata);\n}\n\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(\n attributeName: string,\n attribute: MeshAttribute,\n optionalMetadata?: Map<string, string>\n): Field {\n const type = getArrowTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n const field = new Field(\n attributeName,\n new FixedSizeList(attribute.size, new Field('value', type)),\n false,\n metadata\n );\n return field;\n}\n\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes: MeshAttributes): Field[] {\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute: MeshAttribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute: MeshAttribute): Map<string, string> {\n const result = new Map();\n if ('byteOffset' in attribute) {\n result.set('byteOffset', attribute.byteOffset!.toString(10));\n }\n if ('byteStride' in attribute) {\n result.set('byteStride', attribute.byteStride!.toString(10));\n }\n if ('normalized' in attribute) {\n result.set('normalized', attribute.normalized!.toString());\n }\n return result;\n}\n"],"mappings":";;;;;;;;AACA;AACA;AAQO,
|
|
1
|
+
{"version":3,"file":"deduce-mesh-schema.js","names":["_schema","require","_arrowLikeTypeUtils","deduceMeshSchema","attributes","metadata","fields","deduceMeshFields","Schema","deduceMeshField","attributeName","attribute","optionalMetadata","type","getArrowTypeFromTypedArray","value","makeMeshAttributeMetadata","field","Field","FixedSizeList","size","push","result","Map","set","byteOffset","toString","byteStride","normalized"],"sources":["../../../../src/category/mesh/deduce-mesh-schema.ts"],"sourcesContent":["import {MeshAttribute, MeshAttributes} from './mesh-types';\nimport {Schema, Field, FixedSizeList} from '../../lib/schema/schema';\nimport {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils';\n\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(\n attributes: MeshAttributes,\n metadata?: Map<string, string>\n): Schema {\n const fields = deduceMeshFields(attributes);\n return new Schema(fields, metadata);\n}\n\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(\n attributeName: string,\n attribute: MeshAttribute,\n optionalMetadata?: Map<string, string>\n): Field {\n const type = getArrowTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n const field = new Field(\n attributeName,\n new FixedSizeList(attribute.size, new Field('value', type)),\n false,\n metadata\n );\n return field;\n}\n\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes: MeshAttributes): Field[] {\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute: MeshAttribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute: MeshAttribute): Map<string, string> {\n const result = new Map();\n if ('byteOffset' in attribute) {\n result.set('byteOffset', attribute.byteOffset!.toString(10));\n }\n if ('byteStride' in attribute) {\n result.set('byteStride', attribute.byteStride!.toString(10));\n }\n if ('normalized' in attribute) {\n result.set('normalized', attribute.normalized!.toString());\n }\n return result;\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAQO,SAASE,gBAAgBA,CAC9BC,UAA0B,EAC1BC,QAA8B,EACtB;EACR,IAAMC,MAAM,GAAGC,gBAAgB,CAACH,UAAU,CAAC;EAC3C,OAAO,IAAII,cAAM,CAACF,MAAM,EAAED,QAAQ,CAAC;AACrC;AASO,SAASI,eAAeA,CAC7BC,aAAqB,EACrBC,SAAwB,EACxBC,gBAAsC,EAC/B;EACP,IAAMC,IAAI,GAAG,IAAAC,8CAA0B,EAACH,SAAS,CAACI,KAAK,CAAC;EACxD,IAAMV,QAAQ,GAAGO,gBAAgB,GAAGA,gBAAgB,GAAGI,yBAAyB,CAACL,SAAS,CAAC;EAC3F,IAAMM,KAAK,GAAG,IAAIC,aAAK,CACrBR,aAAa,EACb,IAAIS,qBAAa,CAACR,SAAS,CAACS,IAAI,EAAE,IAAIF,aAAK,CAAC,OAAO,EAAEL,IAAI,CAAC,CAAC,EAC3D,KAAK,EACLR,QAAQ,CACT;EACD,OAAOY,KAAK;AACd;AAOA,SAASV,gBAAgBA,CAACH,UAA0B,EAAW;EAC7D,IAAME,MAAe,GAAG,EAAE;EAC1B,KAAK,IAAMI,aAAa,IAAIN,UAAU,EAAE;IACtC,IAAMO,SAAwB,GAAGP,UAAU,CAACM,aAAa,CAAC;IAC1DJ,MAAM,CAACe,IAAI,CAACZ,eAAe,CAACC,aAAa,EAAEC,SAAS,CAAC,CAAC;EACxD;EACA,OAAOL,MAAM;AACf;AAOO,SAASU,yBAAyBA,CAACL,SAAwB,EAAuB;EACvF,IAAMW,MAAM,GAAG,IAAIC,GAAG,EAAE;EACxB,IAAI,YAAY,IAAIZ,SAAS,EAAE;IAC7BW,MAAM,CAACE,GAAG,CAAC,YAAY,EAAEb,SAAS,CAACc,UAAU,CAAEC,QAAQ,CAAC,EAAE,CAAC,CAAC;EAC9D;EACA,IAAI,YAAY,IAAIf,SAAS,EAAE;IAC7BW,MAAM,CAACE,GAAG,CAAC,YAAY,EAAEb,SAAS,CAACgB,UAAU,CAAED,QAAQ,CAAC,EAAE,CAAC,CAAC;EAC9D;EACA,IAAI,YAAY,IAAIf,SAAS,EAAE;IAC7BW,MAAM,CAACE,GAAG,CAAC,YAAY,EAAEb,SAAS,CAACiB,UAAU,CAAEF,QAAQ,EAAE,CAAC;EAC5D;EACA,OAAOJ,MAAM;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-to-arrow-table.js","names":["convertMeshToArrowTable","mesh","batchSize","vectors","fields","attributeKey","attributes","attribute","value","size","type","getArrowType","vector","getArrowVector","listType","FixedSizeList","Field","field","makeMeshAttributeMetadata","data","Data","length","undefined","listVector","FixedSizeListVector","push","schema","Schema","metadata","Map","recordBatch","RecordBatch","table","Table"],"sources":["../../../../src/category/mesh/mesh-to-arrow-table.ts"],"sourcesContent":["import {\n Table,\n Schema,\n RecordBatch,\n FixedSizeList,\n Field,\n Data,\n FixedSizeListVector\n} from 'apache-arrow/Arrow.dom';\nimport {AbstractVector} from 'apache-arrow/vector';\nimport {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';\nimport type {Mesh} from './mesh-types';\nimport {makeMeshAttributeMetadata} from './deduce-mesh-schema';\n\n/**\n * * Convert a loaders.gl Mesh to an Apache Arrow Table\n * @param mesh\n * @param metadata\n * @param batchSize\n * @returns\n */\nexport function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {\n const vectors: AbstractVector[] = [];\n const fields: Field[] = [];\n for (const attributeKey in mesh.attributes) {\n const attribute = mesh.attributes[attributeKey];\n const {value, size = 1} = attribute;\n const type = getArrowType(value);\n const vector = getArrowVector(value);\n const listType = new FixedSizeList(size, new Field('value', type));\n const field = new Field(attributeKey, listType, false, makeMeshAttributeMetadata(attribute));\n const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);\n const listVector = new FixedSizeListVector(data);\n vectors.push(listVector);\n fields.push(field);\n }\n const schema = new Schema(fields, mesh?.schema?.metadata || new Map<string, string>());\n const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);\n const table = new Table(schema, recordBatch);\n return table;\n}\n"],"mappings":";;;;;;AAAA;AAUA;AAEA;AASO,
|
|
1
|
+
{"version":3,"file":"mesh-to-arrow-table.js","names":["_Arrow","require","_arrowTypeUtils","_deduceMeshSchema","convertMeshToArrowTable","mesh","batchSize","_mesh$schema","vectors","fields","attributeKey","attributes","attribute","value","_attribute$size","size","type","getArrowType","vector","getArrowVector","listType","FixedSizeList","Field","field","makeMeshAttributeMetadata","data","Data","length","undefined","listVector","FixedSizeListVector","push","schema","Schema","metadata","Map","recordBatch","RecordBatch","table","Table"],"sources":["../../../../src/category/mesh/mesh-to-arrow-table.ts"],"sourcesContent":["import {\n Table,\n Schema,\n RecordBatch,\n FixedSizeList,\n Field,\n Data,\n FixedSizeListVector\n} from 'apache-arrow/Arrow.dom';\nimport {AbstractVector} from 'apache-arrow/vector';\nimport {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';\nimport type {Mesh} from './mesh-types';\nimport {makeMeshAttributeMetadata} from './deduce-mesh-schema';\n\n/**\n * * Convert a loaders.gl Mesh to an Apache Arrow Table\n * @param mesh\n * @param metadata\n * @param batchSize\n * @returns\n */\nexport function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {\n const vectors: AbstractVector[] = [];\n const fields: Field[] = [];\n for (const attributeKey in mesh.attributes) {\n const attribute = mesh.attributes[attributeKey];\n const {value, size = 1} = attribute;\n const type = getArrowType(value);\n const vector = getArrowVector(value);\n const listType = new FixedSizeList(size, new Field('value', type));\n const field = new Field(attributeKey, listType, false, makeMeshAttributeMetadata(attribute));\n const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);\n const listVector = new FixedSizeListVector(data);\n vectors.push(listVector);\n fields.push(field);\n }\n const schema = new Schema(fields, mesh?.schema?.metadata || new Map<string, string>());\n const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);\n const table = new Table(schema, recordBatch);\n return table;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAUA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AASO,SAASG,uBAAuBA,CAACC,IAAU,EAAEC,SAAkB,EAAS;EAAA,IAAAC,YAAA;EAC7E,IAAMC,OAAyB,GAAG,EAAE;EACpC,IAAMC,MAAe,GAAG,EAAE;EAC1B,KAAK,IAAMC,YAAY,IAAIL,IAAI,CAACM,UAAU,EAAE;IAC1C,IAAMC,SAAS,GAAGP,IAAI,CAACM,UAAU,CAACD,YAAY,CAAC;IAC/C,IAAOG,KAAK,GAAcD,SAAS,CAA5BC,KAAK;MAAAC,eAAA,GAAcF,SAAS,CAArBG,IAAI;MAAJA,IAAI,GAAAD,eAAA,cAAG,CAAC,GAAAA,eAAA;IACtB,IAAME,IAAI,GAAG,IAAAC,4BAAY,EAACJ,KAAK,CAAC;IAChC,IAAMK,MAAM,GAAG,IAAAC,8BAAc,EAACN,KAAK,CAAC;IACpC,IAAMO,QAAQ,GAAG,IAAIC,oBAAa,CAACN,IAAI,EAAE,IAAIO,YAAK,CAAC,OAAO,EAAEN,IAAI,CAAC,CAAC;IAClE,IAAMO,KAAK,GAAG,IAAID,YAAK,CAACZ,YAAY,EAAEU,QAAQ,EAAE,KAAK,EAAE,IAAAI,2CAAyB,EAACZ,SAAS,CAAC,CAAC;IAC5F,IAAMa,IAAI,GAAG,IAAIC,WAAI,CAACN,QAAQ,EAAE,CAAC,EAAEP,KAAK,CAACc,MAAM,GAAGZ,IAAI,EAAE,CAAC,EAAEa,SAAS,EAAE,CAACV,MAAM,CAAC,CAAC;IAC/E,IAAMW,UAAU,GAAG,IAAIC,0BAAmB,CAACL,IAAI,CAAC;IAChDjB,OAAO,CAACuB,IAAI,CAACF,UAAU,CAAC;IACxBpB,MAAM,CAACsB,IAAI,CAACR,KAAK,CAAC;EACpB;EACA,IAAMS,MAAM,GAAG,IAAIC,aAAM,CAACxB,MAAM,EAAE,CAAAJ,IAAI,aAAJA,IAAI,wBAAAE,YAAA,GAAJF,IAAI,CAAE2B,MAAM,cAAAzB,YAAA,uBAAZA,YAAA,CAAc2B,QAAQ,KAAI,IAAIC,GAAG,EAAkB,CAAC;EACtF,IAAMC,WAAW,GAAG,IAAIC,kBAAW,CAACL,MAAM,EAAExB,OAAO,CAAC,CAAC,CAAC,CAACmB,MAAM,EAAEnB,OAAO,CAAC;EACvE,IAAM8B,KAAK,GAAG,IAAIC,YAAK,CAACP,MAAM,EAAEI,WAAW,CAAC;EAC5C,OAAOE,KAAK;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-types.js","names":[],"sources":["../../../../src/category/mesh/mesh-types.ts"],"sourcesContent":["import type {Schema} from '../../lib/schema/schema';\nimport type {TypedArray} from '../../types';\nimport type {ColumnarTable, ArrowTable} from '../table/table-types';\n\n/** Mesh as columnar table */\nexport interface MeshTable extends ColumnarTable {\n // shape: 'mesh-table';\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n indices?: MeshAttribute;\n}\n\n/** Mesh as arrow table */\nexport interface MeshArrowTable extends ArrowTable {\n // shape: 'mesh-arrow-table';\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n indices?: MeshAttribute;\n}\n\n/** Geometry part of a Mesh (compatible with a standard luma.gl \"mesh\") */\nexport type MeshGeometry = {\n attributes: {[attributeName: string]: MeshAttribute};\n indices?: MeshAttribute;\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n mode: number;\n};\n\n/** Geometry and metadata for a Mesh (compatible with a standard luma.gl \"mesh\") */\nexport type Mesh = MeshGeometry & {\n loader?: string;\n loaderData?: {[key: string]: any};\n header?: {\n vertexCount: number;\n boundingBox?: [number[], number[]];\n };\n schema: Schema;\n};\n\n/**\n * luma.gl compatible attribute descriptors\n * Can be mapped to any WebGL framework\n */\nexport type MeshAttribute = {\n value: TypedArray;\n size: number;\n byteOffset?: number;\n byteStride?: number;\n normalized?: boolean;\n};\n\n/** A map of mesh attributes keyed by attribute names */\nexport type MeshAttributes =
|
|
1
|
+
{"version":3,"file":"mesh-types.js","names":[],"sources":["../../../../src/category/mesh/mesh-types.ts"],"sourcesContent":["import type {Schema} from '../../lib/schema/schema';\nimport type {TypedArray} from '../../types';\nimport type {ColumnarTable, ArrowTable} from '../table/table-types';\n\n/** Mesh as columnar table */\nexport interface MeshTable extends ColumnarTable {\n // shape: 'mesh-table';\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n indices?: MeshAttribute;\n}\n\n/** Mesh as arrow table */\nexport interface MeshArrowTable extends ArrowTable {\n // shape: 'mesh-arrow-table';\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n indices?: MeshAttribute;\n}\n\n/** Geometry part of a Mesh (compatible with a standard luma.gl \"mesh\") */\nexport type MeshGeometry = {\n attributes: {[attributeName: string]: MeshAttribute};\n indices?: MeshAttribute;\n topology: 'point-list' | 'triangle-list' | 'triangle-strip';\n mode: number;\n};\n\n/** Geometry and metadata for a Mesh (compatible with a standard luma.gl \"mesh\") */\nexport type Mesh = MeshGeometry & {\n loader?: string;\n loaderData?: {[key: string]: any};\n header?: {\n vertexCount: number;\n boundingBox?: [number[], number[]];\n };\n schema: Schema;\n};\n\n/**\n * luma.gl compatible attribute descriptors\n * Can be mapped to any WebGL framework\n */\nexport type MeshAttribute = {\n value: TypedArray;\n size: number;\n byteOffset?: number;\n byteStride?: number;\n normalized?: boolean;\n};\n\n/** A map of mesh attributes keyed by attribute names */\nexport type MeshAttributes = Record<string, MeshAttribute>;\n"],"mappings":""}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getMeshBoundingBox = getMeshBoundingBox;
|
|
7
7
|
exports.getMeshSize = getMeshSize;
|
|
8
|
-
|
|
9
8
|
function getMeshSize(attributes) {
|
|
10
9
|
var size = 0;
|
|
11
10
|
for (var attributeName in attributes) {
|
|
@@ -16,7 +15,6 @@ function getMeshSize(attributes) {
|
|
|
16
15
|
}
|
|
17
16
|
return size;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
function getMeshBoundingBox(attributes) {
|
|
21
19
|
var minX = Infinity;
|
|
22
20
|
var minY = Infinity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-utils.js","names":["getMeshSize","attributes","size","attributeName","attribute","ArrayBuffer","isView","byteLength","BYTES_PER_ELEMENT","getMeshBoundingBox","minX","Infinity","minY","minZ","maxX","maxY","maxZ","positions","POSITION","value","len","length","i","x","y","z"],"sources":["../../../../src/category/mesh/mesh-utils.ts"],"sourcesContent":["// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {TypedArray} from '../../types';\nimport {MeshAttributes} from './mesh-types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mesh-utils.js","names":["getMeshSize","attributes","size","attributeName","attribute","ArrayBuffer","isView","byteLength","BYTES_PER_ELEMENT","getMeshBoundingBox","minX","Infinity","minY","minZ","maxX","maxY","maxZ","positions","POSITION","value","len","length","i","x","y","z"],"sources":["../../../../src/category/mesh/mesh-utils.ts"],"sourcesContent":["// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {TypedArray} from '../../types';\nimport {MeshAttributes} from './mesh-types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n"],"mappings":";;;;;;;AAiBO,SAASA,WAAWA,CAACC,UAAuB,EAAU;EAC3D,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAMC,aAAa,IAAIF,UAAU,EAAE;IACtC,IAAMG,SAAS,GAAGH,UAAU,CAACE,aAAa,CAAC;IAC3C,IAAIE,WAAW,CAACC,MAAM,CAACF,SAAS,CAAC,EAAE;MAEjCF,IAAI,IAAIE,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,iBAAiB;IAC5D;EACF;EACA,OAAON,I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nB;AACH"}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deduceTableSchema = deduceTableSchema;
|
|
7
|
-
|
|
8
7
|
function deduceTableSchema(table, schema) {
|
|
9
8
|
var deducedSchema = Array.isArray(table) ? deduceSchemaForRowTable(table) : deduceSchemaForColumnarTable(table);
|
|
10
9
|
return Object.assign(deducedSchema, schema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deduce-table-schema.js","names":["deduceTableSchema","table","schema","deducedSchema","Array","isArray","deduceSchemaForRowTable","deduceSchemaForColumnarTable","Object","assign","columnarTable","field","column","ArrayBuffer","isView","constructor","length","value","deduceTypeFromValue","rowTable","row","Date","Number","Float32Array","String"],"sources":["../../../../src/category/table/deduce-table-schema.ts"],"sourcesContent":["// Type deduction\nimport {\n Schema\n // Int,\n // Int8,\n // Int16,\n // Int32,\n // Uint8,\n // Uint16,\n // Uint32,\n // Float32,\n // Float64\n // Bool,\n // Utf8,\n // TimestampMillisecond,\n // Null\n} from '../../lib/schema/schema';\n\n// const TYPED_ARRAY_TO_TYPE = {\n// Int8Array: new Int8(),\n// Int16Array: new Int16(),\n// Int32Array: new Int32(),\n// Uint8Array: new Uint8(),\n// Uint8ClampedArray: new Uint8(),\n// Uint16Array: new Uint16(),\n// Uint32Array: new Uint32(),\n// Float32Array: new Float32(),\n// Float64Array: new Float64()\n// };\n\n// if (typeof BigInt64Array !== 'undefined') {\n// TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n// }\n\n/**\n * SCHEMA SUPPORT - AUTODEDUCTION\n * @param {*} table\n * @param {*} schema\n * @returns\n */\nexport function deduceTableSchema(table, schema?: Schema) {\n const deducedSchema = Array.isArray(table)\n ? deduceSchemaForRowTable(table)\n : deduceSchemaForColumnarTable(table);\n // Deduced schema will fill in missing info from partial options.schema, if provided\n return Object.assign(deducedSchema, schema);\n}\n\nfunction deduceSchemaForColumnarTable(columnarTable) {\n const schema = {};\n for (const field in columnarTable) {\n const column = columnarTable[field];\n // Check if column is typed, if so we are done\n if (ArrayBuffer.isView(column)) {\n schema[field] = column.constructor;\n // else we need data\n } else if (column.length) {\n const value = column[0];\n schema[field] = deduceTypeFromValue(value);\n // TODO - support nested schemas?\n }\n // else we mark as present but unknow\n schema[field] = schema[field] || null;\n }\n return schema;\n}\n\nfunction deduceSchemaForRowTable(rowTable) {\n const schema = {};\n if (rowTable.length) {\n const row = rowTable[0];\n // TODO - Could look at additional rows if nulls in first row\n for (const field in row) {\n const value = row[field];\n schema[field] = deduceTypeFromValue(value);\n }\n }\n return schema;\n}\n\nfunction deduceTypeFromValue(value) {\n if (value instanceof Date) {\n return Date;\n } else if (value instanceof Number) {\n return Float32Array;\n } else if (typeof value === 'string') {\n return String;\n }\n return null;\n}\n\n/*\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction deduceSchema(rows) {\n const row = rows[0];\n\n const schema = {};\n let i = 0;\n for (const columnName in row) {\n const value = row[columnName];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n\n case 'object':\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n break;\n\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n i++;\n }\n return schema;\n}\n*/\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"deduce-table-schema.js","names":["deduceTableSchema","table","schema","deducedSchema","Array","isArray","deduceSchemaForRowTable","deduceSchemaForColumnarTable","Object","assign","columnarTable","field","column","ArrayBuffer","isView","constructor","length","value","deduceTypeFromValue","rowTable","row","Date","Number","Float32Array","String"],"sources":["../../../../src/category/table/deduce-table-schema.ts"],"sourcesContent":["// Type deduction\nimport {\n Schema\n // Int,\n // Int8,\n // Int16,\n // Int32,\n // Uint8,\n // Uint16,\n // Uint32,\n // Float32,\n // Float64\n // Bool,\n // Utf8,\n // TimestampMillisecond,\n // Null\n} from '../../lib/schema/schema';\n\n// const TYPED_ARRAY_TO_TYPE = {\n// Int8Array: new Int8(),\n// Int16Array: new Int16(),\n// Int32Array: new Int32(),\n// Uint8Array: new Uint8(),\n// Uint8ClampedArray: new Uint8(),\n// Uint16Array: new Uint16(),\n// Uint32Array: new Uint32(),\n// Float32Array: new Float32(),\n// Float64Array: new Float64()\n// };\n\n// if (typeof BigInt64Array !== 'undefined') {\n// TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n// }\n\n/**\n * SCHEMA SUPPORT - AUTODEDUCTION\n * @param {*} table\n * @param {*} schema\n * @returns\n */\nexport function deduceTableSchema(table, schema?: Schema) {\n const deducedSchema = Array.isArray(table)\n ? deduceSchemaForRowTable(table)\n : deduceSchemaForColumnarTable(table);\n // Deduced schema will fill in missing info from partial options.schema, if provided\n return Object.assign(deducedSchema, schema);\n}\n\nfunction deduceSchemaForColumnarTable(columnarTable) {\n const schema = {};\n for (const field in columnarTable) {\n const column = columnarTable[field];\n // Check if column is typed, if so we are done\n if (ArrayBuffer.isView(column)) {\n schema[field] = column.constructor;\n // else we need data\n } else if (column.length) {\n const value = column[0];\n schema[field] = deduceTypeFromValue(value);\n // TODO - support nested schemas?\n }\n // else we mark as present but unknow\n schema[field] = schema[field] || null;\n }\n return schema;\n}\n\nfunction deduceSchemaForRowTable(rowTable) {\n const schema = {};\n if (rowTable.length) {\n const row = rowTable[0];\n // TODO - Could look at additional rows if nulls in first row\n for (const field in row) {\n const value = row[field];\n schema[field] = deduceTypeFromValue(value);\n }\n }\n return schema;\n}\n\nfunction deduceTypeFromValue(value) {\n if (value instanceof Date) {\n return Date;\n } else if (value instanceof Number) {\n return Float32Array;\n } else if (typeof value === 'string') {\n return String;\n }\n return null;\n}\n\n/*\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction deduceSchema(rows) {\n const row = rows[0];\n\n const schema = {};\n let i = 0;\n for (const columnName in row) {\n const value = row[columnName];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n\n case 'object':\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n break;\n\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n i++;\n }\n return schema;\n}\n*/\n"],"mappings":";;;;;;AAyCO,SAASA,iBAAiBA,CAACC,KAAK,EAAEC,MAAe,EAAE;EACxD,IAAMC,aAAa,GAAGC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,GACtCK,uBAAuB,CAACL,KAAK,CAAC,GAC9BM,4BAA4B,CAACN,KAAK,CAAC;EAEvC,OAAOO,MAAM,CAACC,MAAM,CAACN,aAAa,EAAED,MAAM,CAAC;AAC7C;AAEA,SAASK,4BAA4BA,CAACG,aAAa,EAAE;EACnD,IAAMR,MAAM,GAAG,CAAC,CAAC;EACjB,KAAK,IAAMS,KAAK,IAAID,aAAa,EAAE;IACjC,IAAME,MAAM,GAAGF,aAAa,CAACC,KAAK,CAAC;IAEnC,IAAIE,WAAW,CAACC,MAAM,CAACF,MAAM,CAAC,EAAE;MAC9BV,MAAM,CAACS,KAAK,CAAC,GAAGC,MAAM,CAACG,WAAW;IAEpC,CAAC,MAAM,IAAIH,MAAM,CAACI,MAAM,EAAE;MACxB,IAAMC,KAAK,GAAGL,MAAM,CAAC,CAAC,CAAC;MACvBV,MAAM,CAACS,KAAK,CAAC,GAAGO,mBAAmB,CAACD,KAAK,CAAC;IAE5C;IAEAf,MAAM,CAACS,KAAK,CAAC,GAAGT,MAAM,CAACS,KAAK,CAAC,IAAI,IAAI;EACvC;EACA,OAAOT,MAAM;AACf;AAEA,SAASI,uBAAuBA,CAACa,QAAQ,EAAE;EACzC,IAAMjB,MAAM,GAAG,CAAC,CAAC;EACjB,IAAIiB,QAAQ,CAACH,MAAM,EAAE;IACnB,IAAMI,GAAG,GAAGD,QAAQ,CAAC,CAAC,CAAC;IAEvB,KAAK,IAAMR,KAAK,IAAIS,GAAG,EAAE;MACvB,IAAMH,KAAK,GAAGG,GAAG,CAACT,KAAK,CAAC;MACxBT,MAAM,CAACS,KAAK,CAAC,GAAGO,mBAAmB,CAACD,KAAK,CAAC;IAC5C;EACF;EACA,OAAOf,MAAM;AACf;AAEA,SAASgB,mBAAmBA,CAACD,KAAK,EAAE;EAClC,IAAIA,KAAK,YAAYI,IAAI,EAAE;IACzB,OAAOA,IAAI;EACb,CAAC,MAAM,IAAIJ,KAAK,YAAYK,MAAM,EAAE;IAClC,OAAOC,YAAY;EACrB,CAAC,MAAM,IAAI,OAAON,KAAK,KAAK,QAAQ,EAAE;IACpC,OAAOO,MAAM;EACf;EACA,OAAO,IAAI;AACb"}
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {TypedArray, NumberArray, AnyArray} from './types';\n\nexport type {Batch} from './category/common';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './category/table/table-types';\nexport type {\n TableBatch,\n RowArrayTableBatch,\n RowObjectTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './category/table/table-types';\n\n// TABLE CATEGORY UTILS\nexport {default as TableBatchBuilder} from './lib/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';\nexport {default as RowTableBatchAggregator} from './lib/batches/row-table-batch-aggregator';\nexport {default as ColumnarTableBatchAggregator} from './lib/batches/columnar-table-batch-aggregator';\n\nexport {convertToObjectRow, convertToArrayRow} from './lib/utils/row-utils';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './category/mesh/mesh-types';\n\nexport {getMeshSize, getMeshBoundingBox} from './category/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './category/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './category/texture/texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './category/image/image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './category/gis';\n\nexport type {GeojsonGeometryInfo} from './category/gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './category/gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './category/gis';\nexport type {\n BinaryFeatures,\n BinaryPointFeatures,\n BinaryLineFeatures,\n BinaryPolygonFeatures\n} from './category/gis';\n\n// SCHEMA\nexport {\n Schema,\n Field,\n DataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/schema/schema';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {deduceTypeFromColumn, deduceTypeFromValue} from './lib/schema-utils/deduce-column-type';\nexport {getTypeInfo} from './lib/arrow/get-type-info';\nexport {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;AAEA;AACA;AAEA;AAYA;AAGA;AA4DA;AA0CA;AACA;AACA;AAEA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_tableBatchBuilder","_interopRequireDefault","require","_rowTableBatchAggregator","_columnarTableBatchAggregator","_rowUtils","_meshUtils","_deduceMeshSchema","_schema","_deduceColumnType","_getTypeInfo","_arrowLikeTypeUtils","_asyncQueue"],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {TypedArray, NumberArray, AnyArray} from './types';\n\nexport type {Batch} from './category/common';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './category/table/table-types';\nexport type {\n TableBatch,\n RowArrayTableBatch,\n RowObjectTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './category/table/table-types';\n\n// TABLE CATEGORY UTILS\nexport {default as TableBatchBuilder} from './lib/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';\nexport {default as RowTableBatchAggregator} from './lib/batches/row-table-batch-aggregator';\nexport {default as ColumnarTableBatchAggregator} from './lib/batches/columnar-table-batch-aggregator';\n\nexport {convertToObjectRow, convertToArrayRow} from './lib/utils/row-utils';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './category/mesh/mesh-types';\n\nexport {getMeshSize, getMeshBoundingBox} from './category/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './category/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './category/texture/texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './category/image/image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './category/gis';\n\nexport type {GeojsonGeometryInfo} from './category/gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './category/gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './category/gis';\nexport type {\n BinaryFeatures,\n BinaryPointFeatures,\n BinaryLineFeatures,\n BinaryPolygonFeatures\n} from './category/gis';\n\n// SCHEMA\nexport {\n Schema,\n Field,\n DataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/schema/schema';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {deduceTypeFromColumn, deduceTypeFromValue} from './lib/schema-utils/deduce-column-type';\nexport {getTypeInfo} from './lib/arrow/get-type-info';\nexport {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,6BAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAYA,IAAAI,UAAA,GAAAJ,OAAA;AAGA,IAAAK,iBAAA,GAAAL,OAAA;AA4DA,IAAAM,OAAA,GAAAN,OAAA;AA0CA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AAEA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-like-type-utils.js","names":["getArrowTypeFromTypedArray","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error"],"sources":["../../../../src/lib/arrow/arrow-like-type-utils.ts"],"sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8\n} from '../schema/schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n"],"mappings":";;;;;;AACA;AAYO,
|
|
1
|
+
{"version":3,"file":"arrow-like-type-utils.js","names":["_schema","require","getArrowTypeFromTypedArray","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error"],"sources":["../../../../src/lib/arrow/arrow-like-type-utils.ts"],"sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8\n} from '../schema/schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAYO,SAASC,0BAA0BA,CAACC,KAAiB,EAAY;EACtE,QAAQA,KAAK,CAACC,WAAW;IACvB,KAAKC,SAAS;MACZ,OAAO,IAAIC,YAAI,EAAE;IACnB,KAAKC,UAAU;MACb,OAAO,IAAIC,aAAK,EAAE;IACpB,KAAKC,UAAU;MACb,OAAO,IAAIC,aAAK,EAAE;IACpB,KAAKC,WAAW;MACd,OAAO,IAAIC,cAAM,EAAE;IACrB,KAAKC,UAAU;MACb,OAAO,IAAIC,aAAK,EAAE;IACpB,KAAKC,WAAW;MACd,OAAO,IAAIC,cAAM,EAAE;IACrB,KAAKC,YAAY;MACf,OAAO,IAAIC,eAAO,EAAE;IACtB,KAAKC,YAAY;MACf,OAAO,IAAIC,eAAO,EAAE;IACtB;MACE,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;EAAC;AAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-type-utils.js","names":["getArrowType","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error","getArrowVector","Int8Vector","from","Uint8Vector","Int16Vector","Uint16Vector","Int32Vector","Uint32Vector","Float32Vector","Float64Vector"],"sources":["../../../../src/lib/arrow/arrow-type-utils.ts"],"sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8,\n Int8Vector,\n Uint8Vector,\n Int16Vector,\n Uint16Vector,\n Int32Vector,\n Uint32Vector,\n Float32Vector,\n Float64Vector\n} from 'apache-arrow/Arrow.dom';\nimport {AbstractVector} from 'apache-arrow/vector';\n\nexport function getArrowType(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n\nexport function getArrowVector(array: TypedArray): AbstractVector {\n switch (array.constructor) {\n case Int8Array:\n return Int8Vector.from(array);\n case Uint8Array:\n return Uint8Vector.from(array);\n case Int16Array:\n return Int16Vector.from(array);\n case Uint16Array:\n return Uint16Vector.from(array);\n case Int32Array:\n return Int32Vector.from(array);\n case Uint32Array:\n return Uint32Vector.from(array);\n case Float32Array:\n return Float32Vector.from(array);\n case Float64Array:\n return Float64Vector.from(array);\n default:\n throw new Error('array type not supported');\n }\n}\n"],"mappings":";;;;;;;AACA;AAqBO,
|
|
1
|
+
{"version":3,"file":"arrow-type-utils.js","names":["_Arrow","require","getArrowType","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error","getArrowVector","Int8Vector","from","Uint8Vector","Int16Vector","Uint16Vector","Int32Vector","Uint32Vector","Float32Vector","Float64Vector"],"sources":["../../../../src/lib/arrow/arrow-type-utils.ts"],"sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8,\n Int8Vector,\n Uint8Vector,\n Int16Vector,\n Uint16Vector,\n Int32Vector,\n Uint32Vector,\n Float32Vector,\n Float64Vector\n} from 'apache-arrow/Arrow.dom';\nimport {AbstractVector} from 'apache-arrow/vector';\n\nexport function getArrowType(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n\nexport function getArrowVector(array: TypedArray): AbstractVector {\n switch (array.constructor) {\n case Int8Array:\n return Int8Vector.from(array);\n case Uint8Array:\n return Uint8Vector.from(array);\n case Int16Array:\n return Int16Vector.from(array);\n case Uint16Array:\n return Uint16Vector.from(array);\n case Int32Array:\n return Int32Vector.from(array);\n case Uint32Array:\n return Uint32Vector.from(array);\n case Float32Array:\n return Float32Vector.from(array);\n case Float64Array:\n return Float64Vector.from(array);\n default:\n throw new Error('array type not supported');\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAqBO,SAASC,YAAYA,CAACC,KAAiB,EAAY;EACxD,QAAQA,KAAK,CAACC,WAAW;IACvB,KAAKC,SAAS;MACZ,OAAO,IAAIC,WAAI,EAAE;IACnB,KAAKC,UAAU;MACb,OAAO,IAAIC,YAAK,EAAE;IACpB,KAAKC,UAAU;MACb,OAAO,IAAIC,YAAK,EAAE;IACpB,KAAKC,WAAW;MACd,OAAO,IAAIC,aAAM,EAAE;IACrB,KAAKC,UAAU;MACb,OAAO,IAAIC,YAAK,EAAE;IACpB,KAAKC,WAAW;MACd,OAAO,IAAIC,aAAM,EAAE;IACrB,KAAKC,YAAY;MACf,OAAO,IAAIC,cAAO,EAAE;IACtB,KAAKC,YAAY;MACf,OAAO,IAAIC,cAAO,EAAE;IACtB;MACE,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;EAAC;AAElD;AAEO,SAASC,cAAcA,CAACnB,KAAiB,EAAkB;EAChE,QAAQA,KAAK,CAACC,WAAW;IACvB,KAAKC,SAAS;MACZ,OAAOkB,iBAAU,CAACC,IAAI,CAACrB,KAAK,CAAC;IAC/B,KAAKI,UAAU;MACb,OAAOkB,kBAAW,CAACD,IAAI,CAACrB,KAAK,CAAC;IAChC,KAAKM,UAAU;MACb,OAAOiB,kBAAW,CAACF,IAAI,CAACrB,KAAK,CAAC;IAChC,KAAKQ,WAAW;MACd,OAAOgB,mBAAY,CAACH,IAAI,CAACrB,KAAK,CAAC;IACjC,KAAKU,UAAU;MACb,OAAOe,kBAAW,CAACJ,IAAI,CAACrB,KAAK,CAAC;IAChC,KAAKY,WAAW;MACd,OAAOc,mBAAY,CAACL,IAAI,CAACrB,KAAK,CAAC;IACjC,KAAKc,YAAY;MACf,OAAOa,oBAAa,CAACN,IAAI,CAACrB,KAAK,CAAC;IAClC,KAAKgB,YAAY;MACf,OAAOY,oBAAa,CAACP,IAAI,CAACrB,KAAK,CAAC;IAClC;MACE,MAAM,IAAIkB,KAAK,CAAC,0BAA0B,CAAC;EAAC;AAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type-info.js","names":["getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"mappings":";;;;;;AAAA;AAOO,
|
|
1
|
+
{"version":3,"file":"get-type-info.js","names":["_schema","require","getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CAACC,aAAkB,EAM5C;EACA,OAAO;IACLC,MAAM,EAAED,aAAa,CAACC,MAAM;IAC5BC,SAAS,EAAEF,aAAa,CAACE,SAAS;IAClCC,QAAQ,EAAEH,aAAa,CAACI,QAAQ,EAAE;IAClCC,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAM,CAAC;IAC9CM,SAAS,EAAEP,aAAa,CAACO;EAC3B,CAAC;AACH;AAEA,IAAIC,WAA2C,GAAG,IAAI;AAEtD,SAASF,UAAUA,CAACG,OAAO,EAAE;EAC3B,IAAI,CAACD,WAAW,EAAE;IAChBA,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,IAAME,IAAG,IAAIC,YAAI,EAAE;MACtBH,WAAW,CAACG,YAAI,CAACD,IAAG,CAAC,CAAC,GAAGA,IAAG;IAC9B;EACF;EAEA,OAAOF,WAAW,CAACC,OAAO,CAAC;AAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","Array","isArray","_headers","key","index","name","length","row","cursor","Number","isFinite","rows","slice","batch","shape","batchType","data"],"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAMA,iBAAiB,GAAG,GAAG;AAAC,IAETC,uBAAuB;EAS1C,
|
|
1
|
+
{"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","_classCallCheck2","default","_defineProperty2","Array","isArray","_headers","key","index","name","_createClass2","value","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data","exports"],"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAMA,iBAAiB,GAAG,GAAG;AAAC,IAETC,uBAAuB;EAS1C,SAAAA,wBAAYC,MAAc,EAAEC,OAA0B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,uBAAA;IAAA,IAAAK,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA,kBALvC,CAAC;IAAA,IAAAC,gBAAA,CAAAD,OAAA,gBACG,IAAI;IAAA,IAAAC,gBAAA,CAAAD,OAAA,kBACR,CAAC;IAAA,IAAAC,gBAAA,CAAAD,OAAA,oBACW,EAAE;IAG7B,IAAI,CAACF,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACD,MAAM,GAAGA,MAAM;IAIpB,IAAI,CAACK,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,EAAE;MAC1B,IAAI,CAACO,QAAQ,GAAG,EAAE;MAClB,KAAK,IAAMC,GAAG,IAAIR,MAAM,EAAE;QACxB,IAAI,CAACO,QAAQ,CAACP,MAAM,CAACQ,GAAG,CAAC,CAACC,KAAK,CAAC,GAAGT,MAAM,CAACQ,GAAG,CAAC,CAACE,IAAI;MACrD;IACF;EACF;EAAC,IAAAC,aAAA,CAAAR,OAAA,EAAAJ,uBAAA;IAAAS,GAAA;IAAAI,KAAA,EAED,SAAAC,SAAA,EAAmB;MACjB,OAAO,IAAI,CAACC,MAAM;IACpB;EAAC;IAAAN,GAAA;IAAAI,KAAA,EAED,SAAAG,YAAYC,GAAU,EAAEC,MAAe,EAAQ;MAC7C,IAAIC,MAAM,CA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AAA,CAAAzB,OAAA,GAAAJ,uBAAA"}
|
|
@@ -49,7 +49,6 @@ var ColumnarTableBatchAggregator = function () {
|
|
|
49
49
|
value: function getBatch() {
|
|
50
50
|
this._pruneColumns();
|
|
51
51
|
var columns = Array.isArray(this.schema) ? this.columns : {};
|
|
52
|
-
|
|
53
52
|
if (!Array.isArray(this.schema)) {
|
|
54
53
|
for (var fieldName in this.schema) {
|
|
55
54
|
var field = this.schema[fieldName];
|
|
@@ -66,16 +65,12 @@ var ColumnarTableBatchAggregator = function () {
|
|
|
66
65
|
};
|
|
67
66
|
return batch;
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
}, {
|
|
71
69
|
key: "_reallocateColumns",
|
|
72
|
-
value:
|
|
73
|
-
|
|
74
|
-
function _reallocateColumns() {
|
|
70
|
+
value: function _reallocateColumns() {
|
|
75
71
|
if (this.length < this.allocated) {
|
|
76
72
|
return;
|
|
77
73
|
}
|
|
78
|
-
|
|
79
74
|
this.allocated = this.allocated > 0 ? this.allocated *= 2 : DEFAULT_ROW_COUNT;
|
|
80
75
|
this.columns = {};
|
|
81
76
|
for (var fieldName in this.schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnar-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","ColumnarTableBatchAggregator","schema","options","_reallocateColumns","length","row","i","fieldName","columns","_pruneColumns","Array","isArray","field","name","index","batch","shape","batchType","data","allocated","ArrayType","type","Float32Array","oldColumn","ArrayBuffer","isView","typedArray","set","Object","entries","columnName","column","slice"],"sources":["../../../../src/lib/batches/columnar-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {ColumnarTableBatch, ArrowTableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator} from './table-batch-aggregator';\n\ntype ColumnarTableBatchOptions = {};\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class ColumnarTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n length: number = 0;\n allocated: number = 0;\n columns: {[columnName: string]: any[]} = {};\n\n constructor(schema: Schema, options: ColumnarTableBatchOptions) {\n this.schema = schema;\n this._reallocateColumns();\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[]) {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n let i = 0;\n // TODO what if no csv header, columns not populated?\n for (const fieldName in this.columns) {\n this.columns[fieldName][this.length] = row[i++];\n }\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}): void {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n for (const fieldName in row) {\n this.columns[fieldName][this.length] = row[fieldName];\n }\n this.length++;\n }\n\n getBatch(): ColumnarTableBatch | ArrowTableBatch | null {\n this._pruneColumns();\n const columns = Array.isArray(this.schema) ? this.columns : {};\n\n // schema is an array if there're no headers\n // object if there are headers\n // columns should match schema format\n if (!Array.isArray(this.schema)) {\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n columns[field.name] = this.columns[field.index];\n }\n }\n\n this.columns = {};\n\n const batch: ColumnarTableBatch = {\n shape: 'columnar-table',\n batchType: 'data',\n data: columns,\n schema: this.schema,\n length: this.length\n };\n\n return batch;\n }\n\n // HELPERS\n\n _reallocateColumns() {\n if (this.length < this.allocated) {\n return;\n }\n\n // @ts-ignore TODO\n this.allocated = this.allocated > 0 ? (this.allocated *= 2) : DEFAULT_ROW_COUNT;\n this.columns = {};\n\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n const ArrayType = field.type || Float32Array;\n const oldColumn = this.columns[field.index];\n\n if (oldColumn && ArrayBuffer.isView(oldColumn)) {\n // Copy the old data to the new array\n const typedArray = new ArrayType(this.allocated);\n typedArray.set(oldColumn);\n this.columns[field.index] = typedArray;\n } else if (oldColumn) {\n // Plain array\n oldColumn.length = this.allocated;\n this.columns[field.index] = oldColumn;\n } else {\n // Create new\n this.columns[field.index] = new ArrayType(this.allocated);\n }\n }\n }\n\n _pruneColumns() {\n for (const [columnName, column] of Object.entries(this.columns)) {\n this.columns[columnName] = column.slice(0, this.length);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,GAAG;AAAC,IAETC,4BAA4B;EAM/C,
|
|
1
|
+
{"version":3,"file":"columnar-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","ColumnarTableBatchAggregator","schema","options","_classCallCheck2","default","_defineProperty2","_reallocateColumns","_createClass2","key","value","rowCount","length","addArrayRow","row","i","fieldName","columns","addObjectRow","getBatch","_pruneColumns","Array","isArray","field","name","index","batch","shape","batchType","data","allocated","ArrayType","type","Float32Array","oldColumn","ArrayBuffer","isView","typedArray","set","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray2","columnName","column","slice","exports"],"sources":["../../../../src/lib/batches/columnar-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {ColumnarTableBatch, ArrowTableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator} from './table-batch-aggregator';\n\ntype ColumnarTableBatchOptions = {};\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class ColumnarTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n length: number = 0;\n allocated: number = 0;\n columns: {[columnName: string]: any[]} = {};\n\n constructor(schema: Schema, options: ColumnarTableBatchOptions) {\n this.schema = schema;\n this._reallocateColumns();\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[]) {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n let i = 0;\n // TODO what if no csv header, columns not populated?\n for (const fieldName in this.columns) {\n this.columns[fieldName][this.length] = row[i++];\n }\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}): void {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n for (const fieldName in row) {\n this.columns[fieldName][this.length] = row[fieldName];\n }\n this.length++;\n }\n\n getBatch(): ColumnarTableBatch | ArrowTableBatch | null {\n this._pruneColumns();\n const columns = Array.isArray(this.schema) ? this.columns : {};\n\n // schema is an array if there're no headers\n // object if there are headers\n // columns should match schema format\n if (!Array.isArray(this.schema)) {\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n columns[field.name] = this.columns[field.index];\n }\n }\n\n this.columns = {};\n\n const batch: ColumnarTableBatch = {\n shape: 'columnar-table',\n batchType: 'data',\n data: columns,\n schema: this.schema,\n length: this.length\n };\n\n return batch;\n }\n\n // HELPERS\n\n _reallocateColumns() {\n if (this.length < this.allocated) {\n return;\n }\n\n // @ts-ignore TODO\n this.allocated = this.allocated > 0 ? (this.allocated *= 2) : DEFAULT_ROW_COUNT;\n this.columns = {};\n\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n const ArrayType = field.type || Float32Array;\n const oldColumn = this.columns[field.index];\n\n if (oldColumn && ArrayBuffer.isView(oldColumn)) {\n // Copy the old data to the new array\n const typedArray = new ArrayType(this.allocated);\n typedArray.set(oldColumn);\n this.columns[field.index] = typedArray;\n } else if (oldColumn) {\n // Plain array\n oldColumn.length = this.allocated;\n this.columns[field.index] = oldColumn;\n } else {\n // Create new\n this.columns[field.index] = new ArrayType(this.allocated);\n }\n }\n }\n\n _pruneColumns() {\n for (const [columnName, column] of Object.entries(this.columns)) {\n this.columns[columnName] = column.slice(0, this.length);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,GAAG;AAAC,IAETC,4BAA4B;EAM/C,SAAAA,6BAAYC,MAAc,EAAEC,OAAkC,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,4BAAA;IAAA,IAAAK,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA,kBAJ/C,CAAC;IAAA,IAAAC,gBAAA,CAAAD,OAAA,qBACE,CAAC;IAAA,IAAAC,gBAAA,CAAAD,OAAA,mBACoB,CAAC,CAAC;IAGzC,IAAI,CAACH,MAAM,GAAGA,MAAM;IACp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b,OAAO,CAACM,KAAK,CAACE,KAAK,CAAC,GAAGS,SAAS;QACvC,CAAC,MAAM;UAEL,IAAI,CAACjB,OAAO,CAACM,KAAK,CAACE,KAAK,CAAC,GAAG,IAAIM,SAAS,CAAC,IAAI,CAACD,SAAS,CAAC;QAC3D;MACF;IACF;EAAC;IAAArB,GAAA;IAAAC,KAAA,EAED,SAAAU,cAAA,EAAgB;MACd,SAAAmB,EAAA,MAAAC,eAAA,GAAmCC,MAAM,CAACC,OAAO,CAAC,IAAI,CAACzB,OAAO,CAAC,EAAAsB,EAAA,GAAAC,eAAA,CAAA5B,MAAA,EAAA2B,EAAA,IAAE;QAA5D,IAAAI,kBAAA,OAAAC,eAAA,CAAAvC,OAAA,EAAAmC,eAAA,CAAAD,EAAA;UAAOM,WAAU,GAAAF,kBAAA;UAAEG,MAAM,GAAAH,kBAAA;QAC5B,IAAI,CAAC1B,OAAO,CAAC4B,WAAU,CAAC,GAAGC,MAAM,CAACC,KAAK,CAAC,CAAC,EAAE,IAAI,CAACnC,MAAM,CAAC;MACzD;IACF;EAAC;EAAA,OAAAX,4BAAA;AAAA;AAAA+C,OAAA,CAAA3C,OAAA,GAAAJ,4BAAA"}
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _rowUtils = require("../utils/row-utils");
|
|
12
|
-
|
|
13
12
|
var DEFAULT_ROW_COUNT = 100;
|
|
14
13
|
var RowTableBatchAggregator = function () {
|
|
15
14
|
function RowTableBatchAggregator(schema, options) {
|
|
@@ -23,7 +22,6 @@ var RowTableBatchAggregator = function () {
|
|
|
23
22
|
(0, _defineProperty2.default)(this, "_headers", []);
|
|
24
23
|
this.options = options;
|
|
25
24
|
this.schema = schema;
|
|
26
|
-
|
|
27
25
|
if (!Array.isArray(schema)) {
|
|
28
26
|
this._headers = [];
|
|
29
27
|
for (var key in schema) {
|
|
@@ -42,7 +40,6 @@ var RowTableBatchAggregator = function () {
|
|
|
42
40
|
if (Number.isFinite(cursor)) {
|
|
43
41
|
this.cursor = cursor;
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
switch (this.options.shape) {
|
|
47
44
|
case 'object-row-table':
|
|
48
45
|
var rowObject = (0, _rowUtils.convertToObjectRow)(row, this._headers);
|
|
@@ -61,7 +58,6 @@ var RowTableBatchAggregator = function () {
|
|
|
61
58
|
if (Number.isFinite(cursor)) {
|
|
62
59
|
this.cursor = cursor;
|
|
63
60
|
}
|
|
64
|
-
|
|
65
61
|
switch (this.options.shape) {
|
|
66
62
|
case 'array-row-table':
|
|
67
63
|
var rowArray = (0, _rowUtils.convertToArrayRow)(row, this._headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","Array","isArray","_headers","key","index","name","length","row","cursor","Number","isFinite","shape","rowObject","convertToObjectRow","addObjectRow","arrayRows","rowArray","convertToArrayRow","
|
|
1
|
+
{"version":3,"file":"row-table-batch-aggregator.js","names":["_rowUtils","require","DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","_classCallCheck2","default","_defineProperty2","Array","isArray","_headers","key","index","name","_createClass2","value","rowCount","length","addArrayRow","row","cursor","Number","isFinite","shape","rowObject","convertToObjectRow","addObjectRow","arrayRows","rowArray","convertToArrayRow","objectRows","getBatch","rows","slice","batchType","data","exports"],"sources":["../../../../src/lib/batches/row-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\n// import type {ArrayRowTableBatch, ObjectRowTableBatch} from '../../category/table';\nimport {convertToArrayRow, convertToObjectRow} from '../utils/row-utils';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n objectRows: {[columnName: string]: any} | null = null;\n arrayRows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n // eslint-disable-next-line default-case\n switch (this.options.shape) {\n case 'object-row-table':\n const rowObject = convertToObjectRow(row, this._headers);\n this.addObjectRow(rowObject, cursor);\n break;\n case 'array-row-table':\n this.arrayRows = this.arrayRows || new Array(DEFAULT_ROW_COUNT);\n this.arrayRows[this.length] = row;\n this.length++;\n break;\n }\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n // eslint-disable-next-line default-case\n switch (this.options.shape) {\n case 'array-row-table':\n const rowArray = convertToArrayRow(row, this._headers);\n this.addArrayRow(rowArray, cursor);\n break;\n case 'object-row-table':\n this.objectRows = this.objectRows || new Array(DEFAULT_ROW_COUNT);\n this.objectRows[this.length] = row;\n this.length++;\n break;\n }\n }\n\n getBatch(): TableBatch | null {\n let rows = this.arrayRows || this.objectRows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.arrayRows = null;\n this.objectRows = null;\n\n return {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAMC,iBAAiB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I;MACrB,IAAI,CAACG,UAAU,GAAG,IAAI;MAEtB,OAAO;QACLP,KAAK,EAAE,IAAI,CAACnB,OAAO,CAACmB,KAAK;QACzBW,SAAS,EAAE,MAAM;QACjBC,IAAI,EAAEH,IAAI;QACVf,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBd,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBiB,MAAM,EAAE,IAAI,CAACA;MACf,CAAC;IACH;EAAC;EAAA,OAAAlB,uBAAA;AAAA;AAAAkC,OAAA,CAAA9B,OAAA,GAAAJ,uBAAA"}
|
|
@@ -21,7 +21,6 @@ var DEFAULT_OPTIONS = {
|
|
|
21
21
|
_limitMB: 0
|
|
22
22
|
};
|
|
23
23
|
var ERR_MESSAGE = 'TableBatchBuilder';
|
|
24
|
-
|
|
25
24
|
var TableBatchBuilder = function () {
|
|
26
25
|
function TableBatchBuilder(schema, options) {
|
|
27
26
|
(0, _classCallCheck2.default)(this, TableBatchBuilder);
|
|
@@ -50,11 +49,9 @@ var TableBatchBuilder = function () {
|
|
|
50
49
|
}
|
|
51
50
|
return false;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
}, {
|
|
55
53
|
key: "addRow",
|
|
56
|
-
value:
|
|
57
|
-
function addRow(row) {
|
|
54
|
+
value: function addRow(row) {
|
|
58
55
|
if (this.limitReached()) {
|
|
59
56
|
return;
|
|
60
57
|
}
|
|
@@ -67,33 +64,27 @@ var TableBatchBuilder = function () {
|
|
|
67
64
|
this.addObjectRow(row);
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
|
|
71
67
|
}, {
|
|
72
68
|
key: "addArrayRow",
|
|
73
|
-
value:
|
|
74
|
-
function addArrayRow(row) {
|
|
69
|
+
value: function addArrayRow(row) {
|
|
75
70
|
if (!this.aggregator) {
|
|
76
71
|
var TableBatchType = this._getTableBatchType();
|
|
77
72
|
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
78
73
|
}
|
|
79
74
|
this.aggregator.addArrayRow(row);
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
}, {
|
|
83
77
|
key: "addObjectRow",
|
|
84
|
-
value:
|
|
85
|
-
function addObjectRow(row) {
|
|
78
|
+
value: function addObjectRow(row) {
|
|
86
79
|
if (!this.aggregator) {
|
|
87
80
|
var TableBatchType = this._getTableBatchType();
|
|
88
81
|
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
89
82
|
}
|
|
90
83
|
this.aggregator.addObjectRow(row);
|
|
91
84
|
}
|
|
92
|
-
|
|
93
85
|
}, {
|
|
94
86
|
key: "chunkComplete",
|
|
95
|
-
value:
|
|
96
|
-
function chunkComplete(chunk) {
|
|
87
|
+
value: function chunkComplete(chunk) {
|
|
97
88
|
if (chunk instanceof ArrayBuffer) {
|
|
98
89
|
this.bytesUsed += chunk.byteLength;
|
|
99
90
|
}
|
|
@@ -112,12 +103,9 @@ var TableBatchBuilder = function () {
|
|
|
112
103
|
value: function getFinalBatch(options) {
|
|
113
104
|
return this._getBatch(options);
|
|
114
105
|
}
|
|
115
|
-
|
|
116
106
|
}, {
|
|
117
107
|
key: "_estimateRowMB",
|
|
118
|
-
value:
|
|
119
|
-
|
|
120
|
-
function _estimateRowMB(row) {
|
|
108
|
+
value: function _estimateRowMB(row) {
|
|
121
109
|
return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
|
|
122
110
|
}
|
|
123
111
|
}, {
|
|
@@ -126,7 +114,6 @@ var TableBatchBuilder = function () {
|
|
|
126
114
|
if (!this.aggregator || this.aggregator.rowCount() === 0) {
|
|
127
115
|
return false;
|
|
128
116
|
}
|
|
129
|
-
|
|
130
117
|
if (this.options.batchSize === 'auto') {
|
|
131
118
|
if (!this.isChunkComplete) {
|
|
132
119
|
return false;
|
|
@@ -134,24 +121,19 @@ var TableBatchBuilder = function () {
|
|
|
134
121
|
} else if (this.options.batchSize > this.aggregator.rowCount()) {
|
|
135
122
|
return false;
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
if (this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs) {
|
|
139
125
|
return false;
|
|
140
126
|
}
|
|
141
|
-
|
|
142
127
|
this.isChunkComplete = false;
|
|
143
128
|
this.lastBatchEmittedMs = Date.now();
|
|
144
129
|
return true;
|
|
145
130
|
}
|
|
146
|
-
|
|
147
131
|
}, {
|
|
148
132
|
key: "_getBatch",
|
|
149
|
-
value:
|
|
150
|
-
function _getBatch(options) {
|
|
133
|
+
value: function _getBatch(options) {
|
|
151
134
|
if (!this.aggregator) {
|
|
152
135
|
return null;
|
|
153
136
|
}
|
|
154
|
-
|
|
155
137
|
if (options !== null && options !== void 0 && options.bytesUsed) {
|
|
156
138
|
this.bytesUsed = options.bytesUsed;
|
|
157
139
|
}
|