New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uwdata/flechette

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uwdata/flechette - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

57

dist/flechette.js

@@ -488,3 +488,2 @@ // src/constants.js

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches

@@ -498,3 +497,2 @@ */

offsets,
typeIds,
children

@@ -507,3 +505,2 @@ }) {

this.offsets = offsets;
this.typeIds = typeIds;
this.children = children;

@@ -569,4 +566,3 @@ if (!nullCount) {

*[Symbol.iterator]() {
const { length } = this;
for (let i = 0; i < length; ++i) {
for (let i = 0; i < this.length; ++i) {
yield this.at(i);

@@ -686,6 +682,6 @@ }

*/
constructor(options) {
super(options);
this.stride = options.bitWidth >> 5, // 8 bits/byte and 4 bytes/uint32;
this.scale = Math.pow(10, options.scale);
constructor({ bitWidth, scale, ...rest }) {
super(rest);
this.stride = bitWidth >> 5, // 8 bits/byte and 4 bytes/uint32;
this.scale = Math.pow(10, scale);
}

@@ -892,9 +888,9 @@ /**

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {Uint8Array} [options.values] Values buffer
* @param {Batch[]} [options.children] Children batches
* @param {number} options.stride The fixed stride (size) of values.
*/
constructor(options) {
super(options);
this.stride = options.stride;
constructor({ stride, ...rest }) {
super(rest);
this.stride = stride;
}

@@ -968,10 +964,11 @@ };

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int32Array} [options.offsets] Offsets buffer
* @param {Batch[]} options.children Children batches
* @param {Int8Array} options.typeIds Union type ids buffer
* @param {Batch[]} options.children Children batches
* @param {Record<string,number>} options.map A typeId to children index map
* @param {Record<string, number>} options.map A typeId to children index map
*/
constructor(options) {
super(options);
this.map = options.map;
constructor({ typeIds, map, ...rest }) {
super(rest);
this.typeIds = typeIds;
this.map = map;
}

@@ -1007,5 +1004,5 @@ /**

*/
constructor(options) {
super(options);
this.names = options.names;
constructor({ names, ...rest }) {
super(rest);
this.names = names;
}

@@ -1030,13 +1027,12 @@ /**

* @param {object} options Batch options.
* @param {import('./types.js').DataType} options.type The field data type
* @param {number} options.length The length of the batch
* @param {number} options.nullCount The null value count
* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {import('./types.js').IntegerArray} options.values Values buffer
* @param {import('./column.js').Column<T>} options.dictionary
* The dictionary of column values.
*/
constructor(options) {
super(options);
this.cache = options.dictionary.cache();
constructor({ dictionary, ...rest }) {
super(rest);
this.cache = dictionary.cache();
}

@@ -1882,2 +1878,3 @@ /**

switch (typeId) {
// validity and data value buffers
case Type.Bool:

@@ -1901,2 +1898,3 @@ return value(BoolBatch);

return value(FixedBinaryBatch, { stride });
// validity, offset, and value buffers
case Type.Utf8:

@@ -1910,2 +1908,3 @@ return offset(Utf8Batch);

return offset(LargeBinaryBatch);
// validity, offset, and list child
case Type.List:

@@ -1917,2 +1916,3 @@ return list(ListBatch);

return list(useMap ? MapBatch : MapEntryBatch);
// validity and children
case Type.FixedSizeList:

@@ -1924,2 +1924,3 @@ return kids(FixedListBatch, { stride });

});
// dictionary
case Type.Dictionary: {

@@ -1934,2 +1935,3 @@ const { id, keys } = type;

}
// union
case Type.Union: {

@@ -1947,2 +1949,3 @@ if (ctx.version < Version.V5) {

}
// unsupported type
default:

@@ -1949,0 +1952,0 @@ throw new Error(`Unsupported type: ${typeId}, (${keyFor(Type, typeId)})`);

@@ -1,1 +0,1 @@

var E={V1:0,V2:1,V3:2,V4:3,V5:4},ce={Little:0,Big:1},S={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},c={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},F={HALF:0,SINGLE:1,DOUBLE:2},_={DAY:0,MILLISECOND:1},w={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},C={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},H={Sparse:0,Dense:1};var ie=Uint8Array,wt=Uint16Array,Mt=Uint32Array,le=BigUint64Array,Tt=Int8Array,ue=Int16Array,D=Int32Array,T=BigInt64Array,Pt=Float32Array,W=Float64Array;function Yt(e,t){let r=Math.log2(e)-3;return(t?[Tt,ue,D,T]:[ie,wt,Mt,le])[r]}function Bt(e,t){return(e[t>>3]&1<<t%8)!==0}var de=new TextDecoder("utf-8");function X(e){return de.decode(e)}function k(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}function N(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function Lt(e,t){return N(e/t)+N(e%t)/N(t)}function q(e,t){let r=0,n=e.length;do{let o=r+n>>>1;e[o]<=t?r=o+1:n=o}while(r<n);return--r}function d(e,t){let r=t+h(e,t),n=r-h(e,r),o=x(e,n);return(s,a,i=null)=>{if(s<o){let l=x(e,n+s);if(l)return a(e,r+l)}return i}}function B(e,t){return t}function L(e,t){return!!fe(e,t)}function fe(e,t){return P(e,t)<<24>>24}function P(e,t){return e[t]}function x(e,t){return he(e,t)<<16>>16}function he(e,t){return e[t]|e[t+1]<<8}function h(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function $t(e,t){return h(e,t)>>>0}function pe(e,t){return BigInt.asIntN(64,BigInt($t(e,t))+(BigInt($t(e,t+4))<<BigInt(32)))}function v(e,t){return N(pe(e,t))}function V(e,t){let r=t+h(e,t),n=h(e,r);return r+=4,X(e.subarray(r,r+n))}function b(e,t){return{length:h(e,t+h(e,t)),base:t+h(e,t)+4}}function jt(e){return e instanceof R}var Y=class{static ArrayType=null;constructor({length:t,nullCount:r,validity:n,values:o,offsets:s,typeIds:a,children:i}){this.length=t,this.nullCount=r,this.validity=n,this.values=o,this.offsets=s,this.typeIds=a,this.children=i,r||(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return Bt(this.validity,t)}value(t){return this.values[t]}slice(t,r){let n=r-t,o=Array(n);for(let s=0;s<n;++s)o[s]=this.at(t+s);return o}*[Symbol.iterator](){let{length:t}=this;for(let r=0;r<t;++r)yield this.at(r)}},R=class extends Y{constructor(t){super(t);let{length:r,values:n}=this;this.values=n.subarray(0,r)}slice(t,r){return this.nullCount?super.slice(t,r):this.values.subarray(t,r)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},z=class extends Y{static ArrayType=W},y=class extends Y{static ArrayType=Array},J=class extends y{value(t){return null}},M=class extends z{value(t){return N(this.values[t])}},K=class extends z{value(t){let r=this.values[t],n=(r&31744)>>10,o=(r&1023)/1024,s=(-1)**((r&32768)>>15);switch(n){case 31:return s*(o?Number.NaN:1/0);case 0:return s*(o?6103515625e-14*o:0)}return s*2**(n-15)*(1+o)}},Q=class extends y{value(t){return Bt(this.values,t)}},Gt=Array.from({length:8},(e,t)=>Math.pow(2,t*32)),tt=class extends z{constructor(t){super(t),this.stride=t.bitWidth>>5,this.scale=Math.pow(10,t.scale)}value(t){let r=this.values,n=this.stride,o=t<<2,s=0;if((r[n-1]|0)<0){for(let a=0;a<n;++a)s+=~r[a+o]*Gt[a];s=-(s+1)}else for(let a=0;a<n;++a)s+=r[a+o]*Gt[a];return s/this.scale}},et=class extends y{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},rt=class extends z{value(t){return 864e5*this.values[t]}},Zt=M,nt=class extends M{value(t){return super.value(t)*1e3}},Wt=M,st=class extends M{value(t){return Lt(this.values[t],1000n)}},ot=class extends M{value(t){return Lt(this.values[t],1000000n)}},at=class extends y{value(t){return this.values.subarray(t<<1,t+1<<1)}},ct=class extends y{value(t){let r=this.values[t];return Int32Array.of(Math.trunc(r/12),Math.trunc(r%12))}},it=class extends y{value(t){let r=this.values,n=t<<2;return Float64Array.of(h(r,n),h(r,n+4),v(r,n+8))}},Xt=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),qt=({values:e,offsets:t},r)=>e.subarray(N(t[r]),N(t[r+1])),lt=class extends y{value(t){return Xt(this,t)}},ut=class extends y{value(t){return qt(this,t)}},dt=class extends y{value(t){return X(Xt(this,t))}},ft=class extends y{value(t){return X(qt(this,t))}},ht=class extends y{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},pt=class extends y{value(t){let r=this.offsets;return this.children[0].slice(N(r[t]),N(r[t+1]))}},mt=class extends y{constructor(t){super(t),this.stride=t.stride}},yt=class extends mt{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},gt=class extends mt{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function Jt({children:e,offsets:t},r){let[n,o]=e[0].children,s=t[r],a=t[r+1],i=[];for(let l=s;l<a;++l)i.push([n.at(l),o.at(l)]);return i}var It=class extends y{value(t){return Jt(this,t)}},vt=class extends y{value(t){return new Map(Jt(this,t))}},$=class extends y{constructor(t){super(t),this.map=t.map}value(t){let{typeIds:r,children:n,map:o}=this;return n[o[r[t]]].at(t)}},xt=class extends ${value(t){return super.value(this.offsets[t])}},bt=class extends y{constructor(t){super(t),this.names=t.names}value(t){let{children:r,names:n}=this,o=n.length,s={};for(let a=0;a<o;++a)s[n[a]]=r[a].at(t);return s}},At=class extends y{constructor(t){super(t),this.cache=t.dictionary.cache()}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}};function Ut(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new Ot(e,t)}}var Ot=class{constructor(t,r){this.type=t,this.length=r.reduce((s,a)=>s+a.length,0),this.nullCount=r.reduce((s,a)=>s+a.nullCount,0),this.data=r;let n=r.length,o=new Int32Array(n+1);if(n===1){let[s]=r;o[1]=s.length,this.at=a=>s.at(a)}else for(let s=0,a=0;s<n;++s)o[s+1]=a+=r[s].length;this.offsets=o}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():me(t)}at(t){let{data:r,offsets:n}=this,o=q(n,t);return r[o]?.at(t-n[o])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:r,data:n}=this,o=!r&&jt(n[0]),s=n.length;if(o&&s===1)return n[0].values;let a=!s||r>0?Array:n[0].constructor.ArrayType??n[0].values.constructor,i=new a(t);return o?ye(i,n):ge(i,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*me(e){for(let t=0;t<e.length;++t){let r=e[t][Symbol.iterator]();for(let n=r.next();!n.done;n=r.next())yield n.value}}function ye(e,t){for(let r=0,n=0;r<t.length;++r){let{values:o}=t[r];e.set(o,n),n+=o.length}return e}function ge(e,t){let r=-1;for(let n=0;n<t.length;++n){let o=t[n];for(let s=0;s<o.length;++s)e[++r]=o.at(s)}return e}function Ft(e,t,r,n){switch(r){case c.NONE:case c.Null:case c.Bool:return{typeId:r};case c.Binary:case c.Utf8:return{typeId:r,offsets:D};case c.LargeBinary:case c.LargeUtf8:return{typeId:r,offsets:T};case c.List:return{typeId:r,children:[n?.[0]??null],offsets:D};case c.LargeList:return{typeId:r,children:[n?.[0]??null],offsets:T};case c.Struct:return{typeId:r,children:n};case c.Int:return Vt(e,t);case c.Float:return Ie(e,t);case c.Decimal:return ve(e,t);case c.Date:return xe(e,t);case c.Time:return be(e,t);case c.Timestamp:return Ae(e,t);case c.Interval:return Se(e,t);case c.Duration:return De(e,t);case c.FixedSizeBinary:return Ne(e,t);case c.FixedSizeList:return Ee(e,t,n);case c.Map:return we(e,t,n);case c.Union:return Me(e,t,n)}throw new Error(`Unrecognized type: "${k(c,r)}" (id ${r})`)}function Ct(e,t){return{typeId:c.Int,bitWidth:e,signed:t,values:Yt(e,t)}}function Vt(e,t){let r=d(e,t);return Ct(r(4,h,0),r(6,L,!1))}function Ie(e,t){let n=d(e,t)(4,x,F.HALF);return{typeId:c.Float,precision:n,values:n===F.HALF?wt:n===F.SINGLE?Pt:W}}function ve(e,t){let r=d(e,t),n=r(8,h,128);return{typeId:c.Decimal,precision:r(4,h,0),scale:r(6,h,0),bitWidth:n,values:Mt}}function xe(e,t){let n=d(e,t)(4,x,_.MILLISECOND);return{typeId:c.Date,unit:n,values:n===_.DAY?D:T}}function be(e,t){let r=d(e,t),n=r(6,h,32);return{typeId:c.Time,unit:r(4,x,w.MILLISECOND),bitWidth:n,values:n===32?D:T}}function Ae(e,t){let r=d(e,t);return{typeId:c.Timestamp,unit:r(4,x,w.SECOND),timezone:r(6,V),values:T}}function Se(e,t){let n=d(e,t)(4,x,C.YEAR_MONTH);return{typeId:c.Interval,unit:n,values:n===C.MONTH_DAY_NANO?void 0:D}}function De(e,t){let r=d(e,t);return{typeId:c.Duration,unit:r(4,x,w.MILLISECOND),values:T}}function Ne(e,t){let r=d(e,t);return{typeId:c.FixedSizeBinary,stride:r(4,h,0)}}function Ee(e,t,r){let n=d(e,t);return{typeId:c.FixedSizeList,stride:n(4,h,0),children:[r?.[0]??null]}}function we(e,t,r){let n=d(e,t);return{typeId:c.Map,keysSorted:n(4,L,!1),children:r,offsets:D}}function Me(e,t,r){let n=d(e,t),{length:o,base:s}=b(e,n(6,B));return{typeId:c.Union,mode:n(4,x,H.Sparse),typeIds:new D(e.buffer,e.byteOffset+s,o),children:r??[],offsets:D}}function G(e,t){let{length:r,base:n}=b(e,t),o=r>0?new Map:null;for(let s=0;s<r;++s){let a=d(e,n+s*4),i=a(4,V),l=a(6,V);(i||l)&&o.set(i,l)}return o?.size?o:null}function St(e,t,r){let n=new Map,o=d(e,t);return{version:r,endianness:o(4,x,0),fields:o(6,(s,a)=>Te(s,a,n),[]),metadata:o(8,G),dictionaryTypes:n}}function Te(e,t,r){let{length:n,base:o}=b(e,t),s=[];for(let a=0;a<n;++a)s.push(Kt(e,o+a*4,r));return s}function Kt(e,t,r){let n=d(e,t),o=n(8,P,c.NONE),s=n(10,B,0),a=n(12,(g,p)=>Le(g,p)),i=n(14,Be),l;if(a){let{id:g}=a,p=r.get(g);p||(p=Ft(e,s,o,i),r.set(g,p)),a.type=p,l=a}else l=Ft(e,s,o,i);return{name:n(4,V),type:l,nullable:n(6,L,!1),metadata:n(16,G)}}function Be(e,t,r){let{length:n,base:o}=b(e,t),s=[];for(let a=0;a<n;++a){let i=o+a*4;s.push(Kt(e,i,r))}return s.length?s:null}function Le(e,t){if(!t)return null;let r=d(e,t);return{type:null,typeId:c.Dictionary,id:r(4,v,0),keys:r(6,Vt,Ct(32,!0)),ordered:r(8,L,!1)}}function Dt(e,t,r){let n=d(e,t);if(n(10,B,0))throw new Error("Record batch compression not implemented");let o=[],s=n(6,b);if(s){let{length:l,base:g}=s;for(let p=0;p<l;++p){let u=g+p*16;o.push({length:v(e,u),nullCount:v(e,u+8)})}}let a=[],i=n(8,b);if(i){let{length:l,base:g}=i,p=r<E.V4;for(let u=0;u<l;++u){let f=g+u*16+(p?8*(u+1):0);a.push({offset:v(e,f),length:v(e,f+8)})}}return{length:n(4,v,0),nodes:o,buffers:a}}function Qt(e,t,r){let n=d(e,t);return{id:n(4,v,0),data:n(6,(o,s)=>Dt(o,s,r)),isDelta:n(8,L,!1)}}var Oe=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ue=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Fe=e=>`Unsupported message type: ${e} (${k(S,e)})`;function Nt(e,t){let r=h(e,t)||0;if(t+=4,r===-1&&(r=h(e,t)||0,t+=4),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(Oe(r,n.byteLength));let o=d(n,0),s=o(4,x,E.V1),a=o(6,P,S.NONE),i=o(8,B,0),l=o(10,v,0),g;if(i){let p=a===S.Schema?St:a===S.DictionaryBatch?Qt:a===S.RecordBatch?Dt:null;if(!p)throw new Error(Fe(a));if(g=p(n,i,s),l>0){let u=e.subarray(t,t+=l);if(u.byteLength<l)throw new Error(Ue(l,u.byteLength));g.body=u}}return{version:s,type:a,index:t,content:g}}function Ce(e,t){return{offset:v(e,t),metadataLength:h(e,t+8),bodyLength:v(e,t+16)}}function _t(e,t){let{length:r,base:n}=b(e,t),o=[];for(let s=0;s<r;++s)o.push(Ce(e,n+s*24));return o}function ee(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return!Array.isArray(t)&&Ve(t)?ke(t):_e(t)}var re=Uint8Array.of(65,82,82,79,87,49);function Ve(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(re[t]!==e[t])return!1;return!0}function _e(e){let t=[e].flat(),r,n=[],o=[];for(let s of t){let a=0;for(;;){let i=Nt(s,a);if(i===null)break;if(a=i.index,!!i.content)switch(i.type){case S.Schema:r||(r=i.content);break;case S.RecordBatch:n.push(i.content);break;case S.DictionaryBatch:o.push(i.content);break}}}return{schema:r,dictionaries:o,records:n,metadata:null}}function ke(e){let t=e.byteLength-(re.length+4),r=h(e,t),n=d(e,t-r),o=n(4,x,E.V1),s=n(8,_t,[]),a=n(10,_t,[]);return{schema:n(6,(i,l)=>St(i,l,o)),dictionaries:s.map(({offset:i})=>Nt(e,i).content),records:a.map(({offset:i})=>Nt(e,i).content),metadata:n(12,G)}}var Et=class e{constructor(t,r){this.schema=t,this.names=t.fields.map(n=>n.name),this.children=r}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let r=this.names.findIndex(n=>n===t);return r>-1?this.children[r]:void 0}selectAt(t,r=[]){let{children:n,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,i)=>Re(s[a],r[i]))},t.map(a=>n[a]))}select(t,r){let n=this.names,o=t.map(s=>n.indexOf(s));return this.selectAt(o,r)}toColumns(){let{children:t,names:r}=this,n={};return r.forEach((o,s)=>n[o]=t[s]?.toArray()??[]),n}toArray(){let{children:t,numRows:r,names:n}=this,o=t[0]?.data??[],s=Array(r);for(let a=0,i=-1;a<o.length;++a)for(let l=0;l<o[a].length;++l)s[++i]=kt(n,t,a,l);return s}*[Symbol.iterator](){let{children:t,names:r}=this,n=t[0]?.data??[];for(let o=0;o<n.length;++o)for(let s=0;s<n[o].length;++s)yield kt(r,t,o,s)}at(t){let{names:r,children:n,numRows:o}=this;if(t<0||t>=o)return null;let[{offsets:s}]=n,a=q(s,t);return kt(r,n,a,t-s[a])}get(t){return this.at(t)}};function Re(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function kt(e,t,r,n){let o={};for(let s=0;s<e.length;++s)o[e[s]]=t[s].data[r].at(n);return o}function ze(e,t){return He(ee(e),t)}function He(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:o}=e,{version:s,fields:a,dictionaryTypes:i}=r,l=new Map,g=Pe(t,s,l),p=new Map;for(let f of n){let{id:I,data:O,isDelta:U,body:j}=f,m=i.get(I),A=Rt(m,g({...O,body:j}));if(p.has(I)){let Z=p.get(I);U||Z.clear(),Z.add(A)}else{if(U)throw new Error("Delta update can not be first dictionary batch.");p.set(I,Ut(m).add(A))}}p.forEach((f,I)=>l.set(I,f.done()));let u=a.map(f=>Ut(f.type));for(let f of o){let I=g(f);a.forEach((O,U)=>u[U].add(Rt(O.type,I)))}return new Et(r,u.map(f=>f.done()))}function Pe(e,t,r){let n={version:t,options:e,dictionary:o=>r.get(o)};return o=>{let{length:s,nodes:a,buffers:i,body:l}=o,g=-1,p=-1;return{...n,length:s,node:()=>a[++g],buffer:u=>{let{length:f,offset:I}=i[++p];return u?new u(l.buffer,l.byteOffset+I,f/u.BYTES_PER_ELEMENT):l.subarray(I,I+f)},visitAll(u){return u.map(f=>Rt(f.type,this))}}}}function Rt(e,t){let{typeId:r,bitWidth:n,precision:o,scale:s,stride:a,unit:i}=e,{useBigInt:l,useDate:g,useMap:p}=t.options;if(r===c.Null){let{length:m}=t;return new J({length:m,nullCount:m})}let u=t.node(),f=(m,A)=>new m({...u,...A,validity:t.buffer(),values:t.buffer(e.values)}),I=m=>new m({...u,validity:t.buffer(),offsets:t.buffer(e.offsets),values:t.buffer()}),O=m=>new m({...u,validity:t.buffer(),offsets:t.buffer(e.offsets),children:t.visitAll(e.children)}),U=(m,A)=>new m({...u,...A,validity:t.buffer(),children:t.visitAll(e.children)}),j=g?m=>new et(f(m)):f;switch(r){case c.Bool:return f(Q);case c.Int:case c.Time:case c.Duration:return f(n===64&&!l?M:R);case c.Float:return f(o===F.HALF?K:R);case c.Date:return j(i===_.DAY?rt:Zt);case c.Timestamp:return j(i===w.SECOND?nt:i===w.MILLISECOND?Wt:i===w.MICROSECOND?st:ot);case c.Decimal:return f(tt,{bitWidth:n,scale:s});case c.Interval:return f(i===C.DAY_TIME?at:i===C.YEAR_MONTH?ct:it);case c.FixedSizeBinary:return f(yt,{stride:a});case c.Utf8:return I(dt);case c.LargeUtf8:return I(ft);case c.Binary:return I(lt);case c.LargeBinary:return I(ut);case c.List:return O(ht);case c.LargeList:return O(pt);case c.Map:return O(p?vt:It);case c.FixedSizeList:return U(gt,{stride:a});case c.Struct:return U(bt,{names:e.children.map(m=>m.name)});case c.Dictionary:{let{id:m,keys:A}=e;return new At({...u,validity:t.buffer(),values:t.buffer(A.values),dictionary:t.dictionary(m)})}case c.Union:{t.version<E.V5&&t.buffer();let m=e.mode===H.Sparse,A=t.buffer(Tt),Z=m?null:t.buffer(e.offsets),ne=t.visitAll(e.children),se=e.typeIds.reduce((Ht,oe,ae)=>(Ht[oe]=ae,Ht),{}),zt={...u,map:se,typeIds:A,offsets:Z,children:ne};return m?new $(zt):new xt(zt)}default:throw new Error(`Unsupported type: ${r}, (${k(c,r)})`)}}export{_ as DateUnit,ce as Endianness,C as IntervalUnit,F as Precision,w as TimeUnit,c as Type,H as UnionMode,E as Version,ze as tableFromIPC};
var E={V1:0,V2:1,V3:2,V4:3,V5:4},ie={Little:0,Big:1},S={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},i={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},F={HALF:0,SINGLE:1,DOUBLE:2},_={DAY:0,MILLISECOND:1},w={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},C={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},H={Sparse:0,Dense:1};var ce=Uint8Array,wt=Uint16Array,Mt=Uint32Array,le=BigUint64Array,Tt=Int8Array,ue=Int16Array,D=Int32Array,T=BigInt64Array,Pt=Float32Array,W=Float64Array;function Yt(e,t){let r=Math.log2(e)-3;return(t?[Tt,ue,D,T]:[ce,wt,Mt,le])[r]}function Bt(e,t){return(e[t>>3]&1<<t%8)!==0}var de=new TextDecoder("utf-8");function X(e){return de.decode(e)}function k(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}function N(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function Lt(e,t){return N(e/t)+N(e%t)/N(t)}function q(e,t){let r=0,n=e.length;do{let o=r+n>>>1;e[o]<=t?r=o+1:n=o}while(r<n);return--r}function d(e,t){let r=t+p(e,t),n=r-p(e,r),o=x(e,n);return(s,a,c=null)=>{if(s<o){let l=x(e,n+s);if(l)return a(e,r+l)}return c}}function B(e,t){return t}function L(e,t){return!!fe(e,t)}function fe(e,t){return P(e,t)<<24>>24}function P(e,t){return e[t]}function x(e,t){return pe(e,t)<<16>>16}function pe(e,t){return e[t]|e[t+1]<<8}function p(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function $t(e,t){return p(e,t)>>>0}function he(e,t){return BigInt.asIntN(64,BigInt($t(e,t))+(BigInt($t(e,t+4))<<BigInt(32)))}function v(e,t){return N(he(e,t))}function V(e,t){let r=t+p(e,t),n=p(e,r);return r+=4,X(e.subarray(r,r+n))}function b(e,t){return{length:p(e,t+p(e,t)),base:t+p(e,t)+4}}function jt(e){return e instanceof R}var Y=class{static ArrayType=null;constructor({length:t,nullCount:r,validity:n,values:o,offsets:s,children:a}){this.length=t,this.nullCount=r,this.validity=n,this.values=o,this.offsets=s,this.children=a,r||(this.at=c=>this.value(c))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return Bt(this.validity,t)}value(t){return this.values[t]}slice(t,r){let n=r-t,o=Array(n);for(let s=0;s<n;++s)o[s]=this.at(t+s);return o}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},R=class extends Y{constructor(t){super(t);let{length:r,values:n}=this;this.values=n.subarray(0,r)}slice(t,r){return this.nullCount?super.slice(t,r):this.values.subarray(t,r)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},z=class extends Y{static ArrayType=W},y=class extends Y{static ArrayType=Array},J=class extends y{value(t){return null}},M=class extends z{value(t){return N(this.values[t])}},K=class extends z{value(t){let r=this.values[t],n=(r&31744)>>10,o=(r&1023)/1024,s=(-1)**((r&32768)>>15);switch(n){case 31:return s*(o?Number.NaN:1/0);case 0:return s*(o?6103515625e-14*o:0)}return s*2**(n-15)*(1+o)}},Q=class extends y{value(t){return Bt(this.values,t)}},Gt=Array.from({length:8},(e,t)=>Math.pow(2,t*32)),tt=class extends z{constructor({bitWidth:t,scale:r,...n}){super(n),this.stride=t>>5,this.scale=Math.pow(10,r)}value(t){let r=this.values,n=this.stride,o=t<<2,s=0;if((r[n-1]|0)<0){for(let a=0;a<n;++a)s+=~r[a+o]*Gt[a];s=-(s+1)}else for(let a=0;a<n;++a)s+=r[a+o]*Gt[a];return s/this.scale}},et=class extends y{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},rt=class extends z{value(t){return 864e5*this.values[t]}},Zt=M,nt=class extends M{value(t){return super.value(t)*1e3}},Wt=M,st=class extends M{value(t){return Lt(this.values[t],1000n)}},ot=class extends M{value(t){return Lt(this.values[t],1000000n)}},at=class extends y{value(t){return this.values.subarray(t<<1,t+1<<1)}},it=class extends y{value(t){let r=this.values[t];return Int32Array.of(Math.trunc(r/12),Math.trunc(r%12))}},ct=class extends y{value(t){let r=this.values,n=t<<2;return Float64Array.of(p(r,n),p(r,n+4),v(r,n+8))}},Xt=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),qt=({values:e,offsets:t},r)=>e.subarray(N(t[r]),N(t[r+1])),lt=class extends y{value(t){return Xt(this,t)}},ut=class extends y{value(t){return qt(this,t)}},dt=class extends y{value(t){return X(Xt(this,t))}},ft=class extends y{value(t){return X(qt(this,t))}},pt=class extends y{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},ht=class extends y{value(t){let r=this.offsets;return this.children[0].slice(N(r[t]),N(r[t+1]))}},mt=class extends y{constructor({stride:t,...r}){super(r),this.stride=t}},yt=class extends mt{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},gt=class extends mt{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function Jt({children:e,offsets:t},r){let[n,o]=e[0].children,s=t[r],a=t[r+1],c=[];for(let l=s;l<a;++l)c.push([n.at(l),o.at(l)]);return c}var It=class extends y{value(t){return Jt(this,t)}},vt=class extends y{value(t){return new Map(Jt(this,t))}},$=class extends y{constructor({typeIds:t,map:r,...n}){super(n),this.typeIds=t,this.map=r}value(t){let{typeIds:r,children:n,map:o}=this;return n[o[r[t]]].at(t)}},xt=class extends ${value(t){return super.value(this.offsets[t])}},bt=class extends y{constructor({names:t,...r}){super(r),this.names=t}value(t){let{children:r,names:n}=this,o=n.length,s={};for(let a=0;a<o;++a)s[n[a]]=r[a].at(t);return s}},At=class extends y{constructor({dictionary:t,...r}){super(r),this.cache=t.cache()}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}};function Ut(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new Ot(e,t)}}var Ot=class{constructor(t,r){this.type=t,this.length=r.reduce((s,a)=>s+a.length,0),this.nullCount=r.reduce((s,a)=>s+a.nullCount,0),this.data=r;let n=r.length,o=new Int32Array(n+1);if(n===1){let[s]=r;o[1]=s.length,this.at=a=>s.at(a)}else for(let s=0,a=0;s<n;++s)o[s+1]=a+=r[s].length;this.offsets=o}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():me(t)}at(t){let{data:r,offsets:n}=this,o=q(n,t);return r[o]?.at(t-n[o])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:r,data:n}=this,o=!r&&jt(n[0]),s=n.length;if(o&&s===1)return n[0].values;let a=!s||r>0?Array:n[0].constructor.ArrayType??n[0].values.constructor,c=new a(t);return o?ye(c,n):ge(c,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*me(e){for(let t=0;t<e.length;++t){let r=e[t][Symbol.iterator]();for(let n=r.next();!n.done;n=r.next())yield n.value}}function ye(e,t){for(let r=0,n=0;r<t.length;++r){let{values:o}=t[r];e.set(o,n),n+=o.length}return e}function ge(e,t){let r=-1;for(let n=0;n<t.length;++n){let o=t[n];for(let s=0;s<o.length;++s)e[++r]=o.at(s)}return e}function Ft(e,t,r,n){switch(r){case i.NONE:case i.Null:case i.Bool:return{typeId:r};case i.Binary:case i.Utf8:return{typeId:r,offsets:D};case i.LargeBinary:case i.LargeUtf8:return{typeId:r,offsets:T};case i.List:return{typeId:r,children:[n?.[0]??null],offsets:D};case i.LargeList:return{typeId:r,children:[n?.[0]??null],offsets:T};case i.Struct:return{typeId:r,children:n};case i.Int:return Vt(e,t);case i.Float:return Ie(e,t);case i.Decimal:return ve(e,t);case i.Date:return xe(e,t);case i.Time:return be(e,t);case i.Timestamp:return Ae(e,t);case i.Interval:return Se(e,t);case i.Duration:return De(e,t);case i.FixedSizeBinary:return Ne(e,t);case i.FixedSizeList:return Ee(e,t,n);case i.Map:return we(e,t,n);case i.Union:return Me(e,t,n)}throw new Error(`Unrecognized type: "${k(i,r)}" (id ${r})`)}function Ct(e,t){return{typeId:i.Int,bitWidth:e,signed:t,values:Yt(e,t)}}function Vt(e,t){let r=d(e,t);return Ct(r(4,p,0),r(6,L,!1))}function Ie(e,t){let n=d(e,t)(4,x,F.HALF);return{typeId:i.Float,precision:n,values:n===F.HALF?wt:n===F.SINGLE?Pt:W}}function ve(e,t){let r=d(e,t),n=r(8,p,128);return{typeId:i.Decimal,precision:r(4,p,0),scale:r(6,p,0),bitWidth:n,values:Mt}}function xe(e,t){let n=d(e,t)(4,x,_.MILLISECOND);return{typeId:i.Date,unit:n,values:n===_.DAY?D:T}}function be(e,t){let r=d(e,t),n=r(6,p,32);return{typeId:i.Time,unit:r(4,x,w.MILLISECOND),bitWidth:n,values:n===32?D:T}}function Ae(e,t){let r=d(e,t);return{typeId:i.Timestamp,unit:r(4,x,w.SECOND),timezone:r(6,V),values:T}}function Se(e,t){let n=d(e,t)(4,x,C.YEAR_MONTH);return{typeId:i.Interval,unit:n,values:n===C.MONTH_DAY_NANO?void 0:D}}function De(e,t){let r=d(e,t);return{typeId:i.Duration,unit:r(4,x,w.MILLISECOND),values:T}}function Ne(e,t){let r=d(e,t);return{typeId:i.FixedSizeBinary,stride:r(4,p,0)}}function Ee(e,t,r){let n=d(e,t);return{typeId:i.FixedSizeList,stride:n(4,p,0),children:[r?.[0]??null]}}function we(e,t,r){let n=d(e,t);return{typeId:i.Map,keysSorted:n(4,L,!1),children:r,offsets:D}}function Me(e,t,r){let n=d(e,t),{length:o,base:s}=b(e,n(6,B));return{typeId:i.Union,mode:n(4,x,H.Sparse),typeIds:new D(e.buffer,e.byteOffset+s,o),children:r??[],offsets:D}}function G(e,t){let{length:r,base:n}=b(e,t),o=r>0?new Map:null;for(let s=0;s<r;++s){let a=d(e,n+s*4),c=a(4,V),l=a(6,V);(c||l)&&o.set(c,l)}return o?.size?o:null}function St(e,t,r){let n=new Map,o=d(e,t);return{version:r,endianness:o(4,x,0),fields:o(6,(s,a)=>Te(s,a,n),[]),metadata:o(8,G),dictionaryTypes:n}}function Te(e,t,r){let{length:n,base:o}=b(e,t),s=[];for(let a=0;a<n;++a)s.push(Kt(e,o+a*4,r));return s}function Kt(e,t,r){let n=d(e,t),o=n(8,P,i.NONE),s=n(10,B,0),a=n(12,(g,h)=>Le(g,h)),c=n(14,Be),l;if(a){let{id:g}=a,h=r.get(g);h||(h=Ft(e,s,o,c),r.set(g,h)),a.type=h,l=a}else l=Ft(e,s,o,c);return{name:n(4,V),type:l,nullable:n(6,L,!1),metadata:n(16,G)}}function Be(e,t,r){let{length:n,base:o}=b(e,t),s=[];for(let a=0;a<n;++a){let c=o+a*4;s.push(Kt(e,c,r))}return s.length?s:null}function Le(e,t){if(!t)return null;let r=d(e,t);return{type:null,typeId:i.Dictionary,id:r(4,v,0),keys:r(6,Vt,Ct(32,!0)),ordered:r(8,L,!1)}}function Dt(e,t,r){let n=d(e,t);if(n(10,B,0))throw new Error("Record batch compression not implemented");let o=[],s=n(6,b);if(s){let{length:l,base:g}=s;for(let h=0;h<l;++h){let u=g+h*16;o.push({length:v(e,u),nullCount:v(e,u+8)})}}let a=[],c=n(8,b);if(c){let{length:l,base:g}=c,h=r<E.V4;for(let u=0;u<l;++u){let f=g+u*16+(h?8*(u+1):0);a.push({offset:v(e,f),length:v(e,f+8)})}}return{length:n(4,v,0),nodes:o,buffers:a}}function Qt(e,t,r){let n=d(e,t);return{id:n(4,v,0),data:n(6,(o,s)=>Dt(o,s,r)),isDelta:n(8,L,!1)}}var Oe=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ue=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Fe=e=>`Unsupported message type: ${e} (${k(S,e)})`;function Nt(e,t){let r=p(e,t)||0;if(t+=4,r===-1&&(r=p(e,t)||0,t+=4),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(Oe(r,n.byteLength));let o=d(n,0),s=o(4,x,E.V1),a=o(6,P,S.NONE),c=o(8,B,0),l=o(10,v,0),g;if(c){let h=a===S.Schema?St:a===S.DictionaryBatch?Qt:a===S.RecordBatch?Dt:null;if(!h)throw new Error(Fe(a));if(g=h(n,c,s),l>0){let u=e.subarray(t,t+=l);if(u.byteLength<l)throw new Error(Ue(l,u.byteLength));g.body=u}}return{version:s,type:a,index:t,content:g}}function Ce(e,t){return{offset:v(e,t),metadataLength:p(e,t+8),bodyLength:v(e,t+16)}}function _t(e,t){let{length:r,base:n}=b(e,t),o=[];for(let s=0;s<r;++s)o.push(Ce(e,n+s*24));return o}function ee(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return!Array.isArray(t)&&Ve(t)?ke(t):_e(t)}var re=Uint8Array.of(65,82,82,79,87,49);function Ve(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(re[t]!==e[t])return!1;return!0}function _e(e){let t=[e].flat(),r,n=[],o=[];for(let s of t){let a=0;for(;;){let c=Nt(s,a);if(c===null)break;if(a=c.index,!!c.content)switch(c.type){case S.Schema:r||(r=c.content);break;case S.RecordBatch:n.push(c.content);break;case S.DictionaryBatch:o.push(c.content);break}}}return{schema:r,dictionaries:o,records:n,metadata:null}}function ke(e){let t=e.byteLength-(re.length+4),r=p(e,t),n=d(e,t-r),o=n(4,x,E.V1),s=n(8,_t,[]),a=n(10,_t,[]);return{schema:n(6,(c,l)=>St(c,l,o)),dictionaries:s.map(({offset:c})=>Nt(e,c).content),records:a.map(({offset:c})=>Nt(e,c).content),metadata:n(12,G)}}var Et=class e{constructor(t,r){this.schema=t,this.names=t.fields.map(n=>n.name),this.children=r}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let r=this.names.findIndex(n=>n===t);return r>-1?this.children[r]:void 0}selectAt(t,r=[]){let{children:n,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>Re(s[a],r[c]))},t.map(a=>n[a]))}select(t,r){let n=this.names,o=t.map(s=>n.indexOf(s));return this.selectAt(o,r)}toColumns(){let{children:t,names:r}=this,n={};return r.forEach((o,s)=>n[o]=t[s]?.toArray()??[]),n}toArray(){let{children:t,numRows:r,names:n}=this,o=t[0]?.data??[],s=Array(r);for(let a=0,c=-1;a<o.length;++a)for(let l=0;l<o[a].length;++l)s[++c]=kt(n,t,a,l);return s}*[Symbol.iterator](){let{children:t,names:r}=this,n=t[0]?.data??[];for(let o=0;o<n.length;++o)for(let s=0;s<n[o].length;++s)yield kt(r,t,o,s)}at(t){let{names:r,children:n,numRows:o}=this;if(t<0||t>=o)return null;let[{offsets:s}]=n,a=q(s,t);return kt(r,n,a,t-s[a])}get(t){return this.at(t)}};function Re(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function kt(e,t,r,n){let o={};for(let s=0;s<e.length;++s)o[e[s]]=t[s].data[r].at(n);return o}function ze(e,t){return He(ee(e),t)}function He(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:o}=e,{version:s,fields:a,dictionaryTypes:c}=r,l=new Map,g=Pe(t,s,l),h=new Map;for(let f of n){let{id:I,data:O,isDelta:U,body:j}=f,m=c.get(I),A=Rt(m,g({...O,body:j}));if(h.has(I)){let Z=h.get(I);U||Z.clear(),Z.add(A)}else{if(U)throw new Error("Delta update can not be first dictionary batch.");h.set(I,Ut(m).add(A))}}h.forEach((f,I)=>l.set(I,f.done()));let u=a.map(f=>Ut(f.type));for(let f of o){let I=g(f);a.forEach((O,U)=>u[U].add(Rt(O.type,I)))}return new Et(r,u.map(f=>f.done()))}function Pe(e,t,r){let n={version:t,options:e,dictionary:o=>r.get(o)};return o=>{let{length:s,nodes:a,buffers:c,body:l}=o,g=-1,h=-1;return{...n,length:s,node:()=>a[++g],buffer:u=>{let{length:f,offset:I}=c[++h];return u?new u(l.buffer,l.byteOffset+I,f/u.BYTES_PER_ELEMENT):l.subarray(I,I+f)},visitAll(u){return u.map(f=>Rt(f.type,this))}}}}function Rt(e,t){let{typeId:r,bitWidth:n,precision:o,scale:s,stride:a,unit:c}=e,{useBigInt:l,useDate:g,useMap:h}=t.options;if(r===i.Null){let{length:m}=t;return new J({length:m,nullCount:m})}let u=t.node(),f=(m,A)=>new m({...u,...A,validity:t.buffer(),values:t.buffer(e.values)}),I=m=>new m({...u,validity:t.buffer(),offsets:t.buffer(e.offsets),values:t.buffer()}),O=m=>new m({...u,validity:t.buffer(),offsets:t.buffer(e.offsets),children:t.visitAll(e.children)}),U=(m,A)=>new m({...u,...A,validity:t.buffer(),children:t.visitAll(e.children)}),j=g?m=>new et(f(m)):f;switch(r){case i.Bool:return f(Q);case i.Int:case i.Time:case i.Duration:return f(n===64&&!l?M:R);case i.Float:return f(o===F.HALF?K:R);case i.Date:return j(c===_.DAY?rt:Zt);case i.Timestamp:return j(c===w.SECOND?nt:c===w.MILLISECOND?Wt:c===w.MICROSECOND?st:ot);case i.Decimal:return f(tt,{bitWidth:n,scale:s});case i.Interval:return f(c===C.DAY_TIME?at:c===C.YEAR_MONTH?it:ct);case i.FixedSizeBinary:return f(yt,{stride:a});case i.Utf8:return I(dt);case i.LargeUtf8:return I(ft);case i.Binary:return I(lt);case i.LargeBinary:return I(ut);case i.List:return O(pt);case i.LargeList:return O(ht);case i.Map:return O(h?vt:It);case i.FixedSizeList:return U(gt,{stride:a});case i.Struct:return U(bt,{names:e.children.map(m=>m.name)});case i.Dictionary:{let{id:m,keys:A}=e;return new At({...u,validity:t.buffer(),values:t.buffer(A.values),dictionary:t.dictionary(m)})}case i.Union:{t.version<E.V5&&t.buffer();let m=e.mode===H.Sparse,A=t.buffer(Tt),Z=m?null:t.buffer(e.offsets),ne=t.visitAll(e.children),se=e.typeIds.reduce((Ht,oe,ae)=>(Ht[oe]=ae,Ht),{}),zt={...u,map:se,typeIds:A,offsets:Z,children:ne};return m?new $(zt):new xt(zt)}default:throw new Error(`Unsupported type: ${r}, (${k(i,r)})`)}}export{_ as DateUnit,ie as Endianness,C as IntervalUnit,F as Precision,w as TimeUnit,i as Type,H as UnionMode,E as Version,ze as tableFromIPC};

@@ -29,6 +29,5 @@ /**

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -39,3 +38,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -48,3 +46,2 @@ });

offsets: import("./types.js").OffsetArray;
typeIds: Int8Array;
children: Batch<any>[];

@@ -125,6 +122,5 @@ /**

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -135,3 +131,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -161,6 +156,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -171,3 +165,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -201,6 +194,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -211,3 +203,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -233,3 +224,3 @@ });

*/
constructor(options: {
constructor({ bitWidth, scale, ...rest }: {
length: number;

@@ -300,6 +291,5 @@ nullCount: number;

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -310,3 +300,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -328,6 +317,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -338,3 +326,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -356,6 +343,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -366,3 +352,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -385,6 +370,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -395,3 +379,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -415,6 +398,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -425,3 +407,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -443,6 +424,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -453,3 +433,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -472,6 +451,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -482,3 +460,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -516,11 +493,11 @@ });

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {Uint8Array} [options.values] Values buffer
* @param {Batch[]} [options.children] Children batches
* @param {number} options.stride The fixed stride (size) of values.
*/
constructor(options: {
constructor({ stride, ...rest }: {
length: number;
nullCount: number;
validity?: Uint8Array;
values?: import("./types.js").TypedArray;
values?: Uint8Array;
children?: Batch<any>[];

@@ -552,6 +529,5 @@ stride: number;

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -562,3 +538,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -582,6 +557,5 @@ });

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches
*/
constructor({ length, nullCount, validity, values, offsets, typeIds, children }: {
constructor({ length, nullCount, validity, values, offsets, children }: {
length: number;

@@ -592,3 +566,2 @@ nullCount: number;

offsets?: import("./types.js").OffsetArray;
typeIds?: Int8Array;
children?: Batch<any>[];

@@ -610,18 +583,20 @@ });

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int32Array} [options.offsets] Offsets buffer
* @param {Batch[]} options.children Children batches
* @param {Int8Array} options.typeIds Union type ids buffer
* @param {Batch[]} options.children Children batches
* @param {Record<string,number>} options.map A typeId to children index map
* @param {Record<string, number>} options.map A typeId to children index map
*/
constructor(options: {
constructor({ typeIds, map, ...rest }: {
length: number;
nullCount: number;
validity?: Uint8Array;
offsets?: import("./types.js").OffsetArray;
offsets?: Int32Array;
children: Batch<any>[];
typeIds: Int8Array;
children: Batch<any>[];
map: Record<string, number>;
});
/** @type {Record<number,number>} */
map: Record<number, number>;
/** @type {Int8Array} */
typeIds: Int8Array;
/** @type {Record<string, number>} */
map: Record<string, number>;
/**

@@ -655,3 +630,3 @@ * @param {number} index The value index.

*/
constructor(options: {
constructor({ names, ...rest }: {
length: number;

@@ -675,16 +650,14 @@ nullCount: number;

* @param {object} options Batch options.
* @param {import('./types.js').DataType} options.type The field data type
* @param {number} options.length The length of the batch
* @param {number} options.nullCount The null value count
* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {import('./types.js').IntegerArray} options.values Values buffer
* @param {import('./column.js').Column<T>} options.dictionary
* The dictionary of column values.
*/
constructor(options: {
type: import("./types.js").DataType;
constructor({ dictionary, ...rest }: {
length: number;
nullCount: number;
validity?: Uint8Array;
values?: import("./types.js").TypedArray;
values: import("./types.js").IntegerArray;
dictionary: import("./column.js").Column<T>;

@@ -711,11 +684,11 @@ });

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {Uint8Array} [options.values] Values buffer
* @param {Batch[]} [options.children] Children batches
* @param {number} options.stride The fixed stride (size) of values.
*/
constructor(options: {
constructor({ stride, ...rest }: {
length: number;
nullCount: number;
validity?: Uint8Array;
values?: import("./types.js").TypedArray;
values?: Uint8Array;
children?: Batch<any>[];

@@ -722,0 +695,0 @@ stride: number;

@@ -23,3 +23,4 @@ export { tableFromIPC } from "./table-from-ipc.js";

export type UnionMode_ = typeof UnionMode[keyof typeof UnionMode];
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
export type IntegerArray = Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array;
export type TypedArray = IntegerArray | Float32Array | Float64Array;
export type OffsetArray = Int32Array | BigInt64Array;

@@ -26,0 +27,0 @@ export type IntArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;

@@ -21,3 +21,4 @@ import { Version, Endianness, MessageHeader, Precision, DateUnit, TimeUnit, IntervalUnit, UnionMode } from './constants.js';

export type UnionMode_ = typeof UnionMode[keyof typeof UnionMode];
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
export type IntegerArray = Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array;
export type TypedArray = IntegerArray | Float32Array | Float64Array;
export type OffsetArray = Int32Array | BigInt64Array;

@@ -24,0 +25,0 @@ export type IntArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;

{
"name": "@uwdata/flechette",
"version": "0.0.6",
"version": "0.0.7",
"description": "Fast, lightweight access to Apache Arrow data.",

@@ -36,3 +36,3 @@ "keywords": [

"apache-arrow": "^17.0.0",
"esbuild": "^0.23.0",
"esbuild": "^0.23.1",
"eslint": "^9.9.0",

@@ -39,0 +39,0 @@ "mocha": "^10.7.3",

@@ -75,3 +75,3 @@ # Flechette

Data extraction can be customized using options provided to the table generation method. By default, temporal data is returned as numeric timestamps, 64-int integers are coerced to numbers, and map-typed data is returned as an array of [key, value] pairs. These defaults can be changed via conversion options that push (or remove) transformations to the underlying data batches.
Data extraction can be customized using options provided to the table generation method. By default, temporal data is returned as numeric timestamps, 64-bit integers are coerced to numbers, and map-typed data is returned as an array of [key, value] pairs. These defaults can be changed via conversion options that push (or remove) transformations to the underlying data batches.

@@ -78,0 +78,0 @@ ```js

@@ -36,3 +36,2 @@ import { float64 } from './array-types.js';

* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int8Array} [options.typeIds] Union type ids buffer
* @param {Batch[]} [options.children] Children batches

@@ -46,3 +45,2 @@ */

offsets,
typeIds,
children

@@ -55,3 +53,2 @@ }) {

this.offsets = offsets;
this.typeIds = typeIds;
this.children = children;

@@ -123,4 +120,3 @@

*[Symbol.iterator]() {
const { length } = this;
for (let i = 0; i < length; ++i) {
for (let i = 0; i < this.length; ++i) {
yield this.at(i);

@@ -280,6 +276,6 @@ }

*/
constructor(options) {
super(options);
this.stride = options.bitWidth >> 5, // 8 bits/byte and 4 bytes/uint32;
this.scale = Math.pow(10, options.scale);
constructor({ bitWidth, scale, ...rest }) {
super(rest);
this.stride = bitWidth >> 5, // 8 bits/byte and 4 bytes/uint32;
this.scale = Math.pow(10, scale);
}

@@ -556,10 +552,10 @@

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {Uint8Array} [options.values] Values buffer
* @param {Batch[]} [options.children] Children batches
* @param {number} options.stride The fixed stride (size) of values.
*/
constructor(options) {
super(options);
constructor({ stride, ...rest }) {
super(rest);
/** @type {number} */
this.stride = options.stride;
this.stride = stride;
}

@@ -662,11 +658,13 @@ }

* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').OffsetArray} [options.offsets] Offsets buffer
* @param {Int32Array} [options.offsets] Offsets buffer
* @param {Batch[]} options.children Children batches
* @param {Int8Array} options.typeIds Union type ids buffer
* @param {Batch[]} options.children Children batches
* @param {Record<string,number>} options.map A typeId to children index map
* @param {Record<string, number>} options.map A typeId to children index map
*/
constructor(options) {
super(options);
/** @type {Record<number,number>} */
this.map = options.map;
constructor({ typeIds, map, ...rest }) {
super(rest);
/** @type {Int8Array} */
this.typeIds = typeIds;
/** @type {Record<string, number>} */
this.map = map;
}

@@ -713,6 +711,6 @@

*/
constructor(options) {
super(options);
constructor({ names, ...rest }) {
super(rest);
/** @type {string[]} */
this.names = options.names;
this.names = names;
}

@@ -744,14 +742,14 @@

* @param {object} options Batch options.
* @param {import('./types.js').DataType} options.type The field data type
* @param {number} options.length The length of the batch
* @param {number} options.nullCount The null value count
* @param {Uint8Array} [options.validity] Validity bitmap buffer
* @param {import('./types.js').TypedArray} [options.values] Values buffer
* @param {import('./types.js').IntegerArray} options.values Values buffer
* @param {import('./column.js').Column<T>} options.dictionary
* The dictionary of column values.
*/
constructor(options) {
super(options);
this.cache = options.dictionary.cache();
constructor({ dictionary, ...rest }) {
super(rest);
this.cache = dictionary.cache();
}
/**

@@ -763,2 +761,3 @@ * @param {number} index The value index.

}
/**

@@ -765,0 +764,0 @@ * @param {number} index The value index.

@@ -41,3 +41,3 @@ import {

export type TypedArray =
export type IntegerArray =
| Uint8Array

@@ -50,3 +50,6 @@ | Uint16Array

| BigUint64Array
| BigInt64Array
| BigInt64Array;
export type TypedArray =
| IntegerArray
| Float32Array

@@ -53,0 +56,0 @@ | Float64Array;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc