@query-farm/vgi 0.33.0 → 0.35.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.
@@ -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 });
@@ -3957,6 +3999,8 @@ function unwrapScalar(val) {
3957
3999
  return null;
3958
4000
  if (typeof val !== "object")
3959
4001
  return val;
4002
+ if (val instanceof Date)
4003
+ return val;
3960
4004
  if (typeof val.valueOf === "function") {
3961
4005
  let v;
3962
4006
  try {
@@ -11131,4 +11175,4 @@ export {
11131
11175
  utf82 as utf8
11132
11176
  };
11133
11177
 
11134
- //# debugId=1A5C665D52410D1064756E2164756E21
11178
+ //# debugId=955C2BDC03ABC85C64756E2164756E21