@query-farm/vgi 0.33.0 → 0.34.0

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/index.js CHANGED
@@ -949,6 +949,8 @@ function writeCanonicalColumn(type, canonical) {
949
949
  function buildColumnData(values, type) {
950
950
  if (DataType2.isList(type))
951
951
  return buildListData(values, type);
952
+ if (DataType2.isFixedSizeList(type))
953
+ return buildFixedSizeListData(values, type);
952
954
  if (DataType2.isMap(type))
953
955
  return buildMapData(values, type);
954
956
  if (DataType2.isStruct(type))
@@ -1096,6 +1098,38 @@ function buildListData(values, listType) {
1096
1098
  valueOffsets: offsets
1097
1099
  });
1098
1100
  }
1101
+ function buildFixedSizeListData(values, type) {
1102
+ const childField = type.children[0];
1103
+ const listSize = type.listSize;
1104
+ const numRows = values.length;
1105
+ const allItems = [];
1106
+ const nullBitmap = new Uint8Array(Math.ceil(numRows / 8));
1107
+ let nullCount = 0;
1108
+ for (let i = 0;i < numRows; i++) {
1109
+ const row = values[i];
1110
+ if (row == null) {
1111
+ nullCount++;
1112
+ for (let j = 0;j < listSize; j++)
1113
+ allItems.push(null);
1114
+ continue;
1115
+ }
1116
+ nullBitmap[i >> 3] |= 1 << (i & 7);
1117
+ const items = Array.isArray(row) ? row : Array.from(row);
1118
+ if (items.length !== listSize) {
1119
+ throw new TypeError(`fixed_size_list[${listSize}]: row ${i} has ${items.length} items`);
1120
+ }
1121
+ for (const item of items)
1122
+ allItems.push(item);
1123
+ }
1124
+ const childData = allItems.length > 0 ? buildColumnData(allItems, childField.type) : emptyDataForType(childField.type);
1125
+ return makeData2({
1126
+ type,
1127
+ length: numRows,
1128
+ nullCount,
1129
+ nullBitmap: nullCount > 0 ? nullBitmap : undefined,
1130
+ child: childData
1131
+ });
1132
+ }
1099
1133
  function buildMapData(values, mapType) {
1100
1134
  const numRows = values.length;
1101
1135
  const entriesField = mapType.children[0];
@@ -1187,6 +1221,14 @@ function emptyDataForType(type) {
1187
1221
  valueOffsets: new Int32Array([0])
1188
1222
  });
1189
1223
  }
1224
+ if (DataType2.isFixedSizeList(type)) {
1225
+ return makeData2({
1226
+ type,
1227
+ length: 0,
1228
+ nullCount: 0,
1229
+ child: emptyDataForType(type.children[0].type)
1230
+ });
1231
+ }
1190
1232
  if (DataType2.isStruct(type)) {
1191
1233
  const children = type.children.map((cf) => emptyDataForType(cf.type));
1192
1234
  return makeData2({ type, length: 0, nullCount: 0, children });
@@ -5189,6 +5231,8 @@ function unwrapScalar(val) {
5189
5231
  return null;
5190
5232
  if (typeof val !== "object")
5191
5233
  return val;
5234
+ if (val instanceof Date)
5235
+ return val;
5192
5236
  if (typeof val.valueOf === "function") {
5193
5237
  let v;
5194
5238
  try {
@@ -13553,4 +13597,4 @@ export {
13553
13597
  utf82 as utf8
13554
13598
  };
13555
13599
 
13556
- //# debugId=D343450F0C99C4DF64756E2164756E21
13600
+ //# debugId=ECA33C1B580BEB5A64756E2164756E21