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AAC,SAAS,CAAC,wBAAwB,GAAI,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,SAAS,GAAmB,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,mBAAmB,GAAS,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,YAAY,GAAgB,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,SAAS,GAAmB,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,WAAW,GAAiB,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,UAAU,GAAkB,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,gBAAgB,GAAY,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,eAAe,GAAa,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,aAAa,GAAe,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAQ,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,sBAAsB,GAAM,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,kBAAkB,GAAU,aAAa,CAAC;AACnE,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAoB,aAAa,CAAC;AAEnE,cAAc;AACd,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC","file":"toarray.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 { Data } from '../data';\nimport { Type } from '../enum';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { instance as iteratorVisitor } from './iterator';\nimport {\n    DataType, Dictionary,\n    Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n    Float, Float16, Float32, Float64,\n    Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n    Date_, DateDay, DateMillisecond,\n    Interval, IntervalDayTime, IntervalYearMonth,\n    Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n    Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n    Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface ToArrayVisitor extends Visitor {\n    visit<T extends VectorType>(node: T): T['TArray'];\n    visitMany<T extends VectorType>(nodes: T[]): T['TArray'][];\n    getVisitFn<T extends Type>(node: T): (vector: VectorType<T>) => VectorType<T>['TArray'];\n    getVisitFn<T extends DataType>(node: VectorType<T> | Data<T> | T): (vector: VectorType<T>) => VectorType<T>['TArray'];\n    visitNull                                    <T extends Null>                (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitBool                                    <T extends Bool>                (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInt                                     <T extends Int>                 (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInt8                                    <T extends Int8>                (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInt16                                   <T extends Int16>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInt32                                   <T extends Int32>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInt64                                   <T extends Int64>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUint8                                   <T extends Uint8>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUint16                                  <T extends Uint16>              (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUint32                                  <T extends Uint32>              (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUint64                                  <T extends Uint64>              (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFloat                                   <T extends Float>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFloat16                                 <T extends Float16>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFloat32                                 <T extends Float32>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFloat64                                 <T extends Float64>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUtf8                                    <T extends Utf8>                (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitBinary                                  <T extends Binary>              (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFixedSizeBinary                         <T extends FixedSizeBinary>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDate                                    <T extends Date_>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDateDay                                 <T extends DateDay>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDateMillisecond                         <T extends DateMillisecond>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimestamp                               <T extends Timestamp>           (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimestampSecond                         <T extends TimestampSecond>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimestampMillisecond                    <T extends TimestampMillisecond>(vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimestampMicrosecond                    <T extends TimestampMicrosecond>(vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimestampNanosecond                     <T extends TimestampNanosecond> (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTime                                    <T extends Time>                (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimeSecond                              <T extends TimeSecond>          (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimeMillisecond                         <T extends TimeMillisecond>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimeMicrosecond                         <T extends TimeMicrosecond>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitTimeNanosecond                          <T extends TimeNanosecond>      (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDecimal                                 <T extends Decimal>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitList                <R extends DataType, T extends List<R>>             (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitStruct                                  <T extends Struct>              (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitUnion                                   <T extends Union>               (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDenseUnion                              <T extends DenseUnion>          (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitSparseUnion                             <T extends SparseUnion>         (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitDictionary          <R extends DataType, T extends Dictionary<R>>       (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitInterval                                <T extends Interval>            (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitIntervalDayTime                         <T extends IntervalDayTime>     (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitIntervalYearMonth                       <T extends IntervalYearMonth>   (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitFixedSizeList       <R extends DataType, T extends FixedSizeList<R>>    (vector: VectorType<T>): VectorType<T>['TArray'];\n    visitMap                                     <T extends Map_>                (vector: VectorType<T>): VectorType<T>['TArray'];\n}\n\n/** @ignore */\nexport class ToArrayVisitor extends Visitor {}\n\n/** @ignore */\nfunction arrayOfVector<T extends DataType>(vector: VectorType<T>): T['TArray'] {\n\n    const { type, length, stride } = vector;\n\n    // Fast case, return subarray if possible\n    switch (type.typeId) {\n        case Type.Int:\n        case Type.Float: case Type.Decimal:\n        case Type.Time: case Type.Timestamp:\n            return vector.values.subarray(0, length * stride);\n    }\n\n    // Otherwise if not primitive, slow copy\n    return [...iteratorVisitor.visit(vector)] as T['TArray'];\n}\n\nToArrayVisitor.prototype.visitNull                 = arrayOfVector;\nToArrayVisitor.prototype.visitBool                 = arrayOfVector;\nToArrayVisitor.prototype.visitInt                  = arrayOfVector;\nToArrayVisitor.prototype.visitInt8                 = arrayOfVector;\nToArrayVisitor.prototype.visitInt16                = arrayOfVector;\nToArrayVisitor.prototype.visitInt32                = arrayOfVector;\nToArrayVisitor.prototype.visitInt64                = arrayOfVector;\nToArrayVisitor.prototype.visitUint8                = arrayOfVector;\nToArrayVisitor.prototype.visitUint16               = arrayOfVector;\nToArrayVisitor.prototype.visitUint32               = arrayOfVector;\nToArrayVisitor.prototype.visitUint64               = arrayOfVector;\nToArrayVisitor.prototype.visitFloat                = arrayOfVector;\nToArrayVisitor.prototype.visitFloat16              = arrayOfVector;\nToArrayVisitor.prototype.visitFloat32              = arrayOfVector;\nToArrayVisitor.prototype.visitFloat64              = arrayOfVector;\nToArrayVisitor.prototype.visitUtf8                 = arrayOfVector;\nToArrayVisitor.prototype.visitBinary               = arrayOfVector;\nToArrayVisitor.prototype.visitFixedSizeBinary      = arrayOfVector;\nToArrayVisitor.prototype.visitDate                 = arrayOfVector;\nToArrayVisitor.prototype.visitDateDay              = arrayOfVector;\nToArrayVisitor.prototype.visitDateMillisecond      = arrayOfVector;\nToArrayVisitor.prototype.visitTimestamp            = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampSecond      = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampMillisecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampMicrosecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampNanosecond  = arrayOfVector;\nToArrayVisitor.prototype.visitTime                 = arrayOfVector;\nToArrayVisitor.prototype.visitTimeSecond           = arrayOfVector;\nToArrayVisitor.prototype.visitTimeMillisecond      = arrayOfVector;\nToArrayVisitor.prototype.visitTimeMicrosecond      = arrayOfVector;\nToArrayVisitor.prototype.visitTimeNanosecond       = arrayOfVector;\nToArrayVisitor.prototype.visitDecimal              = arrayOfVector;\nToArrayVisitor.prototype.visitList                 = arrayOfVector;\nToArrayVisitor.prototype.visitStruct               = arrayOfVector;\nToArrayVisitor.prototype.visitUnion                = arrayOfVector;\nToArrayVisitor.prototype.visitDenseUnion           = arrayOfVector;\nToArrayVisitor.prototype.visitSparseUnion          = arrayOfVector;\nToArrayVisitor.prototype.visitDictionary           = arrayOfVector;\nToArrayVisitor.prototype.visitInterval             = arrayOfVector;\nToArrayVisitor.prototype.visitIntervalDayTime      = arrayOfVector;\nToArrayVisitor.prototype.visitIntervalYearMonth    = arrayOfVector;\nToArrayVisitor.prototype.visitFixedSizeList        = arrayOfVector;\nToArrayVisitor.prototype.visitMap                  = arrayOfVector;\n\n/** @ignore */\nexport const instance = new ToArrayVisitor();\n"]}