Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyparquet

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyparquet - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "hyparquet",
"version": "0.3.0",
"version": "0.3.1",
"description": "parquet file parser for javascript",

@@ -5,0 +5,0 @@ "keywords": [

@@ -187,6 +187,7 @@ import { Encoding, PageType } from './constants.js'

if (typeof data[0] === 'number') {
return data.map(v => v * scaleFactor)
return scaleFactor === 1 ? data : data.map(v => v * scaleFactor)
} else if (typeof data[0] === 'bigint') {
return scaleFactor === 1 ? data : data.map(v => Number(v) * scaleFactor)
} else {
// TODO: parse byte string
throw new Error('parquet decimal byte string not supported')
return data.map(v => parseDecimal(v) * scaleFactor)
}

@@ -211,1 +212,16 @@ }

}
/**
* Parse decimal from byte array.
*
* @param {Uint8Array} bytes
* @returns {number}
*/
function parseDecimal(bytes) {
// TODO: handle signed
let value = 0
for (const byte of bytes) {
value = value << 8 | byte
}
return value
}

@@ -60,8 +60,7 @@ import { Encoding, ParquetType } from './constants.js'

offset += plainObj.byteLength
} else if (daph.encoding === Encoding.PLAIN_DICTIONARY) {
const plainObj = readPlain(dataView, columnMetadata.type, nval, offset)
values = plainObj.value
offset += plainObj.byteLength
// TODO: dictionary decoding
} else if (daph.encoding === Encoding.RLE_DICTIONARY) {
} else if (
daph.encoding === Encoding.PLAIN_DICTIONARY ||
daph.encoding === Encoding.RLE_DICTIONARY ||
daph.encoding === Encoding.RLE
) {
// bit width is stored as single byte

@@ -182,3 +181,5 @@ let bitWidth

*/
export function assembleObjects(definitionLevels, repetitionLevels, value, isNull, nullValue, maxDefinitionLevel, prevIndex) {
export function assembleObjects(
definitionLevels, repetitionLevels, value, isNull, nullValue, maxDefinitionLevel, prevIndex
) {
let vali = 0

@@ -185,0 +186,0 @@ let started = false

@@ -135,3 +135,5 @@

// TODO: extract SchemaElement for this column
const columnData = readColumn(arrayBuffer, bufferOffset, rowGroup, columnMetadata, metadata.schema)
const columnData = readColumn(
arrayBuffer, bufferOffset, rowGroup, columnMetadata, metadata.schema
)
if (columnData.length !== Number(rowGroup.num_rows)) {

@@ -138,0 +140,0 @@ throw new Error('parquet column length does not match row group length')

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