trifeather
Version:
Pre-triangulated feather files
1,623 lines • 577 kB
JavaScript
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function() {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i;
function verb(n) {
if (g[n])
i[n] = function(v) {
return new Promise(function(a, b) {
q.push([n, v, a, b]) > 1 || resume(n, v);
});
};
}
function resume(n, v) {
try {
step(g[n](v));
} catch (e) {
settle(q[0][3], e);
}
}
function step(r) {
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
}
function fulfill(value) {
resume("next", value);
}
function reject(value) {
resume("throw", value);
}
function settle(f, v) {
if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]);
}
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function(e) {
throw e;
}), verb("return"), i[Symbol.iterator] = function() {
return this;
}, i;
function verb(n, f) {
i[n] = o[n] ? function(v) {
return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v;
} : f;
}
}
function __asyncValues(o) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i);
function verb(n) {
i[n] = o[n] && function(v) {
return new Promise(function(resolve, reject) {
v = o[n](v), settle(resolve, reject, v.done, v.value);
});
};
}
function settle(resolve, reject, d, v) {
Promise.resolve(v).then(function(v2) {
resolve({ value: v2, done: d });
}, reject);
}
}
const decoder = new TextDecoder("utf-8");
const decodeUtf8 = (buffer) => decoder.decode(buffer);
const encoder = new TextEncoder();
const encodeUtf8 = (value) => encoder.encode(value);
const [BigIntCtor, BigIntAvailable] = (() => {
const BigIntUnavailableError = () => {
throw new Error("BigInt is not available in this environment");
};
function BigIntUnavailable() {
throw BigIntUnavailableError();
}
BigIntUnavailable.asIntN = () => {
throw BigIntUnavailableError();
};
BigIntUnavailable.asUintN = () => {
throw BigIntUnavailableError();
};
return typeof BigInt !== "undefined" ? [BigInt, true] : [BigIntUnavailable, false];
})();
const [BigInt64ArrayCtor, BigInt64ArrayAvailable] = (() => {
const BigInt64ArrayUnavailableError = () => {
throw new Error("BigInt64Array is not available in this environment");
};
class BigInt64ArrayUnavailable {
static get BYTES_PER_ELEMENT() {
return 8;
}
static of() {
throw BigInt64ArrayUnavailableError();
}
static from() {
throw BigInt64ArrayUnavailableError();
}
constructor() {
throw BigInt64ArrayUnavailableError();
}
}
return typeof BigInt64Array !== "undefined" ? [BigInt64Array, true] : [BigInt64ArrayUnavailable, false];
})();
const [BigUint64ArrayCtor, BigUint64ArrayAvailable] = (() => {
const BigUint64ArrayUnavailableError = () => {
throw new Error("BigUint64Array is not available in this environment");
};
class BigUint64ArrayUnavailable {
static get BYTES_PER_ELEMENT() {
return 8;
}
static of() {
throw BigUint64ArrayUnavailableError();
}
static from() {
throw BigUint64ArrayUnavailableError();
}
constructor() {
throw BigUint64ArrayUnavailableError();
}
}
return typeof BigUint64Array !== "undefined" ? [BigUint64Array, true] : [BigUint64ArrayUnavailable, false];
})();
const isNumber = (x) => typeof x === "number";
const isBoolean = (x) => typeof x === "boolean";
const isFunction = (x) => typeof x === "function";
const isObject = (x) => x != null && Object(x) === x;
const isPromise = (x) => {
return isObject(x) && isFunction(x.then);
};
const isIterable = (x) => {
return isObject(x) && isFunction(x[Symbol.iterator]);
};
const isAsyncIterable = (x) => {
return isObject(x) && isFunction(x[Symbol.asyncIterator]);
};
const isArrowJSON = (x) => {
return isObject(x) && isObject(x["schema"]);
};
const isIteratorResult = (x) => {
return isObject(x) && "done" in x && "value" in x;
};
const isFileHandle = (x) => {
return isObject(x) && isFunction(x["stat"]) && isNumber(x["fd"]);
};
const isFetchResponse = (x) => {
return isObject(x) && isReadableDOMStream(x["body"]);
};
const isReadableInterop = (x) => "_getDOMStream" in x && "_getNodeStream" in x;
const isWritableDOMStream = (x) => {
return isObject(x) && isFunction(x["abort"]) && isFunction(x["getWriter"]) && !isReadableInterop(x);
};
const isReadableDOMStream = (x) => {
return isObject(x) && isFunction(x["cancel"]) && isFunction(x["getReader"]) && !isReadableInterop(x);
};
const isWritableNodeStream = (x) => {
return isObject(x) && isFunction(x["end"]) && isFunction(x["write"]) && isBoolean(x["writable"]) && !isReadableInterop(x);
};
const isReadableNodeStream = (x) => {
return isObject(x) && isFunction(x["read"]) && isFunction(x["pipe"]) && isBoolean(x["readable"]) && !isReadableInterop(x);
};
const isFlatbuffersByteBuffer = (x) => {
return isObject(x) && isFunction(x["clear"]) && isFunction(x["bytes"]) && isFunction(x["position"]) && isFunction(x["setPosition"]) && isFunction(x["capacity"]) && isFunction(x["getBufferIdentifier"]) && isFunction(x["createLong"]);
};
const SharedArrayBuf = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : ArrayBuffer;
function collapseContiguousByteRanges(chunks) {
const result = chunks[0] ? [chunks[0]] : [];
let xOffset, yOffset, xLen, yLen;
for (let x, y, i = 0, j = 0, n = chunks.length; ++i < n; ) {
x = result[j];
y = chunks[i];
if (!x || !y || x.buffer !== y.buffer || y.byteOffset < x.byteOffset) {
y && (result[++j] = y);
continue;
}
({ byteOffset: xOffset, byteLength: xLen } = x);
({ byteOffset: yOffset, byteLength: yLen } = y);
if (xOffset + xLen < yOffset || yOffset + yLen < xOffset) {
y && (result[++j] = y);
continue;
}
result[j] = new Uint8Array(x.buffer, xOffset, yOffset - xOffset + yLen);
}
return result;
}
function memcpy(target, source, targetByteOffset = 0, sourceByteLength = source.byteLength) {
const targetByteLength = target.byteLength;
const dst = new Uint8Array(target.buffer, target.byteOffset, targetByteLength);
const src = new Uint8Array(source.buffer, source.byteOffset, Math.min(sourceByteLength, targetByteLength));
dst.set(src, targetByteOffset);
return target;
}
function joinUint8Arrays(chunks, size) {
const result = collapseContiguousByteRanges(chunks);
const byteLength = result.reduce((x, b) => x + b.byteLength, 0);
let source, sliced, buffer;
let offset = 0, index2 = -1;
const length3 = Math.min(size || Number.POSITIVE_INFINITY, byteLength);
for (const n = result.length; ++index2 < n; ) {
source = result[index2];
sliced = source.subarray(0, Math.min(source.length, length3 - offset));
if (length3 <= offset + sliced.length) {
if (sliced.length < source.length) {
result[index2] = source.subarray(sliced.length);
} else if (sliced.length === source.length) {
index2++;
}
buffer ? memcpy(buffer, sliced, offset) : buffer = sliced;
break;
}
memcpy(buffer || (buffer = new Uint8Array(length3)), sliced, offset);
offset += sliced.length;
}
return [buffer || new Uint8Array(0), result.slice(index2), byteLength - (buffer ? buffer.byteLength : 0)];
}
function toArrayBufferView(ArrayBufferViewCtor, input) {
let value = isIteratorResult(input) ? input.value : input;
if (value instanceof ArrayBufferViewCtor) {
if (ArrayBufferViewCtor === Uint8Array) {
return new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength);
}
return value;
}
if (!value) {
return new ArrayBufferViewCtor(0);
}
if (typeof value === "string") {
value = encodeUtf8(value);
}
if (value instanceof ArrayBuffer) {
return new ArrayBufferViewCtor(value);
}
if (value instanceof SharedArrayBuf) {
return new ArrayBufferViewCtor(value);
}
if (isFlatbuffersByteBuffer(value)) {
return toArrayBufferView(ArrayBufferViewCtor, value.bytes());
}
return !ArrayBuffer.isView(value) ? ArrayBufferViewCtor.from(value) : value.byteLength <= 0 ? new ArrayBufferViewCtor(0) : new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength / ArrayBufferViewCtor.BYTES_PER_ELEMENT);
}
const toInt32Array = (input) => toArrayBufferView(Int32Array, input);
const toUint8Array = (input) => toArrayBufferView(Uint8Array, input);
const pump$1 = (iterator) => {
iterator.next();
return iterator;
};
function* toArrayBufferViewIterator(ArrayCtor, source) {
const wrap = function* (x) {
yield x;
};
const buffers = typeof source === "string" ? wrap(source) : ArrayBuffer.isView(source) ? wrap(source) : source instanceof ArrayBuffer ? wrap(source) : source instanceof SharedArrayBuf ? wrap(source) : !isIterable(source) ? wrap(source) : source;
yield* pump$1(function* (it) {
let r = null;
do {
r = it.next(yield toArrayBufferView(ArrayCtor, r));
} while (!r.done);
}(buffers[Symbol.iterator]()));
return new ArrayCtor();
}
const toUint8ArrayIterator = (input) => toArrayBufferViewIterator(Uint8Array, input);
function toArrayBufferViewAsyncIterator(ArrayCtor, source) {
return __asyncGenerator(this, arguments, function* toArrayBufferViewAsyncIterator_1() {
if (isPromise(source)) {
return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(toArrayBufferViewAsyncIterator(ArrayCtor, yield __await(source))))));
}
const wrap = function(x) {
return __asyncGenerator(this, arguments, function* () {
yield yield __await(yield __await(x));
});
};
const emit = function(source2) {
return __asyncGenerator(this, arguments, function* () {
yield __await(yield* __asyncDelegator(__asyncValues(pump$1(function* (it) {
let r = null;
do {
r = it.next(yield r === null || r === void 0 ? void 0 : r.value);
} while (!r.done);
}(source2[Symbol.iterator]())))));
});
};
const buffers = typeof source === "string" ? wrap(source) : ArrayBuffer.isView(source) ? wrap(source) : source instanceof ArrayBuffer ? wrap(source) : source instanceof SharedArrayBuf ? wrap(source) : isIterable(source) ? emit(source) : !isAsyncIterable(source) ? wrap(source) : source;
yield __await(
yield* __asyncDelegator(__asyncValues(pump$1(function(it) {
return __asyncGenerator(this, arguments, function* () {
let r = null;
do {
r = yield __await(it.next(yield yield __await(toArrayBufferView(ArrayCtor, r))));
} while (!r.done);
});
}(buffers[Symbol.asyncIterator]()))))
);
return yield __await(new ArrayCtor());
});
}
const toUint8ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Uint8Array, input);
function rebaseValueOffsets(offset, length3, valueOffsets) {
if (offset !== 0) {
valueOffsets = valueOffsets.slice(0, length3 + 1);
for (let i = -1; ++i <= length3; ) {
valueOffsets[i] += offset;
}
}
return valueOffsets;
}
function compareArrayLike(a, b) {
let i = 0;
const n = a.length;
if (n !== b.length) {
return false;
}
if (n > 0) {
do {
if (a[i] !== b[i]) {
return false;
}
} while (++i < n);
}
return true;
}
var streamAdapters = {
fromIterable(source) {
return pump(fromIterable(source));
},
fromAsyncIterable(source) {
return pump(fromAsyncIterable(source));
},
fromDOMStream(source) {
return pump(fromDOMStream(source));
},
fromNodeStream(stream) {
return pump(fromNodeStream(stream));
},
toDOMStream(source, options) {
throw new Error(`"toDOMStream" not available in this environment`);
},
toNodeStream(source, options) {
throw new Error(`"toNodeStream" not available in this environment`);
}
};
const pump = (iterator) => {
iterator.next();
return iterator;
};
function* fromIterable(source) {
let done, threw = false;
let buffers = [], buffer;
let cmd, size, bufferLength = 0;
function byteRange() {
if (cmd === "peek") {
return joinUint8Arrays(buffers, size)[0];
}
[buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
return buffer;
}
({ cmd, size } = yield null);
const it = toUint8ArrayIterator(source)[Symbol.iterator]();
try {
do {
({ done, value: buffer } = Number.isNaN(size - bufferLength) ? it.next() : it.next(size - bufferLength));
if (!done && buffer.byteLength > 0) {
buffers.push(buffer);
bufferLength += buffer.byteLength;
}
if (done || size <= bufferLength) {
do {
({ cmd, size } = yield byteRange());
} while (size < bufferLength);
}
} while (!done);
} catch (e) {
(threw = true) && typeof it.throw === "function" && it.throw(e);
} finally {
threw === false && typeof it.return === "function" && it.return(null);
}
return null;
}
function fromAsyncIterable(source) {
return __asyncGenerator(this, arguments, function* fromAsyncIterable_1() {
let done, threw = false;
let buffers = [], buffer;
let cmd, size, bufferLength = 0;
function byteRange() {
if (cmd === "peek") {
return joinUint8Arrays(buffers, size)[0];
}
[buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
return buffer;
}
({ cmd, size } = yield yield __await(null));
const it = toUint8ArrayAsyncIterator(source)[Symbol.asyncIterator]();
try {
do {
({ done, value: buffer } = Number.isNaN(size - bufferLength) ? yield __await(it.next()) : yield __await(it.next(size - bufferLength)));
if (!done && buffer.byteLength > 0) {
buffers.push(buffer);
bufferLength += buffer.byteLength;
}
if (done || size <= bufferLength) {
do {
({ cmd, size } = yield yield __await(byteRange()));
} while (size < bufferLength);
}
} while (!done);
} catch (e) {
(threw = true) && typeof it.throw === "function" && (yield __await(it.throw(e)));
} finally {
threw === false && typeof it.return === "function" && (yield __await(it.return(new Uint8Array(0))));
}
return yield __await(null);
});
}
function fromDOMStream(source) {
return __asyncGenerator(this, arguments, function* fromDOMStream_1() {
let done = false, threw = false;
let buffers = [], buffer;
let cmd, size, bufferLength = 0;
function byteRange() {
if (cmd === "peek") {
return joinUint8Arrays(buffers, size)[0];
}
[buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
return buffer;
}
({ cmd, size } = yield yield __await(null));
const it = new AdaptiveByteReader(source);
try {
do {
({ done, value: buffer } = Number.isNaN(size - bufferLength) ? yield __await(it["read"]()) : yield __await(it["read"](size - bufferLength)));
if (!done && buffer.byteLength > 0) {
buffers.push(toUint8Array(buffer));
bufferLength += buffer.byteLength;
}
if (done || size <= bufferLength) {
do {
({ cmd, size } = yield yield __await(byteRange()));
} while (size < bufferLength);
}
} while (!done);
} catch (e) {
(threw = true) && (yield __await(it["cancel"](e)));
} finally {
threw === false ? yield __await(it["cancel"]()) : source["locked"] && it.releaseLock();
}
return yield __await(null);
});
}
class AdaptiveByteReader {
constructor(source) {
this.source = source;
this.reader = null;
this.reader = this.source["getReader"]();
this.reader["closed"].catch(() => {
});
}
get closed() {
return this.reader ? this.reader["closed"].catch(() => {
}) : Promise.resolve();
}
releaseLock() {
if (this.reader) {
this.reader.releaseLock();
}
this.reader = null;
}
cancel(reason) {
return __awaiter(this, void 0, void 0, function* () {
const { reader, source } = this;
reader && (yield reader["cancel"](reason).catch(() => {
}));
source && (source["locked"] && this.releaseLock());
});
}
read(size) {
return __awaiter(this, void 0, void 0, function* () {
if (size === 0) {
return { done: this.reader == null, value: new Uint8Array(0) };
}
const result = yield this.reader.read();
!result.done && (result.value = toUint8Array(result));
return result;
});
}
}
const onEvent = (stream, event) => {
const handler = (_) => resolve([event, _]);
let resolve;
return [event, handler, new Promise((r) => (resolve = r) && stream["once"](event, handler))];
};
function fromNodeStream(stream) {
return __asyncGenerator(this, arguments, function* fromNodeStream_1() {
const events = [];
let event = "error";
let done = false, err = null;
let cmd, size, bufferLength = 0;
let buffers = [], buffer;
function byteRange() {
if (cmd === "peek") {
return joinUint8Arrays(buffers, size)[0];
}
[buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
return buffer;
}
({ cmd, size } = yield yield __await(null));
if (stream["isTTY"]) {
yield yield __await(new Uint8Array(0));
return yield __await(null);
}
try {
events[0] = onEvent(stream, "end");
events[1] = onEvent(stream, "error");
do {
events[2] = onEvent(stream, "readable");
[event, err] = yield __await(Promise.race(events.map((x) => x[2])));
if (event === "error") {
break;
}
if (!(done = event === "end")) {
if (!Number.isFinite(size - bufferLength)) {
buffer = toUint8Array(stream["read"]());
} else {
buffer = toUint8Array(stream["read"](size - bufferLength));
if (buffer.byteLength < size - bufferLength) {
buffer = toUint8Array(stream["read"]());
}
}
if (buffer.byteLength > 0) {
buffers.push(buffer);
bufferLength += buffer.byteLength;
}
}
if (done || size <= bufferLength) {
do {
({ cmd, size } = yield yield __await(byteRange()));
} while (size < bufferLength);
}
} while (!done);
} finally {
yield __await(cleanup(events, event === "error" ? err : null));
}
return yield __await(null);
function cleanup(events2, err2) {
buffer = buffers = null;
return new Promise((resolve, reject) => {
for (const [evt, fn] of events2) {
stream["off"](evt, fn);
}
try {
const destroy = stream["destroy"];
destroy && destroy.call(stream, err2);
err2 = void 0;
} catch (e) {
err2 = e || err2;
} finally {
err2 != null ? reject(err2) : resolve();
}
});
}
});
}
var MetadataVersion$1;
(function(MetadataVersion2) {
MetadataVersion2[MetadataVersion2["V1"] = 0] = "V1";
MetadataVersion2[MetadataVersion2["V2"] = 1] = "V2";
MetadataVersion2[MetadataVersion2["V3"] = 2] = "V3";
MetadataVersion2[MetadataVersion2["V4"] = 3] = "V4";
MetadataVersion2[MetadataVersion2["V5"] = 4] = "V5";
})(MetadataVersion$1 || (MetadataVersion$1 = {}));
var UnionMode$1;
(function(UnionMode2) {
UnionMode2[UnionMode2["Sparse"] = 0] = "Sparse";
UnionMode2[UnionMode2["Dense"] = 1] = "Dense";
})(UnionMode$1 || (UnionMode$1 = {}));
var Precision$1;
(function(Precision2) {
Precision2[Precision2["HALF"] = 0] = "HALF";
Precision2[Precision2["SINGLE"] = 1] = "SINGLE";
Precision2[Precision2["DOUBLE"] = 2] = "DOUBLE";
})(Precision$1 || (Precision$1 = {}));
var DateUnit$1;
(function(DateUnit2) {
DateUnit2[DateUnit2["DAY"] = 0] = "DAY";
DateUnit2[DateUnit2["MILLISECOND"] = 1] = "MILLISECOND";
})(DateUnit$1 || (DateUnit$1 = {}));
var TimeUnit$1;
(function(TimeUnit2) {
TimeUnit2[TimeUnit2["SECOND"] = 0] = "SECOND";
TimeUnit2[TimeUnit2["MILLISECOND"] = 1] = "MILLISECOND";
TimeUnit2[TimeUnit2["MICROSECOND"] = 2] = "MICROSECOND";
TimeUnit2[TimeUnit2["NANOSECOND"] = 3] = "NANOSECOND";
})(TimeUnit$1 || (TimeUnit$1 = {}));
var IntervalUnit$1;
(function(IntervalUnit2) {
IntervalUnit2[IntervalUnit2["YEAR_MONTH"] = 0] = "YEAR_MONTH";
IntervalUnit2[IntervalUnit2["DAY_TIME"] = 1] = "DAY_TIME";
IntervalUnit2[IntervalUnit2["MONTH_DAY_NANO"] = 2] = "MONTH_DAY_NANO";
})(IntervalUnit$1 || (IntervalUnit$1 = {}));
var MessageHeader$1;
(function(MessageHeader2) {
MessageHeader2[MessageHeader2["NONE"] = 0] = "NONE";
MessageHeader2[MessageHeader2["Schema"] = 1] = "Schema";
MessageHeader2[MessageHeader2["DictionaryBatch"] = 2] = "DictionaryBatch";
MessageHeader2[MessageHeader2["RecordBatch"] = 3] = "RecordBatch";
MessageHeader2[MessageHeader2["Tensor"] = 4] = "Tensor";
MessageHeader2[MessageHeader2["SparseTensor"] = 5] = "SparseTensor";
})(MessageHeader$1 || (MessageHeader$1 = {}));
var Type$1;
(function(Type2) {
Type2[Type2["NONE"] = 0] = "NONE";
Type2[Type2["Null"] = 1] = "Null";
Type2[Type2["Int"] = 2] = "Int";
Type2[Type2["Float"] = 3] = "Float";
Type2[Type2["Binary"] = 4] = "Binary";
Type2[Type2["Utf8"] = 5] = "Utf8";
Type2[Type2["Bool"] = 6] = "Bool";
Type2[Type2["Decimal"] = 7] = "Decimal";
Type2[Type2["Date"] = 8] = "Date";
Type2[Type2["Time"] = 9] = "Time";
Type2[Type2["Timestamp"] = 10] = "Timestamp";
Type2[Type2["Interval"] = 11] = "Interval";
Type2[Type2["List"] = 12] = "List";
Type2[Type2["Struct"] = 13] = "Struct";
Type2[Type2["Union"] = 14] = "Union";
Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
Type2[Type2["Map"] = 17] = "Map";
Type2[Type2["Dictionary"] = -1] = "Dictionary";
Type2[Type2["Int8"] = -2] = "Int8";
Type2[Type2["Int16"] = -3] = "Int16";
Type2[Type2["Int32"] = -4] = "Int32";
Type2[Type2["Int64"] = -5] = "Int64";
Type2[Type2["Uint8"] = -6] = "Uint8";
Type2[Type2["Uint16"] = -7] = "Uint16";
Type2[Type2["Uint32"] = -8] = "Uint32";
Type2[Type2["Uint64"] = -9] = "Uint64";
Type2[Type2["Float16"] = -10] = "Float16";
Type2[Type2["Float32"] = -11] = "Float32";
Type2[Type2["Float64"] = -12] = "Float64";
Type2[Type2["DateDay"] = -13] = "DateDay";
Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
})(Type$1 || (Type$1 = {}));
var BufferType;
(function(BufferType2) {
BufferType2[BufferType2["OFFSET"] = 0] = "OFFSET";
BufferType2[BufferType2["DATA"] = 1] = "DATA";
BufferType2[BufferType2["VALIDITY"] = 2] = "VALIDITY";
BufferType2[BufferType2["TYPE"] = 3] = "TYPE";
})(BufferType || (BufferType = {}));
const undf = void 0;
function valueToString(x) {
if (x === null) {
return "null";
}
if (x === undf) {
return "undefined";
}
switch (typeof x) {
case "number":
return `${x}`;
case "bigint":
return `${x}`;
case "string":
return `"${x}"`;
}
if (typeof x[Symbol.toPrimitive] === "function") {
return x[Symbol.toPrimitive]("string");
}
if (ArrayBuffer.isView(x)) {
if (x instanceof BigInt64Array || x instanceof BigUint64Array) {
return `[${[...x].map((x2) => valueToString(x2))}]`;
}
return `[${x}]`;
}
return ArrayBuffer.isView(x) ? `[${x}]` : JSON.stringify(x, (_, y) => typeof y === "bigint" ? `${y}` : y);
}
const isArrowBigNumSymbol = Symbol.for("isArrowBigNum");
function BigNum(x, ...xs) {
if (xs.length === 0) {
return Object.setPrototypeOf(toArrayBufferView(this["TypedArray"], x), this.constructor.prototype);
}
return Object.setPrototypeOf(new this["TypedArray"](x, ...xs), this.constructor.prototype);
}
BigNum.prototype[isArrowBigNumSymbol] = true;
BigNum.prototype.toJSON = function() {
return `"${bignumToString(this)}"`;
};
BigNum.prototype.valueOf = function() {
return bignumToNumber(this);
};
BigNum.prototype.toString = function() {
return bignumToString(this);
};
BigNum.prototype[Symbol.toPrimitive] = function(hint = "default") {
switch (hint) {
case "number":
return bignumToNumber(this);
case "string":
return bignumToString(this);
case "default":
return bignumToBigInt(this);
}
return bignumToString(this);
};
function SignedBigNum(...args) {
return BigNum.apply(this, args);
}
function UnsignedBigNum(...args) {
return BigNum.apply(this, args);
}
function DecimalBigNum(...args) {
return BigNum.apply(this, args);
}
Object.setPrototypeOf(SignedBigNum.prototype, Object.create(Int32Array.prototype));
Object.setPrototypeOf(UnsignedBigNum.prototype, Object.create(Uint32Array.prototype));
Object.setPrototypeOf(DecimalBigNum.prototype, Object.create(Uint32Array.prototype));
Object.assign(SignedBigNum.prototype, BigNum.prototype, { "constructor": SignedBigNum, "signed": true, "TypedArray": Int32Array, "BigIntArray": BigInt64ArrayCtor });
Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { "constructor": UnsignedBigNum, "signed": false, "TypedArray": Uint32Array, "BigIntArray": BigUint64ArrayCtor });
Object.assign(DecimalBigNum.prototype, BigNum.prototype, { "constructor": DecimalBigNum, "signed": true, "TypedArray": Uint32Array, "BigIntArray": BigUint64ArrayCtor });
function bignumToNumber(bn) {
const { buffer, byteOffset, length: length3, "signed": signed } = bn;
const words = new BigUint64ArrayCtor(buffer, byteOffset, length3);
const negative = signed && words[words.length - 1] & BigInt(1) << BigInt(63);
let number2 = negative ? BigInt(1) : BigInt(0);
let i = BigInt(0);
if (!negative) {
for (const word of words) {
number2 += word * (BigInt(1) << BigInt(32) * i++);
}
} else {
for (const word of words) {
number2 += ~word * (BigInt(1) << BigInt(32) * i++);
}
number2 *= BigInt(-1);
}
return number2;
}
let bignumToString;
let bignumToBigInt;
if (!BigIntAvailable) {
bignumToString = decimalToString;
bignumToBigInt = bignumToString;
} else {
bignumToBigInt = (a) => a.byteLength === 8 ? new a["BigIntArray"](a.buffer, a.byteOffset, 1)[0] : decimalToString(a);
bignumToString = (a) => a.byteLength === 8 ? `${new a["BigIntArray"](a.buffer, a.byteOffset, 1)[0]}` : decimalToString(a);
}
function decimalToString(a) {
let digits = "";
const base64 = new Uint32Array(2);
let base32 = new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2);
const checks = new Uint32Array((base32 = new Uint16Array(base32).reverse()).buffer);
let i = -1;
const n = base32.length - 1;
do {
for (base64[0] = base32[i = 0]; i < n; ) {
base32[i++] = base64[1] = base64[0] / 10;
base64[0] = (base64[0] - base64[1] * 10 << 16) + base32[i];
}
base32[i] = base64[1] = base64[0] / 10;
base64[0] = base64[0] - base64[1] * 10;
digits = `${base64[0]}${digits}`;
} while (checks[0] || checks[1] || checks[2] || checks[3]);
return digits !== null && digits !== void 0 ? digits : `0`;
}
class BN {
static new(num, isSigned) {
switch (isSigned) {
case true:
return new SignedBigNum(num);
case false:
return new UnsignedBigNum(num);
}
switch (num.constructor) {
case Int8Array:
case Int16Array:
case Int32Array:
case BigInt64ArrayCtor:
return new SignedBigNum(num);
}
if (num.byteLength === 16) {
return new DecimalBigNum(num);
}
return new UnsignedBigNum(num);
}
static signed(num) {
return new SignedBigNum(num);
}
static unsigned(num) {
return new UnsignedBigNum(num);
}
static decimal(num) {
return new DecimalBigNum(num);
}
constructor(num, isSigned) {
return BN.new(num, isSigned);
}
}
var _a$3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
class DataType {
static isNull(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Null;
}
static isInt(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Int;
}
static isFloat(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Float;
}
static isBinary(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Binary;
}
static isUtf8(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Utf8;
}
static isBool(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Bool;
}
static isDecimal(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Decimal;
}
static isDate(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Date;
}
static isTime(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Time;
}
static isTimestamp(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Timestamp;
}
static isInterval(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Interval;
}
static isList(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.List;
}
static isStruct(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Struct;
}
static isUnion(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Union;
}
static isFixedSizeBinary(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.FixedSizeBinary;
}
static isFixedSizeList(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.FixedSizeList;
}
static isMap(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Map;
}
static isDictionary(x) {
return (x === null || x === void 0 ? void 0 : x.typeId) === Type$1.Dictionary;
}
static isDenseUnion(x) {
return DataType.isUnion(x) && x.mode === UnionMode$1.Dense;
}
static isSparseUnion(x) {
return DataType.isUnion(x) && x.mode === UnionMode$1.Sparse;
}
get typeId() {
return Type$1.NONE;
}
}
_a$3 = Symbol.toStringTag;
DataType[_a$3] = ((proto) => {
proto.children = null;
proto.ArrayType = Array;
return proto[Symbol.toStringTag] = "DataType";
})(DataType.prototype);
class Null$1 extends DataType {
toString() {
return `Null`;
}
get typeId() {
return Type$1.Null;
}
}
_b = Symbol.toStringTag;
Null$1[_b] = ((proto) => proto[Symbol.toStringTag] = "Null")(Null$1.prototype);
class Int_ extends DataType {
constructor(isSigned, bitWidth) {
super();
this.isSigned = isSigned;
this.bitWidth = bitWidth;
}
get typeId() {
return Type$1.Int;
}
get ArrayType() {
switch (this.bitWidth) {
case 8:
return this.isSigned ? Int8Array : Uint8Array;
case 16:
return this.isSigned ? Int16Array : Uint16Array;
case 32:
return this.isSigned ? Int32Array : Uint32Array;
case 64:
return this.isSigned ? BigInt64Array : BigUint64Array;
}
throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
}
toString() {
return `${this.isSigned ? `I` : `Ui`}nt${this.bitWidth}`;
}
}
_c = Symbol.toStringTag;
Int_[_c] = ((proto) => {
proto.isSigned = null;
proto.bitWidth = null;
return proto[Symbol.toStringTag] = "Int";
})(Int_.prototype);
class Int8 extends Int_ {
constructor() {
super(true, 8);
}
get ArrayType() {
return Int8Array;
}
}
class Int16 extends Int_ {
constructor() {
super(true, 16);
}
get ArrayType() {
return Int16Array;
}
}
class Int32 extends Int_ {
constructor() {
super(true, 32);
}
get ArrayType() {
return Int32Array;
}
}
class Int64$1 extends Int_ {
constructor() {
super(true, 64);
}
get ArrayType() {
return BigInt64Array;
}
}
class Uint8 extends Int_ {
constructor() {
super(false, 8);
}
get ArrayType() {
return Uint8Array;
}
}
class Uint16 extends Int_ {
constructor() {
super(false, 16);
}
get ArrayType() {
return Uint16Array;
}
}
class Uint32 extends Int_ {
constructor() {
super(false, 32);
}
get ArrayType() {
return Uint32Array;
}
}
class Uint64$1 extends Int_ {
constructor() {
super(false, 64);
}
get ArrayType() {
return BigUint64Array;
}
}
Object.defineProperty(Int8.prototype, "ArrayType", { value: Int8Array });
Object.defineProperty(Int16.prototype, "ArrayType", { value: Int16Array });
Object.defineProperty(Int32.prototype, "ArrayType", { value: Int32Array });
Object.defineProperty(Int64$1.prototype, "ArrayType", { value: BigInt64Array });
Object.defineProperty(Uint8.prototype, "ArrayType", { value: Uint8Array });
Object.defineProperty(Uint16.prototype, "ArrayType", { value: Uint16Array });
Object.defineProperty(Uint32.prototype, "ArrayType", { value: Uint32Array });
Object.defineProperty(Uint64$1.prototype, "ArrayType", { value: BigUint64Array });
class Float extends DataType {
constructor(precision) {
super();
this.precision = precision;
}
get typeId() {
return Type$1.Float;
}
get ArrayType() {
switch (this.precision) {
case Precision$1.HALF:
return Uint16Array;
case Precision$1.SINGLE:
return Float32Array;
case Precision$1.DOUBLE:
return Float64Array;
}
throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
}
toString() {
return `Float${this.precision << 5 || 16}`;
}
}
_d = Symbol.toStringTag;
Float[_d] = ((proto) => {
proto.precision = null;
return proto[Symbol.toStringTag] = "Float";
})(Float.prototype);
class Float32 extends Float {
constructor() {
super(Precision$1.SINGLE);
}
}
class Float64 extends Float {
constructor() {
super(Precision$1.DOUBLE);
}
}
Object.defineProperty(Float32.prototype, "ArrayType", { value: Float32Array });
Object.defineProperty(Float64.prototype, "ArrayType", { value: Float64Array });
class Binary$1 extends DataType {
constructor() {
super();
}
get typeId() {
return Type$1.Binary;
}
toString() {
return `Binary`;
}
}
_e = Symbol.toStringTag;
Binary$1[_e] = ((proto) => {
proto.ArrayType = Uint8Array;
return proto[Symbol.toStringTag] = "Binary";
})(Binary$1.prototype);
class Utf8$1 extends DataType {
constructor() {
super();
}
get typeId() {
return Type$1.Utf8;
}
toString() {
return `Utf8`;
}
}
_f = Symbol.toStringTag;
Utf8$1[_f] = ((proto) => {
proto.ArrayType = Uint8Array;
return proto[Symbol.toStringTag] = "Utf8";
})(Utf8$1.prototype);
class Bool$1 extends DataType {
constructor() {
super();
}
get typeId() {
return Type$1.Bool;
}
toString() {
return `Bool`;
}
}
_g = Symbol.toStringTag;
Bool$1[_g] = ((proto) => {
proto.ArrayType = Uint8Array;
return proto[Symbol.toStringTag] = "Bool";
})(Bool$1.prototype);
class Decimal$1 extends DataType {
constructor(scale, precision, bitWidth = 128) {
super();
this.scale = scale;
this.precision = precision;
this.bitWidth = bitWidth;
}
get typeId() {
return Type$1.Decimal;
}
toString() {
return `Decimal[${this.precision}e${this.scale > 0 ? `+` : ``}${this.scale}]`;
}
}
_h = Symbol.toStringTag;
Decimal$1[_h] = ((proto) => {
proto.scale = null;
proto.precision = null;
proto.ArrayType = Uint32Array;
return proto[Symbol.toStringTag] = "Decimal";
})(Decimal$1.prototype);
class Date_ extends DataType {
constructor(unit2) {
super();
this.unit = unit2;
}
get typeId() {
return Type$1.Date;
}
toString() {
return `Date${(this.unit + 1) * 32}<${DateUnit$1[this.unit]}>`;
}
}
_j = Symbol.toStringTag;
Date_[_j] = ((proto) => {
proto.unit = null;
proto.ArrayType = Int32Array;
return proto[Symbol.toStringTag] = "Date";
})(Date_.prototype);
class DateMillisecond extends Date_ {
constructor() {
super(DateUnit$1.MILLISECOND);
}
}
class Time_ extends DataType {
constructor(unit2, bitWidth) {
super();
this.unit = unit2;
this.bitWidth = bitWidth;
}
get typeId() {
return Type$1.Time;
}
toString() {
return `Time${this.bitWidth}<${TimeUnit$1[this.unit]}>`;
}
get ArrayType() {
switch (this.bitWidth) {
case 32:
return Int32Array;
case 64:
return BigInt64Array;
}
throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
}
}
_k = Symbol.toStringTag;
Time_[_k] = ((proto) => {
proto.unit = null;
proto.bitWidth = null;
return proto[Symbol.toStringTag] = "Time";
})(Time_.prototype);
class Timestamp_ extends DataType {
constructor(unit2, timezone) {
super();
this.unit = unit2;
this.timezone = timezone;
}
get typeId() {
return Type$1.Timestamp;
}
toString() {
return `Timestamp<${TimeUnit$1[this.unit]}${this.timezone ? `, ${this.timezone}` : ``}>`;
}
}
_l = Symbol.toStringTag;
Timestamp_[_l] = ((proto) => {
proto.unit = null;
proto.timezone = null;
proto.ArrayType = Int32Array;
return proto[Symbol.toStringTag] = "Timestamp";
})(Timestamp_.prototype);
class Interval_ extends DataType {
constructor(unit2) {
super();
this.unit = unit2;
}
get typeId() {
return Type$1.Interval;
}
toString() {
return `Interval<${IntervalUnit$1[this.unit]}>`;
}
}
_m = Symbol.toStringTag;
Interval_[_m] = ((proto) => {
proto.unit = null;
proto.ArrayType = Int32Array;
return proto[Symbol.toStringTag] = "Interval";
})(Interval_.prototype);
class List$1 extends DataType {
constructor(child) {
super();
this.children = [child];
}
get typeId() {
return Type$1.List;
}
toString() {
return `List<${this.valueType}>`;
}
get valueType() {
return this.children[0].type;
}
get valueField() {
return this.children[0];
}
get ArrayType() {
return this.valueType.ArrayType;
}
}
_o = Symbol.toStringTag;
List$1[_o] = ((proto) => {
proto.children = null;
return proto[Symbol.toStringTag] = "List";
})(List$1.prototype);
class Struct extends DataType {
constructor(children2) {
super();
this.children = children2;
}
get typeId() {
return Type$1.Struct;
}
toString() {
return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`;
}
}
_p = Symbol.toStringTag;
Struct[_p] = ((proto) => {
proto.children = null;
return proto[Symbol.toStringTag] = "Struct";
})(Struct.prototype);
class Union_ extends DataType {
constructor(mode, typeIds, children2) {
super();
this.mode = mode;
this.children = children2;
this.typeIds = typeIds = Int32Array.from(typeIds);
this.typeIdToChildIndex = typeIds.reduce((typeIdToChildIndex, typeId, idx) => (typeIdToChildIndex[typeId] = idx) && typeIdToChildIndex || typeIdToChildIndex, /* @__PURE__ */ Object.create(null));
}
get typeId() {
return Type$1.Union;
}
toString() {
return `${this[Symbol.toStringTag]}<${this.children.map((x) => `${x.type}`).join(` | `)}>`;
}
}
_q = Symbol.toStringTag;
Union_[_q] = ((proto) => {
proto.mode = null;
proto.typeIds = null;
proto.children = null;
proto.typeIdToChildIndex = null;
proto.ArrayType = Int8Array;
return proto[Symbol.toStringTag] = "Union";
})(Union_.prototype);
class FixedSizeBinary$1 extends DataType {
constructor(byteWidth) {
super();
this.byteWidth = byteWidth;
}
get typeId() {
return Type$1.FixedSizeBinary;
}
toString() {
return `FixedSizeBinary[${this.byteWidth}]`;
}
}
_r = Symbol.toStringTag;
FixedSizeBinary$1[_r] = ((proto) => {
proto.byteWidth = null;
proto.ArrayType = Uint8Array;
return proto[Symbol.toStringTag] = "FixedSizeBinary";
})(FixedSizeBinary$1.prototype);
class FixedSizeList$1 extends DataType {
constructor(listSize, child) {
super();
this.listSize = listSize;
this.children = [child];
}
get typeId() {
return Type$1.FixedSizeList;
}
get valueType() {
return this.children[0].type;
}
get valueField() {
return this.children[0];
}
get ArrayType() {
return this.valueType.ArrayType;
}
toString() {
return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
}
}
_s = Symbol.toStringTag;
FixedSizeList$1[_s] = ((proto) => {
proto.children = null;
proto.listSize = null;
return proto[Symbol.toStringTag] = "FixedSizeList";
})(FixedSizeList$1.prototype);
class Map_ extends DataType {
constructor(child, keysSorted = false) {
super();
this.children = [child];
this.keysSorted = keysSorted;
}
get typeId() {
return Type$1.Map;
}
get keyType() {
return this.children[0].type.children[0].type;
}
get valueType() {
return this.children[0].type.children[1].type;
}
get childType() {
return this.children[0].type;
}
toString() {
return `Map<{${this.children[0].type.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`;
}
}
_t = Symbol.toStringTag;
Map_[_t] = ((proto) => {
proto.children = null;
proto.keysSorted = null;
return proto[Symbol.toStringTag] = "Map_";
})(Map_.prototype);
const getId = ((atomicDictionaryId) => () => ++atomicDictionaryId)(-1);
class Dictionary extends DataType {
constructor(dictionary, indices, id2, isOrdered) {
super();
this.indices = indices;
this.dictionary = dictionary;
this.isOrdered = isOrdered || false;
this.id = id2 == null ? getId() : typeof id2 === "number" ? id2 : id2.low;
}
get typeId() {
return Type$1.Dictionary;
}
get children() {
return this.dictionary.children;
}
get valueType() {
return this.dictionary;
}
get ArrayType() {
return this.dictionary.ArrayType;
}
toString() {
return `Dictionary<${this.indices}, ${this.dictionary}>`;
}
}
_u = Symbol.toStringTag;
Dictionary[_u] = ((proto) => {
proto.id = null;
proto.indices = null;
proto.isOrdered = null;
proto.dictionary = null;
return proto[Symbol.toStringTag] = "Dictionary";
})(Dictionary.prototype);
function strideForType(type) {
const t = type;
switch (type.typeId) {
case Type$1.Decimal:
return type.bitWidth / 32;
case Type$1.Timestamp:
return 2;
case Type$1.Date:
return 1 + t.unit;
case Type$1.Interval:
return 1 + t.unit;
case Type$1.FixedSizeList:
return t.listSize;
case Type$1.FixedSizeBinary:
return t.byteWidth;
default:
return 1;
}
}
class Visitor {
visitMany(nodes, ...args) {
return nodes.map((node, i) => this.visit(node, ...args.map((x) => x[i])));
}
visit(...args) {
return this.getVisitFn(args[0], false).apply(this, args);
}
getVisitFn(node, throwIfNotFound = true) {
return getVisitFn(this, node, throwIfNotFound);
}
getVisitFnByTypeId(typeId, throwIfNotFound = true) {
return getVisitFnByTypeId(this, typeId, throwIfNotFound);
}
visitNull(_node, ..._args) {
return null;
}
visitBool(_node, ..._args) {
return null;
}
visitInt(_node, ..._args) {
return null;
}
visitFloat(_node, ..._args) {
return null;
}
visitUtf8(_node, ..._args) {
return null;
}
visitBinary(_node, ..._args) {
return null;
}
visitFixedSizeBinary(_node, ..._args) {
return null;
}
visitDate(_node, ..._args) {
return null;
}
visitTimestamp(_node, ..._args) {
return null;
}
visitTime(_node, ..._args) {
return null;
}
visitDecimal(_node, ..._args) {
return null;
}
visitList(_node, ..._args) {
return null;
}
visitStruct(_node, ..._args) {
return null;
}
visitUnion(_node, ..._args) {
return null;
}
visitDictionary(_node, ..._args) {
return null;
}
visitInterval(_node, ..._args) {
return null;
}
visitFixedSizeList(_node, ..._args) {
return null;
}
visitMap(_node, ..._args) {
return null;
}
}
function getVisitFn(visitor, node, throwIfNotFound = true) {
if (typeof node === "number") {
return getVisitFnByTypeId(visitor, node, throwIfNotFound);
}
if (typeof node === "string" && node in Type$1) {
return getVisitFnByTypeId(visitor, Type$1[node], throwIfNotFound);
}
if (node && node instanceof DataType) {
return getVisitFnByTypeId(visitor, inferDType(node), throwIfNotFound);
}
if ((node === null || node === void 0 ? void 0 : node.type) && node.type instanceof DataType) {
return getVisitFnByTypeId(visitor, inferDType(node.type), throwIfNotFound);
}
return getVisitFnByTypeId(visitor, Type$1.NONE, throwIfNotFound);
}
function getVisitFnByTypeId(visitor, dtype, throwIfNotFound = true) {
let fn = null;
switch (dtype) {
case Type$1.Null:
fn = visitor.visitNull;
break;
case Type$1.Bool:
fn = visitor.visitBool;
break;
case Type$1.Int:
fn = visitor.visitInt;
break;
case Type$1.Int8:
fn = visitor.visitInt8 || visitor.visitInt;
break;
case Type$1.Int16:
fn = visitor.visitInt16 || visitor.visitInt;
break;
case Type$1.Int32:
fn = visitor.visitInt32 || visitor.visitInt;
break;
case Type$1.Int64:
fn = visitor.visitInt64 || visitor.visitInt;
break;
case Type$1.Uint8:
fn = visitor.visitUint8 || visitor.visitInt;
break;
case Type$1.Uint16:
fn = visitor.visitUint16 || visitor.visitInt;
break;
case Type$1.Uint32:
fn = visitor.visitUint32 || visitor.visitInt;
break;
case Type$1.Uint64:
fn = visitor.visitUint64 || visitor.visitInt;
break;
case Type$1.Float:
fn = visitor.visitFloat;
break;
case Type$1.Float16:
fn = visitor.visitFloat16 || visitor.visitFloat;
break;
case Type$1.Float32:
fn = visitor.visitFloat32 || visitor.visitFloat;
break;
case Type$1.Float64:
fn = visitor.visitFloat64 || visitor.visitFloat;
break;
case Type$1.Utf8:
fn = visitor.visitUtf8;
break;
case Type$1.Binary:
fn = visitor.visitBinary;
break;
case Type$1.FixedSizeBinary:
fn = visitor.visitFixedSizeBinary;
break;
case Type$1.Date:
fn = visitor.visitDate;
break;
case Type$1.DateDay:
fn = visitor.visitDateDay || visitor.visitDate;
break;
case Type$1.DateMillisecond:
fn = visitor.visitDateMillisecond || visitor.visitDate;
break;
case Type$1.Timestamp:
fn = visitor.visitTimestamp;
break;
case Type$1.TimestampSecond:
fn = visitor.visitTimestampSecond || visitor.visitTimestamp;
break;
case Type$1.TimestampMillisecond:
fn = visitor.visitTimestampMillisecond || visitor.visitTimestamp;
break;
case Type$1.TimestampMicrosecond:
fn = visitor.visitTimestampMicrosecond || visitor.visitTimestamp;
break;
case Type$1.TimestampNanosecond:
fn = visitor.visitTimestampNanosecond || visitor.visitTimestamp;
break;
case Type$1.Time:
fn = visitor.visitTime;
break;
case Type$1.TimeSecond:
fn = visitor.visitTimeSecond || visitor.visitTime;
break;
case Type$1.TimeMillisecond:
fn = visitor.visitTimeMillisecond || visitor.visitTime;
break;
case Type$1.TimeMicrosecond:
fn = visitor.visitTimeMicrosecond || visitor.visitTime;
break;
case Type$1.TimeNanosecond:
fn = visitor.visitTimeNanosecond || visitor.visitTime;
break;
case Type$1.Decimal:
fn = visitor.visitDecimal;
break;
case Type$1.List:
fn = visitor.visitList;
break;
case Type$1.Struct:
fn = visitor.visitStruct;
break;
case Type$1.Union:
fn = visitor