From 7f315562de509ba4422a4cd0055e661837b7ff44 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Wed, 22 Nov 2023 14:24:16 -0500 Subject: [PATCH] fmt --- src/field.ts | 10 +++--- src/record-batch.ts | 2 +- src/vector.ts | 82 ++++++++++++++++++++++----------------------- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/field.ts b/src/field.ts index 4a2e93d..a0bf1d7 100644 --- a/src/field.ts +++ b/src/field.ts @@ -67,7 +67,7 @@ export function parseField(buffer: ArrayBuffer, ptr: number): arrow.Field { for (let i = 0; i < nChildren; i++) { childrenFields[i] = parseField( buffer, - dataView.getUint32(ptrToChildrenPtrs + i * 4, true) + dataView.getUint32(ptrToChildrenPtrs + i * 4, true), ); } @@ -194,7 +194,7 @@ function parseFlags(flag: bigint): Flags { function parseNullTerminatedString( dataView: DataView, ptr: number, - maxBytesToRead: number = Infinity + maxBytesToRead: number = Infinity, ): string { const maxPtr = Math.min(ptr + maxBytesToRead, dataView.byteLength); let end = ptr; @@ -213,7 +213,7 @@ function parseNullTerminatedString( */ function parseMetadata( dataView: DataView, - ptr: number + ptr: number, ): Map | null { const numEntries = dataView.getInt32(ptr, true); if (numEntries === 0) { @@ -227,14 +227,14 @@ function parseMetadata( const keyByteLength = dataView.getInt32(ptr, true); ptr += 4; const key = UTF8_DECODER.decode( - new Uint8Array(dataView.buffer, ptr, keyByteLength) + new Uint8Array(dataView.buffer, ptr, keyByteLength), ); ptr += keyByteLength; const valueByteLength = dataView.getInt32(ptr, true); ptr += 4; const value = UTF8_DECODER.decode( - new Uint8Array(dataView.buffer, ptr, valueByteLength) + new Uint8Array(dataView.buffer, ptr, valueByteLength), ); ptr += valueByteLength; diff --git a/src/record-batch.ts b/src/record-batch.ts index 4328a49..02278a6 100644 --- a/src/record-batch.ts +++ b/src/record-batch.ts @@ -20,7 +20,7 @@ export function parseRecordBatch( buffer: ArrayBuffer, arrayPtr: number, schemaPtr: number, - copy: boolean = false + copy: boolean = false, ): arrow.RecordBatch { const field = parseField(buffer, schemaPtr); if (!isStructField(field)) { diff --git a/src/vector.ts b/src/vector.ts index 2fa994c..44a30e1 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -16,7 +16,7 @@ export function parseVector( buffer: ArrayBuffer, ptr: number, dataType: T, - copy: boolean = false + copy: boolean = false, ): arrow.Vector { const data = parseData(buffer, ptr, dataType, copy); return arrow.makeVector(data); @@ -26,7 +26,7 @@ export function parseData( buffer: ArrayBuffer, ptr: number, dataType: T, - copy: boolean = false + copy: boolean = false, ): arrow.Data { const dataView = new DataView(buffer); @@ -50,7 +50,7 @@ export function parseData( buffer, dataView.getUint32(ptrToChildrenPtrs + i * 4, true), dataType.children[i].type, - copy + copy, ); } @@ -68,7 +68,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const byteLength = (length * dataType.bitWidth) / 8; const data = copy @@ -90,7 +90,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // bitwidth doesn't exist on float types I guess const byteLength = length * dataType.ArrayType.BYTES_PER_ELEMENT; @@ -113,7 +113,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // Boolean arrays are bit-packed. This means the byte length should be the number of elements, @@ -139,7 +139,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const byteLength = (length * dataType.bitWidth) / 8; const data = copy @@ -161,13 +161,13 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); let byteWidth = getDateByteWidth(dataType); const data = copy ? new dataType.ArrayType( - copyBuffer(dataView.buffer, dataPtr, length * byteWidth) + copyBuffer(dataView.buffer, dataPtr, length * byteWidth), ) : new dataType.ArrayType(dataView.buffer, dataPtr, length); return arrow.makeData({ @@ -186,7 +186,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const byteLength = (length * dataType.bitWidth) / 8; const data = copy @@ -208,13 +208,13 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); let byteWidth = getTimeByteWidth(dataType); const data = copy ? new dataType.ArrayType( - copyBuffer(dataView.buffer, dataPtr, length * byteWidth) + copyBuffer(dataView.buffer, dataPtr, length * byteWidth), ) : new dataType.ArrayType(dataView.buffer, dataPtr, length); return arrow.makeData({ @@ -233,7 +233,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // What's the bitwidth here? @@ -259,7 +259,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const valueOffsets = copy @@ -267,8 +267,8 @@ export function parseData( copyBuffer( dataView.buffer, offsetsPtr, - (length + 1) * Int32Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int32Array.BYTES_PER_ELEMENT, + ), ) : new Int32Array(dataView.buffer, offsetsPtr, length + 1); @@ -296,14 +296,14 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // The original value offsets are an Int64Array, which Arrow JS does not yet support natively const originalValueOffsets = new BigInt64Array( dataView.buffer, offsetsPtr, - length + 1 + length + 1, ); // Copy the Int64Array to an Int32Array @@ -339,7 +339,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const valueOffsets = copy @@ -347,8 +347,8 @@ export function parseData( copyBuffer( dataView.buffer, offsetsPtr, - (length + 1) * Int32Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int32Array.BYTES_PER_ELEMENT, + ), ) : new Int32Array(dataView.buffer, offsetsPtr, length + 1); @@ -376,14 +376,14 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // The original value offsets are an Int64Array, which Arrow JS does not yet support natively const originalValueOffsets = new BigInt64Array( dataView.buffer, offsetsPtr, - length + 1 + length + 1, ); // Copy the Int64Array to an Int32Array @@ -419,16 +419,16 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const data = copy ? new dataType.ArrayType( - copyBuffer(dataView.buffer, dataPtr, length * dataType.byteWidth) + copyBuffer(dataView.buffer, dataPtr, length * dataType.byteWidth), ) : new dataType.ArrayType( dataView.buffer, dataPtr, - length * dataType.byteWidth + length * dataType.byteWidth, ); return arrow.makeData({ type: dataType, @@ -447,15 +447,15 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); const valueOffsets = copy ? new Int32Array( copyBuffer( dataView.buffer, offsetsPtr, - (length + 1) * Int32Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int32Array.BYTES_PER_ELEMENT, + ), ) : new Int32Array(dataView.buffer, offsetsPtr, length + 1); @@ -478,14 +478,14 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); // The original value offsets are an Int64Array, which Arrow JS does not yet support natively const originalValueOffsets = new BigInt64Array( dataView.buffer, offsetsPtr, - length + 1 + length + 1, ); // Copy the Int64Array to an Int32Array @@ -514,7 +514,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); return arrow.makeData({ @@ -533,7 +533,7 @@ export function parseData( dataView.buffer, validityPtr, length, - copy + copy, ); return arrow.makeData({ @@ -554,8 +554,8 @@ export function parseData( copyBuffer( dataView.buffer, offsetsPtr, - (length + 1) * Int32Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int32Array.BYTES_PER_ELEMENT, + ), ) : new Int32Array(dataView.buffer, offsetsPtr, length + 1); @@ -564,8 +564,8 @@ export function parseData( copyBuffer( dataView.buffer, typeIdsPtr, - (length + 1) * Int8Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int8Array.BYTES_PER_ELEMENT, + ), ) : new Int8Array(dataView.buffer, typeIdsPtr, length + 1); @@ -588,8 +588,8 @@ export function parseData( copyBuffer( dataView.buffer, typeIdsPtr, - (length + 1) * Int8Array.BYTES_PER_ELEMENT - ) + (length + 1) * Int8Array.BYTES_PER_ELEMENT, + ), ) : new Int8Array(dataView.buffer, typeIdsPtr, length + 1); @@ -633,7 +633,7 @@ function parseNullBitmap( buffer: ArrayBuffer, validityPtr: number, length: number, - copy: boolean + copy: boolean, ): NullBitmap { if (validityPtr === 0) { return null; @@ -653,7 +653,7 @@ function parseNullBitmap( function copyBuffer( buffer: ArrayBuffer, ptr: number, - byteLength: number + byteLength: number, ): ArrayBuffer { const newBuffer = new ArrayBuffer(byteLength); const newBufferView = new Uint8Array(newBuffer);