@jpmorganchase/perspective-examples
Version:
1,260 lines (1,166 loc) • 1.74 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("tslib"), require("babel-runtime/core-js/symbol/iterator"), require("babel-runtime/core-js/get-iterator"), require("babel-runtime/core-js/json/stringify"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/core-js/object/create"), require("babel-runtime/core-js/map"), require("flatbuffers"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("babel-runtime/helpers/typeof"), require("babel-runtime/core-js/object/define-property"), require("babel-runtime/core-js/symbol/to-string-tag"), require("text-encoding-utf-8"), require("papaparse"), require("fs"), require("path"), require("babel-runtime/core-js/object/get-own-property-names"), require("babel-runtime/helpers/defineProperty"), require("babel-runtime/helpers/extends"), require("babel-runtime/core-js/number/parse-int"), require("babel-runtime/core-js/promise"), require("babel-runtime/regenerator"), require("babel-runtime/helpers/asyncToGenerator"), require("babel-runtime/core-js/object/keys"), require("moment"), require("babel-runtime/core-js/object/entries"), require("babel-runtime/core-js/symbol"), require("babel-runtime/core-js/object/assign"), require("http"), require("ws"));
else if(typeof define === 'function' && define.amd)
define(["tslib", "babel-runtime/core-js/symbol/iterator", "babel-runtime/core-js/get-iterator", "babel-runtime/core-js/json/stringify", "babel-runtime/helpers/classCallCheck", "babel-runtime/helpers/createClass", "babel-runtime/core-js/object/create", "babel-runtime/core-js/map", "flatbuffers", "babel-runtime/core-js/object/get-prototype-of", "babel-runtime/helpers/possibleConstructorReturn", "babel-runtime/helpers/inherits", "babel-runtime/helpers/typeof", "babel-runtime/core-js/object/define-property", "babel-runtime/core-js/symbol/to-string-tag", "text-encoding-utf-8", "papaparse", "fs", "path", "babel-runtime/core-js/object/get-own-property-names", "babel-runtime/helpers/defineProperty", "babel-runtime/helpers/extends", "babel-runtime/core-js/number/parse-int", "babel-runtime/core-js/promise", "babel-runtime/regenerator", "babel-runtime/helpers/asyncToGenerator", "babel-runtime/core-js/object/keys", "moment", "babel-runtime/core-js/object/entries", "babel-runtime/core-js/symbol", "babel-runtime/core-js/object/assign", "http", "ws"], factory);
else {
var a = typeof exports === 'object' ? factory(require("tslib"), require("babel-runtime/core-js/symbol/iterator"), require("babel-runtime/core-js/get-iterator"), require("babel-runtime/core-js/json/stringify"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/core-js/object/create"), require("babel-runtime/core-js/map"), require("flatbuffers"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("babel-runtime/helpers/typeof"), require("babel-runtime/core-js/object/define-property"), require("babel-runtime/core-js/symbol/to-string-tag"), require("text-encoding-utf-8"), require("papaparse"), require("fs"), require("path"), require("babel-runtime/core-js/object/get-own-property-names"), require("babel-runtime/helpers/defineProperty"), require("babel-runtime/helpers/extends"), require("babel-runtime/core-js/number/parse-int"), require("babel-runtime/core-js/promise"), require("babel-runtime/regenerator"), require("babel-runtime/helpers/asyncToGenerator"), require("babel-runtime/core-js/object/keys"), require("moment"), require("babel-runtime/core-js/object/entries"), require("babel-runtime/core-js/symbol"), require("babel-runtime/core-js/object/assign"), require("http"), require("ws")) : factory(root["tslib"], root["babel-runtime/core-js/symbol/iterator"], root["babel-runtime/core-js/get-iterator"], root["babel-runtime/core-js/json/stringify"], root["babel-runtime/helpers/classCallCheck"], root["babel-runtime/helpers/createClass"], root["babel-runtime/core-js/object/create"], root["babel-runtime/core-js/map"], root["flatbuffers"], root["babel-runtime/core-js/object/get-prototype-of"], root["babel-runtime/helpers/possibleConstructorReturn"], root["babel-runtime/helpers/inherits"], root["babel-runtime/helpers/typeof"], root["babel-runtime/core-js/object/define-property"], root["babel-runtime/core-js/symbol/to-string-tag"], root["text-encoding-utf-8"], root["papaparse"], root["fs"], root["path"], root["babel-runtime/core-js/object/get-own-property-names"], root["babel-runtime/helpers/defineProperty"], root["babel-runtime/helpers/extends"], root["babel-runtime/core-js/number/parse-int"], root["babel-runtime/core-js/promise"], root["babel-runtime/regenerator"], root["babel-runtime/helpers/asyncToGenerator"], root["babel-runtime/core-js/object/keys"], root["moment"], root["babel-runtime/core-js/object/entries"], root["babel-runtime/core-js/symbol"], root["babel-runtime/core-js/object/assign"], root["http"], root["ws"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_10__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_13__, __WEBPACK_EXTERNAL_MODULE_14__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_18__, __WEBPACK_EXTERNAL_MODULE_19__, __WEBPACK_EXTERNAL_MODULE_20__, __WEBPACK_EXTERNAL_MODULE_21__, __WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_23__, __WEBPACK_EXTERNAL_MODULE_26__, __WEBPACK_EXTERNAL_MODULE_27__, __WEBPACK_EXTERNAL_MODULE_28__, __WEBPACK_EXTERNAL_MODULE_29__, __WEBPACK_EXTERNAL_MODULE_35__, __WEBPACK_EXTERNAL_MODULE_36__, __WEBPACK_EXTERNAL_MODULE_37__, __WEBPACK_EXTERNAL_MODULE_38__, __WEBPACK_EXTERNAL_MODULE_39__, __WEBPACK_EXTERNAL_MODULE_40__, __WEBPACK_EXTERNAL_MODULE_41__, __WEBPACK_EXTERNAL_MODULE_42__, __WEBPACK_EXTERNAL_MODULE_45__, __WEBPACK_EXTERNAL_MODULE_54__, __WEBPACK_EXTERNAL_MODULE_59__, __WEBPACK_EXTERNAL_MODULE_61__, __WEBPACK_EXTERNAL_MODULE_62__, __WEBPACK_EXTERNAL_MODULE_63__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 30);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Dictionary = exports.Map_ = exports.FixedSizeList = exports.FixedSizeBinary = exports.SparseUnion = exports.DenseUnion = exports.Union = exports.Struct = exports.List = exports.Interval = exports.Timestamp = exports.Time = exports.Date_ = exports.Decimal = exports.Bool = exports.Utf8 = exports.Binary = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Null = exports.DataType = exports.Type = exports.Field = exports.Schema = exports.MetadataVersion = exports.MessageHeader = exports.IntervalUnit = exports.VectorType = exports.UnionMode = exports.Precision = exports.TimeUnit = exports.DateUnit = exports.ArrowType = exports.Long = undefined;
var _defineProperty = __webpack_require__(22);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
var _toStringTag = __webpack_require__(23);
var _toStringTag2 = _interopRequireDefault(_toStringTag);
var _create = __webpack_require__(13);
var _create2 = _interopRequireDefault(_create);
var _map = __webpack_require__(14);
var _map2 = _interopRequireDefault(_map);
var _tslib = __webpack_require__(0);
var tslib_1 = _interopRequireWildcard(_tslib);
var _Schema = __webpack_require__(5);
var Schema_ = _interopRequireWildcard(_Schema);
var _Message = __webpack_require__(24);
var Message_ = _interopRequireWildcard(_Message);
var _flatbuffers = __webpack_require__(15);
var _metadata = __webpack_require__(7);
var _visitor = __webpack_require__(8);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
var Long = exports.Long = _flatbuffers.flatbuffers.Long;
var ArrowType = exports.ArrowType = Schema_.org.apache.arrow.flatbuf.Type;
var DateUnit = exports.DateUnit = Schema_.org.apache.arrow.flatbuf.DateUnit;
var TimeUnit = exports.TimeUnit = Schema_.org.apache.arrow.flatbuf.TimeUnit;
var Precision = exports.Precision = Schema_.org.apache.arrow.flatbuf.Precision;
var UnionMode = exports.UnionMode = Schema_.org.apache.arrow.flatbuf.UnionMode;
var VectorType = exports.VectorType = Schema_.org.apache.arrow.flatbuf.VectorType;
var IntervalUnit = exports.IntervalUnit = Schema_.org.apache.arrow.flatbuf.IntervalUnit;
var MessageHeader = exports.MessageHeader = Message_.org.apache.arrow.flatbuf.MessageHeader;
var MetadataVersion = exports.MetadataVersion = Schema_.org.apache.arrow.flatbuf.MetadataVersion;
var Schema = /** @class */function () {
function Schema(fields, metadata, version, dictionaries) {
if (version === void 0) {
version = MetadataVersion.V4;
}
if (dictionaries === void 0) {
dictionaries = new _map2.default();
}
this.fields = fields;
this.version = version;
this.metadata = metadata;
this.dictionaries = dictionaries;
}
Schema.from = function (vectors) {
return new Schema(vectors.map(function (v, i) {
return new Field('' + i, v.type);
}));
};
Object.defineProperty(Schema.prototype, "bodyLength", {
get: function get() {
return this._bodyLength;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Schema.prototype, "headerType", {
get: function get() {
return this._headerType;
},
enumerable: true,
configurable: true
});
Schema.prototype.select = function () {
var fieldNames = [];
for (var _i = 0; _i < arguments.length; _i++) {
fieldNames[_i] = arguments[_i];
}
var namesToKeep = fieldNames.reduce(function (xs, x) {
return (xs[x] = true) && xs;
}, (0, _create2.default)(null));
var newDictFields = new _map2.default(),
newFields = this.fields.filter(function (f) {
return namesToKeep[f.name];
});
this.dictionaries.forEach(function (f, dictId) {
return namesToKeep[f.name] && newDictFields.set(dictId, f);
});
return new Schema(newFields, this.metadata, this.version, newDictFields);
};
Schema[_toStringTag2.default] = function (prototype) {
prototype._bodyLength = 0;
prototype._headerType = MessageHeader.Schema;
return 'Schema';
}(Schema.prototype);
return Schema;
}();
exports.Schema = Schema;
var Field = /** @class */function () {
function Field(name, type, nullable, metadata) {
if (nullable === void 0) {
nullable = false;
}
this.name = name;
this.type = type;
this.nullable = nullable;
this.metadata = metadata;
}
Field.prototype.toString = function () {
return this.name + ": " + this.type;
};
Object.defineProperty(Field.prototype, "typeId", {
get: function get() {
return this.type.TType;
},
enumerable: true,
configurable: true
});
(0, _defineProperty2.default)(Field.prototype, _toStringTag2.default, {
get: function get() {
return 'Field';
},
enumerable: true,
configurable: true
});
Object.defineProperty(Field.prototype, "indices", {
get: function get() {
return DataType.isDictionary(this.type) ? this.type.indices : this.type;
},
enumerable: true,
configurable: true
});
return Field;
}();
exports.Field = Field;
/**
* *
* Main data type enumeration:
* *
* Data types in this library are all *logical*. They can be expressed as
* either a primitive physical type (bytes or bits of some fixed size), a
* nested type consisting of other data types, or another data type (e.g. a
* timestamp encoded as an int64)
*/
var Type = exports.Type = undefined;
(function (Type) {
Type[Type["NONE"] = 0] = "NONE";
Type[Type["Null"] = 1] = "Null";
Type[Type["Int"] = 2] = "Int";
Type[Type["Float"] = 3] = "Float";
Type[Type["Binary"] = 4] = "Binary";
Type[Type["Utf8"] = 5] = "Utf8";
Type[Type["Bool"] = 6] = "Bool";
Type[Type["Decimal"] = 7] = "Decimal";
Type[Type["Date"] = 8] = "Date";
Type[Type["Time"] = 9] = "Time";
Type[Type["Timestamp"] = 10] = "Timestamp";
Type[Type["Interval"] = 11] = "Interval";
Type[Type["List"] = 12] = "List";
Type[Type["Struct"] = 13] = "Struct";
Type[Type["Union"] = 14] = "Union";
Type[Type["FixedSizeBinary"] = 15] = "FixedSizeBinary";
Type[Type["FixedSizeList"] = 16] = "FixedSizeList";
Type[Type["Map"] = 17] = "Map";
Type["Dictionary"] = "Dictionary";
Type["DenseUnion"] = "DenseUnion";
Type["SparseUnion"] = "SparseUnion";
})(Type || (exports.Type = Type = {}));
var DataType = /** @class */function () {
function DataType(TType, children) {
this.TType = TType;
this.children = children;
}
DataType.isNull = function (x) {
return x && x.TType === Type.Null;
};
DataType.isInt = function (x) {
return x && x.TType === Type.Int;
};
DataType.isFloat = function (x) {
return x && x.TType === Type.Float;
};
DataType.isBinary = function (x) {
return x && x.TType === Type.Binary;
};
DataType.isUtf8 = function (x) {
return x && x.TType === Type.Utf8;
};
DataType.isBool = function (x) {
return x && x.TType === Type.Bool;
};
DataType.isDecimal = function (x) {
return x && x.TType === Type.Decimal;
};
DataType.isDate = function (x) {
return x && x.TType === Type.Date;
};
DataType.isTime = function (x) {
return x && x.TType === Type.Time;
};
DataType.isTimestamp = function (x) {
return x && x.TType === Type.Timestamp;
};
DataType.isInterval = function (x) {
return x && x.TType === Type.Interval;
};
DataType.isList = function (x) {
return x && x.TType === Type.List;
};
DataType.isStruct = function (x) {
return x && x.TType === Type.Struct;
};
DataType.isUnion = function (x) {
return x && x.TType === Type.Union;
};
DataType.isDenseUnion = function (x) {
return x && x.TType === Type.DenseUnion;
};
DataType.isSparseUnion = function (x) {
return x && x.TType === Type.SparseUnion;
};
DataType.isFixedSizeBinary = function (x) {
return x && x.TType === Type.FixedSizeBinary;
};
DataType.isFixedSizeList = function (x) {
return x && x.TType === Type.FixedSizeList;
};
DataType.isMap = function (x) {
return x && x.TType === Type.Map;
};
DataType.isDictionary = function (x) {
return x && x.TType === Type.Dictionary;
};
DataType.prototype.acceptTypeVisitor = function (visitor) {
return _visitor.TypeVisitor.visitTypeInline(visitor, this);
};
DataType[_toStringTag2.default] = function (proto) {
proto.ArrayType = Array;
return proto[_toStringTag2.default] = 'DataType';
}(DataType.prototype);
return DataType;
}();
exports.DataType = DataType;
var Null = /** @class */function (_super) {
tslib_1.__extends(Null, _super);
function Null() {
return _super.call(this, Type.Null) || this;
}
Null.prototype.toString = function () {
return "Null";
};
Null[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Null';
}(Null.prototype);
return Null;
}(DataType);
exports.Null = Null;
var Int = /** @class */function (_super) {
tslib_1.__extends(Int, _super);
function Int(isSigned, bitWidth) {
var _this = _super.call(this, Type.Int) || this;
_this.isSigned = isSigned;
_this.bitWidth = bitWidth;
return _this;
}
Object.defineProperty(Int.prototype, "ArrayType", {
get: function get() {
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 ? Int32Array : Uint32Array;
}
throw new Error("Unrecognized " + this[_toStringTag2.default] + " type");
},
enumerable: true,
configurable: true
});
Int.prototype.toString = function () {
return (this.isSigned ? "I" : "Ui") + "nt" + this.bitWidth;
};
Int[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Int';
}(Int.prototype);
return Int;
}(DataType);
exports.Int = Int;
var Int8 = /** @class */function (_super) {
tslib_1.__extends(Int8, _super);
function Int8() {
return _super.call(this, true, 8) || this;
}
return Int8;
}(Int);
exports.Int8 = Int8;
var Int16 = /** @class */function (_super) {
tslib_1.__extends(Int16, _super);
function Int16() {
return _super.call(this, true, 16) || this;
}
return Int16;
}(Int);
exports.Int16 = Int16;
var Int32 = /** @class */function (_super) {
tslib_1.__extends(Int32, _super);
function Int32() {
return _super.call(this, true, 32) || this;
}
return Int32;
}(Int);
exports.Int32 = Int32;
var Int64 = /** @class */function (_super) {
tslib_1.__extends(Int64, _super);
function Int64() {
return _super.call(this, true, 64) || this;
}
return Int64;
}(Int);
exports.Int64 = Int64;
var Uint8 = /** @class */function (_super) {
tslib_1.__extends(Uint8, _super);
function Uint8() {
return _super.call(this, false, 8) || this;
}
return Uint8;
}(Int);
exports.Uint8 = Uint8;
var Uint16 = /** @class */function (_super) {
tslib_1.__extends(Uint16, _super);
function Uint16() {
return _super.call(this, false, 16) || this;
}
return Uint16;
}(Int);
exports.Uint16 = Uint16;
var Uint32 = /** @class */function (_super) {
tslib_1.__extends(Uint32, _super);
function Uint32() {
return _super.call(this, false, 32) || this;
}
return Uint32;
}(Int);
exports.Uint32 = Uint32;
var Uint64 = /** @class */function (_super) {
tslib_1.__extends(Uint64, _super);
function Uint64() {
return _super.call(this, false, 64) || this;
}
return Uint64;
}(Int);
exports.Uint64 = Uint64;
var Float = /** @class */function (_super) {
tslib_1.__extends(Float, _super);
function Float(precision) {
var _this = _super.call(this, Type.Float) || this;
_this.precision = precision;
return _this;
}
Object.defineProperty(Float.prototype, "ArrayType", {
// @ts-ignore
get: function get() {
switch (this.precision) {
case Precision.HALF:
return Uint16Array;
case Precision.SINGLE:
return Float32Array;
case Precision.DOUBLE:
return Float64Array;
}
throw new Error("Unrecognized " + this[_toStringTag2.default] + " type");
},
enumerable: true,
configurable: true
});
Float.prototype.toString = function () {
return "Float" + (this.precision << 5 || 16);
};
Float[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Float';
}(Float.prototype);
return Float;
}(DataType);
exports.Float = Float;
var Float16 = /** @class */function (_super) {
tslib_1.__extends(Float16, _super);
function Float16() {
return _super.call(this, Precision.HALF) || this;
}
return Float16;
}(Float);
exports.Float16 = Float16;
var Float32 = /** @class */function (_super) {
tslib_1.__extends(Float32, _super);
function Float32() {
return _super.call(this, Precision.SINGLE) || this;
}
return Float32;
}(Float);
exports.Float32 = Float32;
var Float64 = /** @class */function (_super) {
tslib_1.__extends(Float64, _super);
function Float64() {
return _super.call(this, Precision.DOUBLE) || this;
}
return Float64;
}(Float);
exports.Float64 = Float64;
var Binary = /** @class */function (_super) {
tslib_1.__extends(Binary, _super);
function Binary() {
return _super.call(this, Type.Binary) || this;
}
Binary.prototype.toString = function () {
return "Binary";
};
Binary[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint8Array;
return proto[_toStringTag2.default] = 'Binary';
}(Binary.prototype);
return Binary;
}(DataType);
exports.Binary = Binary;
var Utf8 = /** @class */function (_super) {
tslib_1.__extends(Utf8, _super);
function Utf8() {
return _super.call(this, Type.Utf8) || this;
}
Utf8.prototype.toString = function () {
return "Utf8";
};
Utf8[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint8Array;
return proto[_toStringTag2.default] = 'Utf8';
}(Utf8.prototype);
return Utf8;
}(DataType);
exports.Utf8 = Utf8;
var Bool = /** @class */function (_super) {
tslib_1.__extends(Bool, _super);
function Bool() {
return _super.call(this, Type.Bool) || this;
}
Bool.prototype.toString = function () {
return "Bool";
};
Bool[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint8Array;
return proto[_toStringTag2.default] = 'Bool';
}(Bool.prototype);
return Bool;
}(DataType);
exports.Bool = Bool;
var Decimal = /** @class */function (_super) {
tslib_1.__extends(Decimal, _super);
function Decimal(scale, precision) {
var _this = _super.call(this, Type.Decimal) || this;
_this.scale = scale;
_this.precision = precision;
return _this;
}
Decimal.prototype.toString = function () {
return "Decimal[" + this.precision + "e" + (this.scale > 0 ? "+" : "") + this.scale + "]";
};
Decimal[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint32Array;
return proto[_toStringTag2.default] = 'Decimal';
}(Decimal.prototype);
return Decimal;
}(DataType);
exports.Decimal = Decimal;
var Date_ = /** @class */function (_super) {
tslib_1.__extends(Date_, _super);
function Date_(unit) {
var _this = _super.call(this, Type.Date) || this;
_this.unit = unit;
return _this;
}
Date_.prototype.toString = function () {
return "Date" + (this.unit + 1) * 32 + "<" + DateUnit[this.unit] + ">";
};
Date_[_toStringTag2.default] = function (proto) {
proto.ArrayType = Int32Array;
return proto[_toStringTag2.default] = 'Date';
}(Date_.prototype);
return Date_;
}(DataType);
exports.Date_ = Date_;
var Time = /** @class */function (_super) {
tslib_1.__extends(Time, _super);
function Time(unit, bitWidth) {
var _this = _super.call(this, Type.Time) || this;
_this.unit = unit;
_this.bitWidth = bitWidth;
return _this;
}
Time.prototype.toString = function () {
return "Time" + this.bitWidth + "<" + TimeUnit[this.unit] + ">";
};
Time[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint32Array;
return proto[_toStringTag2.default] = 'Time';
}(Time.prototype);
return Time;
}(DataType);
exports.Time = Time;
var Timestamp = /** @class */function (_super) {
tslib_1.__extends(Timestamp, _super);
function Timestamp(unit, timezone) {
var _this = _super.call(this, Type.Timestamp) || this;
_this.unit = unit;
_this.timezone = timezone;
return _this;
}
Timestamp.prototype.toString = function () {
return "Timestamp<" + TimeUnit[this.unit] + (this.timezone ? ", " + this.timezone : "") + ">";
};
Timestamp[_toStringTag2.default] = function (proto) {
proto.ArrayType = Int32Array;
return proto[_toStringTag2.default] = 'Timestamp';
}(Timestamp.prototype);
return Timestamp;
}(DataType);
exports.Timestamp = Timestamp;
var Interval = /** @class */function (_super) {
tslib_1.__extends(Interval, _super);
function Interval(unit) {
var _this = _super.call(this, Type.Interval) || this;
_this.unit = unit;
return _this;
}
Interval.prototype.toString = function () {
return "Interval<" + IntervalUnit[this.unit] + ">";
};
Interval[_toStringTag2.default] = function (proto) {
proto.ArrayType = Int32Array;
return proto[_toStringTag2.default] = 'Interval';
}(Interval.prototype);
return Interval;
}(DataType);
exports.Interval = Interval;
var List = /** @class */function (_super) {
tslib_1.__extends(List, _super);
function List(children) {
var _this = _super.call(this, Type.List, children) || this;
_this.children = children;
return _this;
}
List.prototype.toString = function () {
return "List<" + this.valueType + ">";
};
Object.defineProperty(List.prototype, "ArrayType", {
get: function get() {
return this.valueType.ArrayType;
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "valueType", {
get: function get() {
return this.children[0].type;
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "valueField", {
get: function get() {
return this.children[0];
},
enumerable: true,
configurable: true
});
List[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'List';
}(List.prototype);
return List;
}(DataType);
exports.List = List;
var Struct = /** @class */function (_super) {
tslib_1.__extends(Struct, _super);
function Struct(children) {
var _this = _super.call(this, Type.Struct, children) || this;
_this.children = children;
return _this;
}
Struct.prototype.toString = function () {
return "Struct<" + this.children.map(function (f) {
return f.type;
}).join(", ") + ">";
};
Struct[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Struct';
}(Struct.prototype);
return Struct;
}(DataType);
exports.Struct = Struct;
var Union = /** @class */function (_super) {
tslib_1.__extends(Union, _super);
function Union(mode, typeIds, children) {
var _this = _super.call(this, mode === UnionMode.Sparse ? Type.SparseUnion : Type.DenseUnion, children) || this;
_this.mode = mode;
_this.typeIds = typeIds;
_this.children = children;
return _this;
}
Union.prototype.toString = function () {
return this[_toStringTag2.default] + "<" + this.typeIds.map(function (x) {
return Type[x];
}).join(" | ") + ">";
};
Union[_toStringTag2.default] = function (proto) {
proto.ArrayType = Int8Array;
return proto[_toStringTag2.default] = 'Union';
}(Union.prototype);
return Union;
}(DataType);
exports.Union = Union;
var DenseUnion = /** @class */function (_super) {
tslib_1.__extends(DenseUnion, _super);
function DenseUnion(typeIds, children) {
return _super.call(this, UnionMode.Dense, typeIds, children) || this;
}
DenseUnion[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'DenseUnion';
}(DenseUnion.prototype);
return DenseUnion;
}(Union);
exports.DenseUnion = DenseUnion;
var SparseUnion = /** @class */function (_super) {
tslib_1.__extends(SparseUnion, _super);
function SparseUnion(typeIds, children) {
return _super.call(this, UnionMode.Sparse, typeIds, children) || this;
}
SparseUnion[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'SparseUnion';
}(SparseUnion.prototype);
return SparseUnion;
}(Union);
exports.SparseUnion = SparseUnion;
var FixedSizeBinary = /** @class */function (_super) {
tslib_1.__extends(FixedSizeBinary, _super);
function FixedSizeBinary(byteWidth) {
var _this = _super.call(this, Type.FixedSizeBinary) || this;
_this.byteWidth = byteWidth;
return _this;
}
FixedSizeBinary.prototype.toString = function () {
return "FixedSizeBinary[" + this.byteWidth + "]";
};
FixedSizeBinary[_toStringTag2.default] = function (proto) {
proto.ArrayType = Uint8Array;
return proto[_toStringTag2.default] = 'FixedSizeBinary';
}(FixedSizeBinary.prototype);
return FixedSizeBinary;
}(DataType);
exports.FixedSizeBinary = FixedSizeBinary;
var FixedSizeList = /** @class */function (_super) {
tslib_1.__extends(FixedSizeList, _super);
function FixedSizeList(listSize, children) {
var _this = _super.call(this, Type.FixedSizeList, children) || this;
_this.listSize = listSize;
_this.children = children;
return _this;
}
Object.defineProperty(FixedSizeList.prototype, "ArrayType", {
get: function get() {
return this.valueType.ArrayType;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FixedSizeList.prototype, "valueType", {
get: function get() {
return this.children[0].type;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FixedSizeList.prototype, "valueField", {
get: function get() {
return this.children[0];
},
enumerable: true,
configurable: true
});
FixedSizeList.prototype.toString = function () {
return "FixedSizeList[" + this.listSize + "]<" + this.valueType + ">";
};
FixedSizeList[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'FixedSizeList';
}(FixedSizeList.prototype);
return FixedSizeList;
}(DataType);
exports.FixedSizeList = FixedSizeList;
var Map_ = /** @class */function (_super) {
tslib_1.__extends(Map_, _super);
function Map_(keysSorted, children) {
var _this = _super.call(this, Type.Map, children) || this;
_this.keysSorted = keysSorted;
_this.children = children;
return _this;
}
Map_.prototype.toString = function () {
return "Map<" + this.children.join(", ") + ">";
};
Map_[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Map_';
}(Map_.prototype);
return Map_;
}(DataType);
exports.Map_ = Map_;
var Dictionary = /** @class */function (_super) {
tslib_1.__extends(Dictionary, _super);
function Dictionary(dictionary, indices, id, isOrdered) {
var _this = _super.call(this, Type.Dictionary) || this;
_this.indices = indices;
_this.dictionary = dictionary;
_this.isOrdered = isOrdered || false;
_this.id = id == null ? _metadata.DictionaryBatch.getId() : typeof id === 'number' ? id : id.low;
return _this;
}
Object.defineProperty(Dictionary.prototype, "ArrayType", {
get: function get() {
return this.dictionary.ArrayType;
},
enumerable: true,
configurable: true
});
Dictionary.prototype.toString = function () {
return "Dictionary<" + this.indices + ", " + this.dictionary + ">";
};
Dictionary[_toStringTag2.default] = function (proto) {
return proto[_toStringTag2.default] = 'Dictionary';
}(Dictionary.prototype);
return Dictionary;
}(DataType);
exports.Dictionary = Dictionary;
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createVector = exports.DictionaryVector = exports.UnionVector = exports.StructVector = exports.MapVector = exports.FixedSizeListVector = exports.ListVector = exports.Utf8Vector = exports.FixedSizeBinaryVector = exports.BinaryVector = exports.IntervalVector = exports.TimestampVector = exports.TimeVector = exports.DecimalVector = exports.DateVector = exports.FloatVector = exports.IntVector = exports.BoolVector = exports.NullVector = exports.NestedVector = exports.ListVectorBase = exports.FlatVector = exports.Vector = undefined;
var _getIterator2 = __webpack_require__(4);
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _iterator = __webpack_require__(2);
var _iterator2 = _interopRequireDefault(_iterator);
var _toStringTag = __webpack_require__(23);
var _toStringTag2 = _interopRequireDefault(_toStringTag);
var _defineProperty = __webpack_require__(22);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
var _tslib = __webpack_require__(0);
var tslib_1 = _interopRequireWildcard(_tslib);
var _data = __webpack_require__(9);
var _visitor = __webpack_require__(8);
var _type2 = __webpack_require__(1);
var _chunked = __webpack_require__(25);
var _dictionary = __webpack_require__(47);
var _list = __webpack_require__(48);
var _nested = __webpack_require__(49);
var _flat = __webpack_require__(50);
var _bit = __webpack_require__(6);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Vector = /** @class */function () {
function Vector(data, view) {
this.data = data;
this.type = data.type;
this.length = data.length;
var nulls;
if (data instanceof _data.ChunkedData && !(view instanceof _chunked.ChunkedView)) {
this.view = new _chunked.ChunkedView(data);
} else if (!(view instanceof _flat.ValidityView) && (nulls = data.nullBitmap) && nulls.length > 0 && data.nullCount > 0) {
this.view = new _flat.ValidityView(data, view);
} else {
this.view = view;
}
}
Vector.create = function (data) {
return createVector(data);
};
Vector.concat = function (source) {
var others = [];
for (var _i = 1; _i < arguments.length; _i++) {
others[_i - 1] = arguments[_i];
}
return others.reduce(function (a, b) {
return a ? a.concat(b) : b;
}, source);
};
Object.defineProperty(Vector.prototype, "nullCount", {
get: function get() {
return this.data.nullCount;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Vector.prototype, "nullBitmap", {
get: function get() {
return this.data.nullBitmap;
},
enumerable: true,
configurable: true
});
(0, _defineProperty2.default)(Vector.prototype, _toStringTag2.default, {
get: function get() {
return "Vector<" + this.type[_toStringTag2.default] + ">";
},
enumerable: true,
configurable: true
});
Vector.prototype.toJSON = function () {
return this.toArray();
};
Vector.prototype.clone = function (data, view) {
if (view === void 0) {
view = this.view.clone(data);
}
return new this.constructor(data, view);
};
Vector.prototype.isValid = function (index) {
return this.view.isValid(index);
};
Vector.prototype.get = function (index) {
return this.view.get(index);
};
Vector.prototype.set = function (index, value) {
return this.view.set(index, value);
};
Vector.prototype.toArray = function () {
return this.view.toArray();
};
Vector.prototype.indexOf = function (value) {
return this.view.indexOf(value);
};
Vector.prototype[_iterator2.default] = function () {
return (0, _getIterator3.default)(this.view);
};
Vector.prototype.concat = function () {
var others = [];
for (var _i = 0; _i < arguments.length; _i++) {
others[_i] = arguments[_i];
}
if ((others = others.filter(Boolean)).length === 0) {
return this;
}
var view = this.view;
var vecs = !(view instanceof _chunked.ChunkedView) ? tslib_1.__spread([this], others) : tslib_1.__spread(view.chunkVectors, others);
var offsets = _data.ChunkedData.computeOffsets(vecs);
var chunksLength = offsets[offsets.length - 1];
var chunkedData = new _data.ChunkedData(this.type, chunksLength, vecs, 0, -1, offsets);
return this.clone(chunkedData, new _chunked.ChunkedView(chunkedData));
};
Vector.prototype.slice = function (begin, end) {
var length = this.length;
var size = this.view.size || 1;
var total = length,
from = (begin || 0) * size;
var to = (typeof end === 'number' ? end : total) * size;
if (to < 0) {
to = total - to * -1 % total;
}
if (from < 0) {
from = total - from * -1 % total;
}
if (to < from) {
_a = tslib_1.__read([to, from], 2), from = _a[0], to = _a[1];
}
total = !isFinite(total = to - from) || total < 0 ? 0 : total;
var slicedData = this.data.slice(from, Math.min(total, length));
return this.clone(slicedData, this.view.clone(slicedData));
var _a;
};
Vector.prototype.acceptTypeVisitor = function (visitor) {
return _visitor.TypeVisitor.visitTypeInline(visitor, this.type);
};
Vector.prototype.acceptVectorVisitor = function (visitor) {
return _visitor.VectorVisitor.visitTypeInline(visitor, this.type, this);
};
return Vector;
}(); // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
exports.Vector = Vector;
var FlatVector = /** @class */function (_super) {
tslib_1.__extends(FlatVector, _super);
function FlatVector() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(FlatVector.prototype, "values", {
get: function get() {
return this.data.values;
},
enumerable: true,
configurable: true
});
FlatVector.prototype.lows = function () {
return this.asInt32(0, 2);
};
FlatVector.prototype.highs = function () {
return this.asInt32(1, 2);
};
FlatVector.prototype.asInt32 = function (offset, stride) {
if (offset === void 0) {
offset = 0;
}
if (stride === void 0) {
stride = 2;
}
var data = this.data.clone(new _type2.Int32());
if (offset > 0) {
data = data.slice(offset, this.length - offset);
}
var int32s = new IntVector(data, new _flat.PrimitiveView(data, stride));
int32s.length = this.length / stride | 0;
return int32s;
};
return FlatVector;
}(Vector);
exports.FlatVector = FlatVector;
var ListVectorBase = /** @class */function (_super) {
tslib_1.__extends(ListVectorBase, _super);
function ListVectorBase() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ListVectorBase.prototype, "values", {
get: function get() {
return this.data.values;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListVectorBase.prototype, "valueOffsets", {
get: function get() {
return this.data.valueOffsets;
},
enumerable: true,
configurable: true
});
ListVectorBase.prototype.getValueOffset = function (index) {
return this.valueOffsets[index];
};
ListVectorBase.prototype.getValueLength = function (index) {
return this.valueOffsets[index + 1] - this.valueOffsets[index];
};
return ListVectorBase;
}(Vector);
exports.ListVectorBase = ListVectorBase;
var NestedVector = /** @class */function (_super) {
tslib_1.__extends(NestedVector, _super);
function NestedVector() {
return _super !== null && _super.apply(this, arguments) || this;
}
NestedVector.prototype.getChildAt = function (index) {
return this.view.getChildAt(index);
};
Object.defineProperty(NestedVector.prototype, "childData", {
get: function get() {
var data;
if (data = this._childData) {
// Return the cached childData reference first
return data;
} else if (!((data = this.data) instanceof _data.ChunkedData)) {
// If data isn't chunked, cache and return NestedData's childData
return this._childData = data.childData;
}
// Otherwise if the data is chunked, concatenate the childVectors from each chunk
// to construct a single chunked Vector for each column. Then return the ChunkedData
// instance from each unified chunked column as the childData of a chunked NestedVector
var chunks = data.chunkVectors;
return this._childData = chunks.reduce(function (cols, chunk) {
return chunk.childData.reduce(function (cols, _, i) {
return (cols[i] || (cols[i] = [])).push(chunk.getChildAt(i)) && cols || cols;
}, cols);
}, []).map(function (vecs) {
return Vector.concat.apply(Vector, tslib_1.__spread(vecs)).data;
});
},
enumerable: true,
configurable: true
});
return NestedVector;
}(Vector);
exports.NestedVector = NestedVector;
var NullVector = /** @class */function (_super) {
tslib_1.__extends(NullVector, _super);
function NullVector(data, view) {
if (view === void 0) {
view = new _flat.NullView(data);
}
return _super.call(this, data, view) || this;
}
return NullVector;
}(Vector);
exports.NullVector = NullVector;
var BoolVector = /** @class */function (_super) {
tslib_1.__extends(BoolVector, _super);
function BoolVector(data, view) {
if (view === void 0) {
view = new _flat.BoolView(data);
}
return _super.call(this, data, view) || this;
}
BoolVector.from = function (data) {
return new BoolVector(new _data.BoolData(new _type2.Bool(), data.length, null, (0, _bit.packBools)(data)));
};
Object.defineProperty(BoolVector.prototype, "values", {
get: function get() {
return this.data.values;
},
enumerable: true,
configurable: true
});
return BoolVector;
}(Vector);
exports.BoolVector = BoolVector;
var IntVector = /** @class */function (_super) {
tslib_1.__extends(IntVector, _super);
function IntVector(data, view) {
if (view === void 0) {
view = IntVector.defaultView(data);
}
return _super.call(this, data, view) || this;
}
IntVector.from = function (data, is64) {
if (is64 === true) {
return data instanceof Int32Array ? new IntVector(new _data.FlatData(new _type2.Int64(), data.length, null, data)) : new IntVector(new _data.FlatData(new _type2.Uint64(), data.length, null, data));
}
switch (data.constructor) {
case Int8Array:
return new IntVector(new _data.FlatData(new _type2.Int8(), data.length, null, data));
case Int16Array:
return new IntVector(new _data.FlatData(new _type2.Int16(), data.length, null, data));
case Int32Array:
return new IntVector(new _data.FlatData(new _type2.Int32(), data.length, null, data));
case Uint8Array:
return new IntVector(new _data.FlatData(new _type2.Uint8(), data.length, null, data));
case Uint16Array:
return new IntVector(new _data.FlatData(new _type2.Uint16(), data.length, null, data));
case Uint32Array:
return new IntVector(new _data.FlatData(new _type2.Uint32(), data.length, null, data));
}
throw new TypeError('Unrecognized Int data');
};
IntVector.defaultView = function (data) {
return data.type.bitWidth <= 32 ? new _flat.FlatView(data) : new _flat.FixedSizeView(data, data.type.bitWidth / 32 | 0);
};
return IntVector;
}(FlatVector);
exports.IntVector = IntVector;
var FloatVector = /** @class */function (_super) {
tslib_1.__extends(FloatVector, _super);
function FloatVector(data, view) {