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B,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;YAC9B,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,IAAI,aAAa,EAAE;gBACtD,EAAE,SAAS,IAAI,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC7C;SACJ;QACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE;YAChD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;SAC5B;IACL,CAAC,CAAC;AACN,CAAC","file":"builder.js","sourcesContent":["// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from './vector';\nimport { BufferType } from './enum';\nimport { Data, Buffers } from './data';\nimport { createIsValidFunction } from './builder/valid';\nimport { BuilderType as B, VectorType as V} from './interfaces';\nimport { BufferBuilder, BitmapBufferBuilder, DataBufferBuilder, OffsetsBufferBuilder } from './builder/buffer';\nimport {\n DataType, strideForType,\n Float, Int, Decimal, FixedSizeBinary,\n Date_, Time, Timestamp, Interval,\n Utf8, Binary, List, Map_\n} from './type';\n\n/**\n * A set of options required to create a `Builder` instance for a given `DataType`.\n * @see {@link Builder}\n */\nexport interface BuilderOptions {\n type: T;\n nullValues?: TNull[] | ReadonlyArray | null;\n children?: { [key: string]: BuilderOptions; } | BuilderOptions[];\n}\n\n/**\n * A set of options to create an Iterable or AsyncIterable `Builder` transform function.\n * @see {@link Builder.throughIterable}\n * @see {@link Builder.throughAsyncIterable}\n */\n\nexport interface IterableBuilderOptions extends BuilderOptions {\n highWaterMark?: number;\n queueingStrategy?: 'bytes' | 'count';\n dictionaryHashFunction?: (value: any) => string | number;\n valueToChildTypeId?: (builder: Builder, value: any, offset: number) => number;\n}\n\n/**\n * An abstract base class for types that construct Arrow Vectors from arbitrary JavaScript values.\n *\n * A `Builder` is responsible for writing arbitrary JavaScript values\n * to ArrayBuffers and/or child Builders according to the Arrow specification\n * for each DataType, creating or resizing the underlying ArrayBuffers as necessary.\n *\n * The `Builder` for each Arrow `DataType` handles converting and appending\n * values for a given `DataType`. The high-level {@link Builder.new `Builder.new()`} convenience\n * method creates the specific `Builder` subclass for the supplied `DataType`.\n *\n * Once created, `Builder` instances support both appending values to the end\n * of the `Builder`, and random-access writes to specific indices\n * (`Builder.prototype.append(value)` is a convenience method for\n * `builder.set(builder.length, value)`). Appending or setting values beyond the\n * Builder's current length may cause the builder to grow its underlying buffers\n * or child Builders (if applicable) to accommodate the new values.\n *\n * After enough values have been written to a `Builder`, `Builder.prototype.flush()`\n * will commit the values to the underlying ArrayBuffers (or child Builders). The\n * internal Builder state will be reset, and an instance of `Data` is returned.\n * Alternatively, `Builder.prototype.toVector()` will flush the `Builder` and return\n * an instance of `Vector` instead.\n *\n * When there are no more values to write, use `Builder.prototype.finish()` to\n * finalize the `Builder`. This does not reset the internal state, so it is\n * necessary to call `Builder.prototype.flush()` or `toVector()` one last time\n * if there are still values queued to be flushed.\n *\n * Note: calling `Builder.prototype.finish()` is required when using a `DictionaryBuilder`,\n * because this is when it flushes the values that have been enqueued in its internal\n * dictionary's `Builder`, and creates the `dictionaryVector` for the `Dictionary` `DataType`.\n *\n * ```ts\n * import { Builder, Utf8 } from 'apache-arrow';\n *\n * const utf8Builder = Builder.new({\n * type: new Utf8(),\n * nullValues: [null, 'n/a']\n * });\n *\n * utf8Builder\n * .append('hello')\n * .append('n/a')\n * .append('world')\n * .append(null);\n *\n * const utf8Vector = utf8Builder.finish().toVector();\n *\n * console.log(utf8Vector.toJSON());\n * // > [\"hello\", null, \"world\", null]\n * ```\n *\n * @typeparam T The `DataType` of this `Builder`.\n * @typeparam TNull The type(s) of values which will be considered null-value sentinels.\n */\nexport abstract class Builder {\n\n /**\n * Create a `Builder` instance based on the `type` property of the supplied `options` object.\n * @param {BuilderOptions} options An object with a required `DataType` instance\n * and other optional parameters to be passed to the `Builder` subclass for the given `type`.\n *\n * @typeparam T The `DataType` of the `Builder` to create.\n * @typeparam TNull The type(s) of values which will be considered null-value sentinels.\n * @nocollapse\n */\n // @ts-ignore\n public static new(options: BuilderOptions): B {}\n\n /** @nocollapse */\n // @ts-ignore\n public static throughNode(options: import('./io/node/builder').BuilderDuplexOptions): import('stream').Duplex {\n throw new Error(`\"throughNode\" not available in this environment`);\n }\n /** @nocollapse */\n // @ts-ignore\n public static throughDOM(options: import('./io/whatwg/builder').BuilderTransformOptions): import('./io/whatwg/builder').BuilderTransform {\n throw new Error(`\"throughDOM\" not available in this environment`);\n }\n\n /**\n * Transform a synchronous `Iterable` of arbitrary JavaScript values into a\n * sequence of Arrow Vector following the chunking semantics defined in\n * the supplied `options` argument.\n *\n * This function returns a function that accepts an `Iterable` of values to\n * transform. When called, this function returns an Iterator of `Vector`.\n *\n * The resulting `Iterator>` yields Vectors based on the\n * `queueingStrategy` and `highWaterMark` specified in the `options` argument.\n *\n * * If `queueingStrategy` is `\"count\"` (or omitted), The `Iterator>`\n * will flush the underlying `Builder` (and yield a new `Vector`) once the\n * Builder's `length` reaches or exceeds the supplied `highWaterMark`.\n * * If `queueingStrategy` is `\"bytes\"`, the `Iterator>` will flush\n * the underlying `Builder` (and yield a new `Vector`) once its `byteLength`\n * reaches or exceeds the supplied `highWaterMark`.\n *\n * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use.\n * @returns A function which accepts a JavaScript `Iterable` of values to\n * write, and returns an `Iterator` that yields Vectors according\n * to the chunking semantics defined in the `options` argument.\n * @nocollapse\n */\n public static throughIterable(options: IterableBuilderOptions) {\n return throughIterable(options);\n }\n\n /**\n * Transform an `AsyncIterable` of arbitrary JavaScript values into a\n * sequence of Arrow Vector following the chunking semantics defined in\n * the supplied `options` argument.\n *\n * This function returns a function that accepts an `AsyncIterable` of values to\n * transform. When called, this function returns an AsyncIterator of `Vector`.\n *\n * The resulting `AsyncIterator>` yields Vectors based on the\n * `queueingStrategy` and `highWaterMark` specified in the `options` argument.\n *\n * * If `queueingStrategy` is `\"count\"` (or omitted), The `AsyncIterator>`\n * will flush the underlying `Builder` (and yield a new `Vector`) once the\n * Builder's `length` reaches or exceeds the supplied `highWaterMark`.\n * * If `queueingStrategy` is `\"bytes\"`, the `AsyncIterator>` will flush\n * the underlying `Builder` (and yield a new `Vector`) once its `byteLength`\n * reaches or exceeds the supplied `highWaterMark`.\n *\n * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use.\n * @returns A function which accepts a JavaScript `AsyncIterable` of values\n * to write, and returns an `AsyncIterator` that yields Vectors\n * according to the chunking semantics defined in the `options`\n * argument.\n * @nocollapse\n */\n public static throughAsyncIterable(options: IterableBuilderOptions) {\n return throughAsyncIterable(options);\n }\n\n /**\n * Construct a builder with the given Arrow DataType with optional null values,\n * which will be interpreted as \"null\" when set or appended to the `Builder`.\n * @param {{ type: T, nullValues?: any[] }} options A `BuilderOptions` object used to create this `Builder`.\n */\n constructor({ 'type': type, 'nullValues': nulls }: BuilderOptions) {\n this.type = type;\n this.children = [];\n this.nullValues = nulls;\n this.stride = strideForType(type);\n this._nulls = new BitmapBufferBuilder();\n if (nulls && nulls.length > 0) {\n this._isValid = createIsValidFunction(nulls);\n }\n }\n\n /**\n * The Builder's `DataType` instance.\n * @readonly\n */\n public type: T;\n /**\n * The number of values written to the `Builder` that haven't been flushed yet.\n * @readonly\n */\n public length = 0;\n /**\n * A boolean indicating whether `Builder.prototype.finish()` has been called on this `Builder`.\n * @readonly\n */\n public finished = false;\n /**\n * The number of elements in the underlying values TypedArray that\n * represent a single logical element, determined by this Builder's\n * `DataType`. This is 1 for most types, but is larger when the `DataType`\n * is `Int64`, `Uint64`, `Decimal`, `DateMillisecond`, certain variants of\n * `Interval`, `Time`, or `Timestamp`, `FixedSizeBinary`, and `FixedSizeList`.\n * @readonly\n */\n public readonly stride: number;\n public readonly children: Builder[];\n /**\n * The list of null-value sentinels for this `Builder`. When one of these values\n * is written to the `Builder` (either via `Builder.prototype.set()` or `Builder.prototype.append()`),\n * a 1-bit is written to this Builder's underlying null BitmapBufferBuilder.\n * @readonly\n */\n public readonly nullValues?: TNull[] | ReadonlyArray | null;\n\n /**\n * Flush the `Builder` and return a `Vector`.\n * @returns {Vector} A `Vector` of the flushed values.\n */\n public toVector() { return Vector.new(this.flush()); }\n\n public get ArrayType() { return this.type.ArrayType; }\n public get nullCount() { return this._nulls.numInvalid; }\n public get numChildren() { return this.children.length; }\n\n /**\n * @returns The aggregate length (in bytes) of the values that have been written.\n */\n public get byteLength(): number {\n let size = 0;\n this._offsets && (size += this._offsets.byteLength);\n this._values && (size += this._values.byteLength);\n this._nulls && (size += this._nulls.byteLength);\n this._typeIds && (size += this._typeIds.byteLength);\n return this.children.reduce((size, child) => size + child.byteLength, size);\n }\n\n /**\n * @returns The aggregate number of rows that have been reserved to write new values.\n */\n public get reservedLength(): number {\n return this._nulls.reservedLength;\n }\n\n /**\n * @returns The aggregate length (in bytes) that has been reserved to write new values.\n */\n public get reservedByteLength(): number {\n let size = 0;\n this._offsets && (size += this._offsets.reservedByteLength);\n this._values && (size += this._values.reservedByteLength);\n this._nulls && (size += this._nulls.reservedByteLength);\n this._typeIds && (size += this._typeIds.reservedByteLength);\n return this.children.reduce((size, child) => size + child.reservedByteLength, size);\n }\n\n // @ts-ignore\n protected _offsets: DataBufferBuilder;\n public get valueOffsets() { return this._offsets ? this._offsets.buffer : null; }\n\n // @ts-ignore\n protected _values: BufferBuilder;\n public get values() { return this._values ? this._values.buffer : null; }\n\n protected _nulls: BitmapBufferBuilder;\n public get nullBitmap() { return this._nulls ? this._nulls.buffer : null; }\n\n // @ts-ignore\n protected _typeIds: DataBufferBuilder;\n public get typeIds() { return this._typeIds ? this._typeIds.buffer : null; }\n\n // @ts-ignore\n protected _isValid: (value: T['TValue'] | TNull) => boolean;\n // @ts-ignore\n protected _setValue: (inst: Builder, index: number, value: T['TValue']) => void;\n\n /**\n * Appends a value (or null) to this `Builder`.\n * This is equivalent to `builder.set(builder.length, value)`.\n * @param {T['TValue'] | TNull } value The value to append.\n */\n public append(value: T['TValue'] | TNull) { return this.set(this.length, value); }\n\n /**\n * Validates whether a value is valid (true), or null (false)\n * @param {T['TValue'] | TNull } value The value to compare against null the value representations\n */\n // @ts-ignore\n public isValid(value: T['TValue'] | TNull): boolean { return this._isValid(value); }\n\n /**\n * Write a value (or null-value sentinel) at the supplied index.\n * If the value matches one of the null-value representations, a 1-bit is\n * written to the null `BitmapBufferBuilder`. Otherwise, a 0 is written to\n * the null `BitmapBufferBuilder`, and the value is passed to\n * `Builder.prototype.setValue()`.\n * @param {number} index The index of the value to write.\n * @param {T['TValue'] | TNull } value The value to write at the supplied index.\n * @returns {this} The updated `Builder` instance.\n */\n public set(index: number, value: T['TValue'] | TNull) {\n if (this.setValid(index, this.isValid(value))) {\n this.setValue(index, value);\n }\n return this;\n }\n\n /**\n * Write a value to the underlying buffers at the supplied index, bypassing\n * the null-value check. This is a low-level method that\n * @param {number} index\n * @param {T['TValue'] | TNull } value\n */\n // @ts-ignore\n public setValue(index: number, value: T['TValue']) { this._setValue(this, index, value); }\n public setValid(index: number, valid: boolean) {\n this.length = this._nulls.set(index, +valid).length;\n return valid;\n }\n\n // @ts-ignore\n public addChild(child: Builder, name = `${this.numChildren}`) {\n throw new Error(`Cannot append children to non-nested type \"${this.type}\"`);\n }\n\n /**\n * Retrieve the child `Builder` at the supplied `index`, or null if no child\n * exists at that index.\n * @param {number} index The index of the child `Builder` to retrieve.\n * @returns {Builder | null} The child Builder at the supplied index or null.\n */\n public getChildAt(index: number): Builder | null {\n return this.children[index] || null;\n }\n\n /**\n * Commit all the values that have been written to their underlying\n * ArrayBuffers, including any child Builders if applicable, and reset\n * the internal `Builder` state.\n * @returns A `Data` of the buffers and childData representing the values written.\n */\n public flush() {\n\n const buffers: any = [];\n const values = this._values;\n const offsets = this._offsets;\n const typeIds = this._typeIds;\n const { length, nullCount } = this;\n\n if (typeIds) { /* Unions */\n buffers[BufferType.TYPE] = typeIds.flush(length);\n // DenseUnions\n offsets && (buffers[BufferType.OFFSET] = offsets.flush(length));\n } else if (offsets) { /* Variable-width primitives (Binary, Utf8) and Lists */\n // Binary, Utf8\n values && (buffers[BufferType.DATA] = values.flush(offsets.last()));\n buffers[BufferType.OFFSET] = offsets.flush(length);\n } else if (values) { /* Fixed-width primitives (Int, Float, Decimal, Time, Timestamp, and Interval) */\n buffers[BufferType.DATA] = values.flush(length);\n }\n\n nullCount > 0 && (buffers[BufferType.VALIDITY] = this._nulls.flush(length));\n\n const data = Data.new(\n this.type, 0, length, nullCount, buffers as Buffers,\n this.children.map((child) => child.flush())) as Data;\n\n this.clear();\n\n return data;\n }\n\n /**\n * Finalize this `Builder`, and child builders if applicable.\n * @returns {this} The finalized `Builder` instance.\n */\n public finish() {\n this.finished = true;\n this.children.forEach((child) => child.finish());\n return this;\n }\n\n /**\n * Clear this Builder's internal state, including child Builders if applicable, and reset the length to 0.\n * @returns {this} The cleared `Builder` instance.\n */\n public clear() {\n this.length = 0;\n this._offsets && (this._offsets.clear());\n this._values && (this._values.clear());\n this._nulls && (this._nulls.clear());\n this._typeIds && (this._typeIds.clear());\n this.children.forEach((child) => child.clear());\n return this;\n }\n}\n\n(Builder.prototype as any).length = 1;\n(Builder.prototype as any).stride = 1;\n(Builder.prototype as any).children = null;\n(Builder.prototype as any).finished = false;\n(Builder.prototype as any).nullValues = null;\n(Builder.prototype as any)._isValid = () => true;\n\n/** @ignore */\nexport abstract class FixedWidthBuilder extends Builder {\n constructor(opts: BuilderOptions) {\n super(opts);\n this._values = new DataBufferBuilder(new this.ArrayType(0), this.stride);\n }\n public setValue(index: number, value: T['TValue']) {\n const values = this._values;\n values.reserve(index - values.length + 1);\n return super.setValue(index, value);\n }\n}\n\n/** @ignore */\nexport abstract class VariableWidthBuilder extends Builder {\n protected _pendingLength: number = 0;\n protected _offsets: OffsetsBufferBuilder;\n protected _pending: Map | undefined;\n constructor(opts: BuilderOptions) {\n super(opts);\n this._offsets = new OffsetsBufferBuilder();\n }\n public setValue(index: number, value: T['TValue']) {\n const pending = this._pending || (this._pending = new Map());\n const current = pending.get(index);\n current && (this._pendingLength -= current.length);\n this._pendingLength += value.length;\n pending.set(index, value);\n }\n public setValid(index: number, isValid: boolean) {\n if (!super.setValid(index, isValid)) {\n (this._pending || (this._pending = new Map())).set(index, undefined);\n return false;\n }\n return true;\n }\n public clear() {\n this._pendingLength = 0;\n this._pending = undefined;\n return super.clear();\n }\n public flush() {\n this._flush();\n return super.flush();\n }\n public finish() {\n this._flush();\n return super.finish();\n }\n protected _flush() {\n const pending = this._pending;\n const pendingLength = this._pendingLength;\n this._pendingLength = 0;\n this._pending = undefined;\n if (pending && pending.size > 0) {\n this._flushPending(pending, pendingLength);\n }\n return this;\n }\n protected abstract _flushPending(pending: Map, pendingLength: number): void;\n}\n\n/** @ignore */\ntype ThroughIterable = (source: Iterable) => IterableIterator>;\n\n/** @ignore */\nfunction throughIterable(options: IterableBuilderOptions): ThroughIterable {\n const { ['queueingStrategy']: queueingStrategy = 'count' } = options;\n const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;\n const sizeProperty: 'length' | 'byteLength' = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';\n return function*(source: Iterable) {\n let numChunks = 0;\n let builder = Builder.new(options);\n for (const value of source) {\n if (builder.append(value)[sizeProperty] >= highWaterMark) {\n ++numChunks && (yield builder.toVector());\n }\n }\n if (builder.finish().length > 0 || numChunks === 0) {\n yield builder.toVector();\n }\n };\n}\n\n/** @ignore */\ntype ThroughAsyncIterable = (source: Iterable | AsyncIterable) => AsyncIterableIterator>;\n\n/** @ignore */\nfunction throughAsyncIterable(options: IterableBuilderOptions): ThroughAsyncIterable {\n const { ['queueingStrategy']: queueingStrategy = 'count' } = options;\n const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;\n const sizeProperty: 'length' | 'byteLength' = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';\n return async function* (source: Iterable | AsyncIterable) {\n let numChunks = 0;\n let builder = Builder.new(options);\n for await (const value of source) {\n if (builder.append(value)[sizeProperty] >= highWaterMark) {\n ++numChunks && (yield builder.toVector());\n }\n }\n if (builder.finish().length > 0 || numChunks === 0) {\n yield builder.toVector();\n }\n };\n}\n"]}