@loaders.gl/services 5.0.0-alpha.3 → 5.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts +2 -2
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-image-server-source-loader.js.map +1 -1
- package/dist/index.cjs +219 -156
- package/dist/index.cjs.map +3 -3
- package/package.json +9 -9
- package/src/arcgis/arcgis-image-server-source-loader.ts +2 -1
package/dist/index.cjs
CHANGED
|
@@ -738,7 +738,7 @@ function writeCoordinate(writer, coordinate, options) {
|
|
|
738
738
|
writer.writeDoubleLE(coordinate[2]);
|
|
739
739
|
}
|
|
740
740
|
if (options.hasM) {
|
|
741
|
-
writer.writeDoubleLE(coordinate[3]);
|
|
741
|
+
writer.writeDoubleLE(coordinate[options.hasZ ? 3 : 2]);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
function getPointSize(options) {
|
|
@@ -858,7 +858,10 @@ function encodeGeometryCollection(collection, options) {
|
|
|
858
858
|
writeWkbType(writer, 7 /* GeometryCollection */, options);
|
|
859
859
|
writer.writeUInt32LE(collection.geometries.length);
|
|
860
860
|
for (const geometry of collection.geometries) {
|
|
861
|
-
const arrayBuffer = convertGeometryToWKB(
|
|
861
|
+
const arrayBuffer = convertGeometryToWKB(
|
|
862
|
+
geometry,
|
|
863
|
+
getGeometryCollectionChildOptions(geometry, options)
|
|
864
|
+
);
|
|
862
865
|
writer.writeBuffer(arrayBuffer);
|
|
863
866
|
}
|
|
864
867
|
return writer.arrayBuffer;
|
|
@@ -866,10 +869,18 @@ function encodeGeometryCollection(collection, options) {
|
|
|
866
869
|
function getGeometryCollectionSize(collection, options) {
|
|
867
870
|
let size = 1 + 4 + 4;
|
|
868
871
|
for (const geometry of collection.geometries) {
|
|
869
|
-
size += getGeometrySize(geometry, options);
|
|
872
|
+
size += getGeometrySize(geometry, getGeometryCollectionChildOptions(geometry, options));
|
|
870
873
|
}
|
|
871
874
|
return size;
|
|
872
875
|
}
|
|
876
|
+
function getGeometryCollectionChildOptions(geometry, parentOptions) {
|
|
877
|
+
const dimension = geometry.__geoarrowDimension;
|
|
878
|
+
if (!dimension) return parentOptions;
|
|
879
|
+
return {
|
|
880
|
+
hasZ: dimension === "xyz" || dimension === "xyzm",
|
|
881
|
+
hasM: dimension === "xym" || dimension === "xyzm"
|
|
882
|
+
};
|
|
883
|
+
}
|
|
873
884
|
function writeWkbType(writer, geometryType, options) {
|
|
874
885
|
const { hasZ, hasM, srid } = options;
|
|
875
886
|
let dimensionType = 0;
|
|
@@ -908,7 +919,7 @@ var init_convert_geometry_to_wkb = __esm({
|
|
|
908
919
|
}
|
|
909
920
|
});
|
|
910
921
|
|
|
911
|
-
// ../
|
|
922
|
+
// ../schema/src/metadata.ts
|
|
912
923
|
function getMetadataValue(metadata, key) {
|
|
913
924
|
return metadata instanceof Map ? metadata.get(key) || null : metadata[key] || null;
|
|
914
925
|
}
|
|
@@ -919,19 +930,60 @@ function setMetadataValue(metadata, key, value) {
|
|
|
919
930
|
metadata[key] = value;
|
|
920
931
|
}
|
|
921
932
|
}
|
|
933
|
+
var init_metadata = __esm({
|
|
934
|
+
"../schema/src/metadata.ts"() {
|
|
935
|
+
"use strict";
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
// ../schema/src/categories/category-mesh.ts
|
|
940
|
+
var arrow, meshArrowSchema, indexedMeshArrowSchema;
|
|
941
|
+
var init_category_mesh = __esm({
|
|
942
|
+
"../schema/src/categories/category-mesh.ts"() {
|
|
943
|
+
"use strict";
|
|
944
|
+
arrow = __toESM(require("apache-arrow"), 1);
|
|
945
|
+
meshArrowSchema = new arrow.Schema([
|
|
946
|
+
new arrow.Field(
|
|
947
|
+
"POSITION",
|
|
948
|
+
new arrow.FixedSizeList(3, new arrow.Field("value", new arrow.Float32(), false)),
|
|
949
|
+
false
|
|
950
|
+
)
|
|
951
|
+
]);
|
|
952
|
+
indexedMeshArrowSchema = new arrow.Schema([
|
|
953
|
+
...meshArrowSchema.fields,
|
|
954
|
+
new arrow.Field(
|
|
955
|
+
"indices",
|
|
956
|
+
new arrow.List(new arrow.Field("item", new arrow.Int32(), false)),
|
|
957
|
+
true
|
|
958
|
+
)
|
|
959
|
+
]);
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
// ../schema/src/index.ts
|
|
964
|
+
var init_src = __esm({
|
|
965
|
+
"../schema/src/index.ts"() {
|
|
966
|
+
"use strict";
|
|
967
|
+
init_metadata();
|
|
968
|
+
init_category_mesh();
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
// ../gis/src/lib/geoarrow/metadata-utils.ts
|
|
922
973
|
var init_metadata_utils = __esm({
|
|
923
974
|
"../gis/src/lib/geoarrow/metadata-utils.ts"() {
|
|
924
975
|
"use strict";
|
|
976
|
+
init_src();
|
|
925
977
|
}
|
|
926
978
|
});
|
|
927
979
|
|
|
928
980
|
// ../gis/src/lib/geoarrow/geoparquet-metadata.ts
|
|
929
|
-
function
|
|
981
|
+
function getGeoMetadata2(metadata) {
|
|
930
982
|
if (!metadata) {
|
|
931
983
|
return null;
|
|
932
984
|
}
|
|
933
985
|
const stringifiedGeoMetadata = getMetadataValue(metadata, "geo");
|
|
934
|
-
const geoMetadata = stringifiedGeoMetadata &&
|
|
986
|
+
const geoMetadata = stringifiedGeoMetadata && parseJSONStringMetadata2(stringifiedGeoMetadata);
|
|
935
987
|
if (!geoMetadata) {
|
|
936
988
|
return null;
|
|
937
989
|
}
|
|
@@ -942,10 +994,10 @@ function getGeoMetadata(metadata) {
|
|
|
942
994
|
}
|
|
943
995
|
return geoMetadata;
|
|
944
996
|
}
|
|
945
|
-
function
|
|
997
|
+
function setGeoMetadata2(metadata, geoMetadata) {
|
|
946
998
|
setMetadataValue(metadata, "geo", JSON.stringify(geoMetadata));
|
|
947
999
|
}
|
|
948
|
-
function
|
|
1000
|
+
function parseJSONStringMetadata2(stringifiedMetadata) {
|
|
949
1001
|
if (!stringifiedMetadata) {
|
|
950
1002
|
return null;
|
|
951
1003
|
}
|
|
@@ -981,7 +1033,7 @@ function setWKBGeometryColumnMetadata(metadata, options = {}) {
|
|
|
981
1033
|
const geometryColumnName = options.geometryColumnName || "geometry";
|
|
982
1034
|
const primaryColumnName = options.primaryColumnName || geometryColumnName;
|
|
983
1035
|
const geometryTypes = options.geometryTypes || [];
|
|
984
|
-
const nextGeoMetadata =
|
|
1036
|
+
const nextGeoMetadata = getGeoMetadata2(metadata) || { columns: {} };
|
|
985
1037
|
nextGeoMetadata.version = options.version || nextGeoMetadata.version || DEFAULT_GEO_METADATA_VERSION;
|
|
986
1038
|
nextGeoMetadata.primary_column = primaryColumnName;
|
|
987
1039
|
nextGeoMetadata.columns ||= {};
|
|
@@ -991,7 +1043,7 @@ function setWKBGeometryColumnMetadata(metadata, options = {}) {
|
|
|
991
1043
|
encoding: "wkb",
|
|
992
1044
|
geometry_types: geometryTypes
|
|
993
1045
|
};
|
|
994
|
-
|
|
1046
|
+
setGeoMetadata2(metadata, nextGeoMetadata);
|
|
995
1047
|
}
|
|
996
1048
|
function setWKBGeometrySchemaMetadata(schema, options = {}) {
|
|
997
1049
|
schema.metadata ||= {};
|
|
@@ -1016,25 +1068,42 @@ function encodeWKBGeometryValue(value) {
|
|
|
1016
1068
|
throw new Error("Expected a Geometry, ArrayBuffer, ArrayBufferView, or null for WKB encoding.");
|
|
1017
1069
|
}
|
|
1018
1070
|
function getGeometryWKBOptions(geometry) {
|
|
1019
|
-
const
|
|
1071
|
+
const dimension = getGeometryDimension(geometry);
|
|
1020
1072
|
return {
|
|
1021
|
-
hasZ:
|
|
1022
|
-
hasM:
|
|
1073
|
+
hasZ: dimension === "xyz" || dimension === "xyzm",
|
|
1074
|
+
hasM: dimension === "xym" || dimension === "xyzm"
|
|
1023
1075
|
};
|
|
1024
1076
|
}
|
|
1077
|
+
function getGeometryDimension(geometry) {
|
|
1078
|
+
const declaredDimension = geometry.__geoarrowDimension;
|
|
1079
|
+
if (declaredDimension) return declaredDimension;
|
|
1080
|
+
if ("geometries" in geometry) {
|
|
1081
|
+
let hasZ = false;
|
|
1082
|
+
let hasM = false;
|
|
1083
|
+
for (const child of geometry.geometries) {
|
|
1084
|
+
const childDimension = getGeometryDimension(child);
|
|
1085
|
+
hasZ ||= childDimension === "xyz" || childDimension === "xyzm";
|
|
1086
|
+
hasM ||= childDimension === "xym" || childDimension === "xyzm";
|
|
1087
|
+
}
|
|
1088
|
+
return hasZ && hasM ? "xyzm" : hasZ ? "xyz" : hasM ? "xym" : "xy";
|
|
1089
|
+
}
|
|
1090
|
+
const dimensions = getCoordinateDimensions(getGeometrySampleCoordinates(geometry));
|
|
1091
|
+
return dimensions > 3 ? "xyzm" : dimensions > 2 ? "xyz" : "xy";
|
|
1092
|
+
}
|
|
1025
1093
|
function inferGeoParquetGeometryTypes(geometries) {
|
|
1026
1094
|
const geometryTypes = /* @__PURE__ */ new Set();
|
|
1027
1095
|
for (const geometry of geometries) {
|
|
1028
1096
|
if (!geometry) {
|
|
1029
1097
|
continue;
|
|
1030
1098
|
}
|
|
1031
|
-
const
|
|
1032
|
-
geometryTypes.add(
|
|
1033
|
-
dimensions > 2 ? `${geometry.type} Z` : geometry.type
|
|
1034
|
-
);
|
|
1099
|
+
const dimension = getGeometryDimension(geometry);
|
|
1100
|
+
geometryTypes.add(`${geometry.type}${getDimensionSuffix(dimension)}`);
|
|
1035
1101
|
}
|
|
1036
1102
|
return [...geometryTypes];
|
|
1037
1103
|
}
|
|
1104
|
+
function getDimensionSuffix(dimension) {
|
|
1105
|
+
return dimension === "xy" ? "" : ` ${dimension === "xyzm" ? "ZM" : dimension.slice(2).toUpperCase()}`;
|
|
1106
|
+
}
|
|
1038
1107
|
function getCoordinateDimensions(coordinates) {
|
|
1039
1108
|
if (!Array.isArray(coordinates)) {
|
|
1040
1109
|
return 2;
|
|
@@ -1145,7 +1214,7 @@ function serializeArrowSchema(arrowSchema) {
|
|
|
1145
1214
|
};
|
|
1146
1215
|
}
|
|
1147
1216
|
function deserializeArrowSchema(schema, options) {
|
|
1148
|
-
return new
|
|
1217
|
+
return new arrow2.Schema(
|
|
1149
1218
|
schema.fields.map((field) => deserializeArrowField(field, options)),
|
|
1150
1219
|
deserializeArrowMetadata(schema.metadata)
|
|
1151
1220
|
);
|
|
@@ -1165,7 +1234,7 @@ function serializeArrowField(field) {
|
|
|
1165
1234
|
};
|
|
1166
1235
|
}
|
|
1167
1236
|
function deserializeArrowField(field, options) {
|
|
1168
|
-
return new
|
|
1237
|
+
return new arrow2.Field(
|
|
1169
1238
|
field.name,
|
|
1170
1239
|
deserializeArrowType(field.type, options),
|
|
1171
1240
|
field.nullable,
|
|
@@ -1180,57 +1249,57 @@ function serializeArrowType(arrowType) {
|
|
|
1180
1249
|
return "utf8-view";
|
|
1181
1250
|
}
|
|
1182
1251
|
switch (arrowType.constructor) {
|
|
1183
|
-
case
|
|
1252
|
+
case arrow2.Null:
|
|
1184
1253
|
return "null";
|
|
1185
|
-
case
|
|
1254
|
+
case arrow2.Binary:
|
|
1186
1255
|
return "binary";
|
|
1187
|
-
case
|
|
1256
|
+
case arrow2.FixedSizeBinary:
|
|
1188
1257
|
return {
|
|
1189
1258
|
type: "fixed-size-binary",
|
|
1190
1259
|
byteWidth: arrowType.byteWidth
|
|
1191
1260
|
};
|
|
1192
|
-
case
|
|
1261
|
+
case arrow2.Bool:
|
|
1193
1262
|
return "bool";
|
|
1194
|
-
case
|
|
1263
|
+
case arrow2.Int:
|
|
1195
1264
|
const intType = arrowType;
|
|
1196
1265
|
return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
|
|
1197
|
-
case
|
|
1266
|
+
case arrow2.Int8:
|
|
1198
1267
|
return "int8";
|
|
1199
|
-
case
|
|
1268
|
+
case arrow2.Int16:
|
|
1200
1269
|
return "int16";
|
|
1201
|
-
case
|
|
1270
|
+
case arrow2.Int32:
|
|
1202
1271
|
return "int32";
|
|
1203
|
-
case
|
|
1272
|
+
case arrow2.Int64:
|
|
1204
1273
|
return "int64";
|
|
1205
|
-
case
|
|
1274
|
+
case arrow2.Uint8:
|
|
1206
1275
|
return "uint8";
|
|
1207
|
-
case
|
|
1276
|
+
case arrow2.Uint16:
|
|
1208
1277
|
return "uint16";
|
|
1209
|
-
case
|
|
1278
|
+
case arrow2.Uint32:
|
|
1210
1279
|
return "uint32";
|
|
1211
|
-
case
|
|
1280
|
+
case arrow2.Uint64:
|
|
1212
1281
|
return "uint64";
|
|
1213
|
-
case
|
|
1282
|
+
case arrow2.Float:
|
|
1214
1283
|
const precision = arrowType.precision;
|
|
1215
1284
|
switch (precision) {
|
|
1216
|
-
case
|
|
1285
|
+
case arrow2.Precision.HALF:
|
|
1217
1286
|
return "float16";
|
|
1218
|
-
case
|
|
1287
|
+
case arrow2.Precision.SINGLE:
|
|
1219
1288
|
return "float32";
|
|
1220
|
-
case
|
|
1289
|
+
case arrow2.Precision.DOUBLE:
|
|
1221
1290
|
return "float64";
|
|
1222
1291
|
default:
|
|
1223
1292
|
return "float16";
|
|
1224
1293
|
}
|
|
1225
|
-
case
|
|
1294
|
+
case arrow2.Float16:
|
|
1226
1295
|
return "float16";
|
|
1227
|
-
case
|
|
1296
|
+
case arrow2.Float32:
|
|
1228
1297
|
return "float32";
|
|
1229
|
-
case
|
|
1298
|
+
case arrow2.Float64:
|
|
1230
1299
|
return "float64";
|
|
1231
|
-
case
|
|
1300
|
+
case arrow2.Utf8:
|
|
1232
1301
|
return "utf8";
|
|
1233
|
-
case
|
|
1302
|
+
case arrow2.Decimal:
|
|
1234
1303
|
const decimal = arrowType;
|
|
1235
1304
|
return {
|
|
1236
1305
|
type: "decimal",
|
|
@@ -1238,99 +1307,114 @@ function serializeArrowType(arrowType) {
|
|
|
1238
1307
|
precision: decimal.precision,
|
|
1239
1308
|
scale: decimal.scale
|
|
1240
1309
|
};
|
|
1241
|
-
case
|
|
1310
|
+
case arrow2.Date_:
|
|
1242
1311
|
const dateUnit = arrowType.unit;
|
|
1243
|
-
return dateUnit ===
|
|
1244
|
-
case
|
|
1312
|
+
return dateUnit === arrow2.DateUnit.DAY ? "date-day" : "date-millisecond";
|
|
1313
|
+
case arrow2.DateDay:
|
|
1245
1314
|
return "date-day";
|
|
1246
|
-
case
|
|
1315
|
+
case arrow2.DateMillisecond:
|
|
1247
1316
|
return "date-millisecond";
|
|
1248
|
-
case
|
|
1317
|
+
case arrow2.Time:
|
|
1249
1318
|
const timeUnit = arrowType.unit;
|
|
1250
1319
|
switch (timeUnit) {
|
|
1251
|
-
case
|
|
1320
|
+
case arrow2.TimeUnit.SECOND:
|
|
1252
1321
|
return "time-second";
|
|
1253
|
-
case
|
|
1322
|
+
case arrow2.TimeUnit.MILLISECOND:
|
|
1254
1323
|
return "time-millisecond";
|
|
1255
|
-
case
|
|
1324
|
+
case arrow2.TimeUnit.MICROSECOND:
|
|
1256
1325
|
return "time-microsecond";
|
|
1257
|
-
case
|
|
1326
|
+
case arrow2.TimeUnit.NANOSECOND:
|
|
1258
1327
|
return "time-nanosecond";
|
|
1259
1328
|
default:
|
|
1260
1329
|
return "time-second";
|
|
1261
1330
|
}
|
|
1262
|
-
case
|
|
1331
|
+
case arrow2.TimeMillisecond:
|
|
1263
1332
|
return "time-millisecond";
|
|
1264
|
-
case
|
|
1333
|
+
case arrow2.TimeSecond:
|
|
1265
1334
|
return "time-second";
|
|
1266
|
-
case
|
|
1335
|
+
case arrow2.TimeMicrosecond:
|
|
1267
1336
|
return "time-microsecond";
|
|
1268
|
-
case
|
|
1337
|
+
case arrow2.TimeNanosecond:
|
|
1269
1338
|
return "time-nanosecond";
|
|
1270
|
-
case
|
|
1339
|
+
case arrow2.Timestamp:
|
|
1271
1340
|
const timeStampUnit = arrowType.unit;
|
|
1272
1341
|
switch (timeStampUnit) {
|
|
1273
|
-
case
|
|
1342
|
+
case arrow2.TimeUnit.SECOND:
|
|
1274
1343
|
return "timestamp-second";
|
|
1275
|
-
case
|
|
1344
|
+
case arrow2.TimeUnit.MILLISECOND:
|
|
1276
1345
|
return "timestamp-millisecond";
|
|
1277
|
-
case
|
|
1346
|
+
case arrow2.TimeUnit.MICROSECOND:
|
|
1278
1347
|
return "timestamp-microsecond";
|
|
1279
|
-
case
|
|
1348
|
+
case arrow2.TimeUnit.NANOSECOND:
|
|
1280
1349
|
return "timestamp-nanosecond";
|
|
1281
1350
|
default:
|
|
1282
1351
|
return "timestamp-second";
|
|
1283
1352
|
}
|
|
1284
|
-
case
|
|
1353
|
+
case arrow2.TimestampSecond:
|
|
1285
1354
|
return "timestamp-second";
|
|
1286
|
-
case
|
|
1355
|
+
case arrow2.TimestampMillisecond:
|
|
1287
1356
|
return "timestamp-millisecond";
|
|
1288
|
-
case
|
|
1357
|
+
case arrow2.TimestampMicrosecond:
|
|
1289
1358
|
return "timestamp-microsecond";
|
|
1290
|
-
case
|
|
1359
|
+
case arrow2.TimestampNanosecond:
|
|
1291
1360
|
return "timestamp-nanosecond";
|
|
1292
|
-
case
|
|
1361
|
+
case arrow2.Interval:
|
|
1293
1362
|
const intervalUnit = arrowType.unit;
|
|
1294
1363
|
switch (intervalUnit) {
|
|
1295
|
-
case
|
|
1364
|
+
case arrow2.IntervalUnit.DAY_TIME:
|
|
1296
1365
|
return "interval-daytime";
|
|
1297
|
-
case
|
|
1366
|
+
case arrow2.IntervalUnit.YEAR_MONTH:
|
|
1298
1367
|
return "interval-yearmonth";
|
|
1299
1368
|
default:
|
|
1300
1369
|
return "interval-daytime";
|
|
1301
1370
|
}
|
|
1302
|
-
case
|
|
1371
|
+
case arrow2.IntervalDayTime:
|
|
1303
1372
|
return "interval-daytime";
|
|
1304
|
-
case
|
|
1373
|
+
case arrow2.IntervalYearMonth:
|
|
1305
1374
|
return "interval-yearmonth";
|
|
1306
|
-
case
|
|
1375
|
+
case arrow2.Map_:
|
|
1307
1376
|
const mapType = arrowType;
|
|
1308
1377
|
return {
|
|
1309
1378
|
type: "map",
|
|
1310
1379
|
keysSorted: mapType.keysSorted,
|
|
1311
1380
|
children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
1312
1381
|
};
|
|
1313
|
-
case
|
|
1382
|
+
case arrow2.List:
|
|
1314
1383
|
const listType = arrowType;
|
|
1315
1384
|
const listField = listType.valueField;
|
|
1316
1385
|
return {
|
|
1317
1386
|
type: "list",
|
|
1318
1387
|
children: [serializeArrowField(listField)]
|
|
1319
1388
|
};
|
|
1320
|
-
case
|
|
1389
|
+
case arrow2.LargeList:
|
|
1390
|
+
const largeListType = arrowType;
|
|
1391
|
+
return {
|
|
1392
|
+
type: "large-list",
|
|
1393
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
1394
|
+
};
|
|
1395
|
+
case arrow2.FixedSizeList:
|
|
1321
1396
|
const fixedSizeList = arrowType;
|
|
1322
1397
|
return {
|
|
1323
1398
|
type: "fixed-size-list",
|
|
1324
1399
|
listSize: fixedSizeList.listSize,
|
|
1325
1400
|
children: [serializeArrowField(fixedSizeList.children[0])]
|
|
1326
1401
|
};
|
|
1327
|
-
case
|
|
1402
|
+
case arrow2.Struct:
|
|
1328
1403
|
const structType = arrowType;
|
|
1329
1404
|
return {
|
|
1330
1405
|
type: "struct",
|
|
1331
1406
|
children: structType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
1332
1407
|
};
|
|
1333
|
-
case
|
|
1408
|
+
case arrow2.SparseUnion:
|
|
1409
|
+
case arrow2.DenseUnion:
|
|
1410
|
+
const unionType = arrowType;
|
|
1411
|
+
return {
|
|
1412
|
+
type: unionType instanceof arrow2.DenseUnion ? "dense-union" : "sparse-union",
|
|
1413
|
+
typeIds: unionType.typeIds,
|
|
1414
|
+
children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
|
|
1415
|
+
typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
|
|
1416
|
+
};
|
|
1417
|
+
case arrow2.Dictionary:
|
|
1334
1418
|
const dictionaryType = arrowType;
|
|
1335
1419
|
return {
|
|
1336
1420
|
type: "dictionary",
|
|
@@ -1347,31 +1431,42 @@ function deserializeArrowType(dataType, options) {
|
|
|
1347
1431
|
if (typeof dataType === "object") {
|
|
1348
1432
|
switch (dataType.type) {
|
|
1349
1433
|
case "decimal":
|
|
1350
|
-
return new
|
|
1434
|
+
return new arrow2.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
|
|
1351
1435
|
case "map": {
|
|
1352
1436
|
const children = dataType.children.map(
|
|
1353
1437
|
(arrowField) => deserializeArrowField(arrowField, options)
|
|
1354
1438
|
);
|
|
1355
|
-
return new
|
|
1439
|
+
return new arrow2.Map_(children[0], dataType.keysSorted);
|
|
1356
1440
|
}
|
|
1357
1441
|
case "list": {
|
|
1358
1442
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
1359
|
-
return new
|
|
1443
|
+
return new arrow2.List(field);
|
|
1444
|
+
}
|
|
1445
|
+
case "large-list": {
|
|
1446
|
+
const field = deserializeArrowField(dataType.children[0], options);
|
|
1447
|
+
return new arrow2.LargeList(field);
|
|
1360
1448
|
}
|
|
1361
1449
|
case "fixed-size-list": {
|
|
1362
1450
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
1363
|
-
return new
|
|
1451
|
+
return new arrow2.FixedSizeList(dataType.listSize, child);
|
|
1364
1452
|
}
|
|
1365
1453
|
case "fixed-size-binary":
|
|
1366
|
-
return new
|
|
1454
|
+
return new arrow2.FixedSizeBinary(dataType.byteWidth);
|
|
1367
1455
|
case "struct": {
|
|
1368
1456
|
const children = dataType.children.map(
|
|
1369
1457
|
(arrowField) => deserializeArrowField(arrowField, options)
|
|
1370
1458
|
);
|
|
1371
|
-
return new
|
|
1459
|
+
return new arrow2.Struct(children);
|
|
1460
|
+
}
|
|
1461
|
+
case "sparse-union":
|
|
1462
|
+
case "dense-union": {
|
|
1463
|
+
const children = dataType.children.map(
|
|
1464
|
+
(arrowField) => deserializeArrowField(arrowField, options)
|
|
1465
|
+
);
|
|
1466
|
+
return dataType.type === "dense-union" ? new arrow2.DenseUnion(dataType.typeIds, children) : new arrow2.SparseUnion(dataType.typeIds, children);
|
|
1372
1467
|
}
|
|
1373
1468
|
case "dictionary": {
|
|
1374
|
-
return new
|
|
1469
|
+
return new arrow2.Dictionary(
|
|
1375
1470
|
deserializeArrowType(dataType.dictionary, options),
|
|
1376
1471
|
deserializeArrowDictionaryKeyType(dataType.indices),
|
|
1377
1472
|
dataType.id,
|
|
@@ -1384,76 +1479,76 @@ function deserializeArrowType(dataType, options) {
|
|
|
1384
1479
|
}
|
|
1385
1480
|
switch (dataType) {
|
|
1386
1481
|
case "null":
|
|
1387
|
-
return new
|
|
1482
|
+
return new arrow2.Null();
|
|
1388
1483
|
case "binary":
|
|
1389
|
-
return makeVariableWidthArrowType("BinaryView", new
|
|
1484
|
+
return makeVariableWidthArrowType("BinaryView", new arrow2.Binary(), options);
|
|
1390
1485
|
case "binary-view":
|
|
1391
1486
|
return makeRequiredArrowViewType("BinaryView");
|
|
1392
1487
|
case "bool":
|
|
1393
|
-
return new
|
|
1488
|
+
return new arrow2.Bool();
|
|
1394
1489
|
case "int8":
|
|
1395
|
-
return new
|
|
1490
|
+
return new arrow2.Int8();
|
|
1396
1491
|
case "int16":
|
|
1397
|
-
return new
|
|
1492
|
+
return new arrow2.Int16();
|
|
1398
1493
|
case "int32":
|
|
1399
|
-
return new
|
|
1494
|
+
return new arrow2.Int32();
|
|
1400
1495
|
case "int64":
|
|
1401
|
-
return new
|
|
1496
|
+
return new arrow2.Int64();
|
|
1402
1497
|
case "uint8":
|
|
1403
|
-
return new
|
|
1498
|
+
return new arrow2.Uint8();
|
|
1404
1499
|
case "uint16":
|
|
1405
|
-
return new
|
|
1500
|
+
return new arrow2.Uint16();
|
|
1406
1501
|
case "uint32":
|
|
1407
|
-
return new
|
|
1502
|
+
return new arrow2.Uint32();
|
|
1408
1503
|
case "uint64":
|
|
1409
|
-
return new
|
|
1504
|
+
return new arrow2.Uint64();
|
|
1410
1505
|
case "float16":
|
|
1411
|
-
return new
|
|
1506
|
+
return new arrow2.Float16();
|
|
1412
1507
|
case "float32":
|
|
1413
|
-
return new
|
|
1508
|
+
return new arrow2.Float32();
|
|
1414
1509
|
case "float64":
|
|
1415
|
-
return new
|
|
1510
|
+
return new arrow2.Float64();
|
|
1416
1511
|
case "utf8":
|
|
1417
|
-
return makeVariableWidthArrowType("Utf8View", new
|
|
1512
|
+
return makeVariableWidthArrowType("Utf8View", new arrow2.Utf8(), options);
|
|
1418
1513
|
case "utf8-view":
|
|
1419
1514
|
return makeRequiredArrowViewType("Utf8View");
|
|
1420
1515
|
case "date-day":
|
|
1421
|
-
return new
|
|
1516
|
+
return new arrow2.DateDay();
|
|
1422
1517
|
case "date-millisecond":
|
|
1423
|
-
return new
|
|
1518
|
+
return new arrow2.DateMillisecond();
|
|
1424
1519
|
case "time-second":
|
|
1425
|
-
return new
|
|
1520
|
+
return new arrow2.TimeSecond();
|
|
1426
1521
|
case "time-millisecond":
|
|
1427
|
-
return new
|
|
1522
|
+
return new arrow2.TimeMillisecond();
|
|
1428
1523
|
case "time-microsecond":
|
|
1429
|
-
return new
|
|
1524
|
+
return new arrow2.TimeMicrosecond();
|
|
1430
1525
|
case "time-nanosecond":
|
|
1431
|
-
return new
|
|
1526
|
+
return new arrow2.TimeNanosecond();
|
|
1432
1527
|
case "timestamp-second":
|
|
1433
|
-
return new
|
|
1528
|
+
return new arrow2.TimestampSecond();
|
|
1434
1529
|
case "timestamp-millisecond":
|
|
1435
|
-
return new
|
|
1530
|
+
return new arrow2.TimestampMillisecond();
|
|
1436
1531
|
case "timestamp-microsecond":
|
|
1437
|
-
return new
|
|
1532
|
+
return new arrow2.TimestampMicrosecond();
|
|
1438
1533
|
case "timestamp-nanosecond":
|
|
1439
|
-
return new
|
|
1534
|
+
return new arrow2.TimestampNanosecond();
|
|
1440
1535
|
case "interval-daytime":
|
|
1441
|
-
return new
|
|
1536
|
+
return new arrow2.IntervalDayTime();
|
|
1442
1537
|
case "interval-yearmonth":
|
|
1443
|
-
return new
|
|
1538
|
+
return new arrow2.IntervalYearMonth();
|
|
1444
1539
|
default:
|
|
1445
1540
|
throw new Error("array type not supported");
|
|
1446
1541
|
}
|
|
1447
1542
|
}
|
|
1448
1543
|
function getArrowViewConstructors() {
|
|
1449
|
-
return
|
|
1544
|
+
return arrow2;
|
|
1450
1545
|
}
|
|
1451
1546
|
function isArrowViewType(arrowType, viewTypeName) {
|
|
1452
1547
|
const constructor = getArrowViewConstructors()[viewTypeName];
|
|
1453
1548
|
if (constructor && arrowType instanceof constructor) {
|
|
1454
1549
|
return true;
|
|
1455
1550
|
}
|
|
1456
|
-
const guards =
|
|
1551
|
+
const guards = arrow2.DataType;
|
|
1457
1552
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
1458
1553
|
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
1459
1554
|
}
|
|
@@ -1483,7 +1578,7 @@ function makeRequiredArrowViewType(viewTypeName) {
|
|
|
1483
1578
|
return new constructor();
|
|
1484
1579
|
}
|
|
1485
1580
|
function serializeArrowDictionaryKeyType(arrowType) {
|
|
1486
|
-
if (arrowType instanceof
|
|
1581
|
+
if (arrowType instanceof arrow2.Int) {
|
|
1487
1582
|
const prefix = arrowType.isSigned ? "int" : "uint";
|
|
1488
1583
|
const keyType = `${prefix}${arrowType.bitWidth}`;
|
|
1489
1584
|
if (isSchemaDictionaryKeyType(keyType)) {
|
|
@@ -1491,17 +1586,17 @@ function serializeArrowDictionaryKeyType(arrowType) {
|
|
|
1491
1586
|
}
|
|
1492
1587
|
}
|
|
1493
1588
|
switch (arrowType.constructor) {
|
|
1494
|
-
case
|
|
1589
|
+
case arrow2.Int8:
|
|
1495
1590
|
return "int8";
|
|
1496
|
-
case
|
|
1591
|
+
case arrow2.Int16:
|
|
1497
1592
|
return "int16";
|
|
1498
|
-
case
|
|
1593
|
+
case arrow2.Int32:
|
|
1499
1594
|
return "int32";
|
|
1500
|
-
case
|
|
1595
|
+
case arrow2.Uint8:
|
|
1501
1596
|
return "uint8";
|
|
1502
|
-
case
|
|
1597
|
+
case arrow2.Uint16:
|
|
1503
1598
|
return "uint16";
|
|
1504
|
-
case
|
|
1599
|
+
case arrow2.Uint32:
|
|
1505
1600
|
return "uint32";
|
|
1506
1601
|
default:
|
|
1507
1602
|
throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
|
|
@@ -1513,26 +1608,26 @@ function isSchemaDictionaryKeyType(keyType) {
|
|
|
1513
1608
|
function deserializeArrowDictionaryKeyType(keyType) {
|
|
1514
1609
|
switch (keyType) {
|
|
1515
1610
|
case "int8":
|
|
1516
|
-
return new
|
|
1611
|
+
return new arrow2.Int8();
|
|
1517
1612
|
case "int16":
|
|
1518
|
-
return new
|
|
1613
|
+
return new arrow2.Int16();
|
|
1519
1614
|
case "int32":
|
|
1520
|
-
return new
|
|
1615
|
+
return new arrow2.Int32();
|
|
1521
1616
|
case "uint8":
|
|
1522
|
-
return new
|
|
1617
|
+
return new arrow2.Uint8();
|
|
1523
1618
|
case "uint16":
|
|
1524
|
-
return new
|
|
1619
|
+
return new arrow2.Uint16();
|
|
1525
1620
|
case "uint32":
|
|
1526
|
-
return new
|
|
1621
|
+
return new arrow2.Uint32();
|
|
1527
1622
|
default:
|
|
1528
1623
|
throw new Error(`schema dictionary index type not supported: ${keyType}`);
|
|
1529
1624
|
}
|
|
1530
1625
|
}
|
|
1531
|
-
var
|
|
1626
|
+
var arrow2;
|
|
1532
1627
|
var init_convert_arrow_schema = __esm({
|
|
1533
1628
|
"../schema-utils/src/lib/schema/convert-arrow-schema.ts"() {
|
|
1534
1629
|
"use strict";
|
|
1535
|
-
|
|
1630
|
+
arrow2 = __toESM(require("apache-arrow"), 1);
|
|
1536
1631
|
}
|
|
1537
1632
|
});
|
|
1538
1633
|
|
|
@@ -1622,38 +1717,6 @@ var init_mesh_utils = __esm({
|
|
|
1622
1717
|
}
|
|
1623
1718
|
});
|
|
1624
1719
|
|
|
1625
|
-
// ../schema/src/categories/category-mesh.ts
|
|
1626
|
-
var arrow2, meshArrowSchema, indexedMeshArrowSchema;
|
|
1627
|
-
var init_category_mesh = __esm({
|
|
1628
|
-
"../schema/src/categories/category-mesh.ts"() {
|
|
1629
|
-
"use strict";
|
|
1630
|
-
arrow2 = __toESM(require("apache-arrow"), 1);
|
|
1631
|
-
meshArrowSchema = new arrow2.Schema([
|
|
1632
|
-
new arrow2.Field(
|
|
1633
|
-
"POSITION",
|
|
1634
|
-
new arrow2.FixedSizeList(3, new arrow2.Field("value", new arrow2.Float32(), false)),
|
|
1635
|
-
false
|
|
1636
|
-
)
|
|
1637
|
-
]);
|
|
1638
|
-
indexedMeshArrowSchema = new arrow2.Schema([
|
|
1639
|
-
...meshArrowSchema.fields,
|
|
1640
|
-
new arrow2.Field(
|
|
1641
|
-
"indices",
|
|
1642
|
-
new arrow2.List(new arrow2.Field("item", new arrow2.Int32(), false)),
|
|
1643
|
-
true
|
|
1644
|
-
)
|
|
1645
|
-
]);
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
|
-
// ../schema/src/index.ts
|
|
1650
|
-
var init_src = __esm({
|
|
1651
|
-
"../schema/src/index.ts"() {
|
|
1652
|
-
"use strict";
|
|
1653
|
-
init_category_mesh();
|
|
1654
|
-
}
|
|
1655
|
-
});
|
|
1656
|
-
|
|
1657
1720
|
// ../schema-utils/src/lib/arrow-utils/arrow-fixed-size-list-utils.ts
|
|
1658
1721
|
function getFixedSizeListVector(typedArray, stride) {
|
|
1659
1722
|
const data = getFixedSizeListData(typedArray, stride);
|