Skip to content

Commit

Permalink
Make separate method for sending raw rows vs normal
Browse files Browse the repository at this point in the history
  • Loading branch information
guilledk committed Jun 15, 2024
1 parent 938b747 commit 9af413a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guilledk/arrowbatch-nodejs",
"version": "1.0.0-rc34",
"version": "1.0.0-rc35",
"description": "Arrow Batch Storage protocol",
"main": "./build/src/index.js",
"bin": {
Expand Down
11 changes: 8 additions & 3 deletions src/reader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ export class ArrowBatchReader extends ArrowBatchContext {
this._intermediateBuffers = this._createBuffer();
}

pushRow(row: any[]) {
pushRawRow(row: any[]) {
for (const [i, mapping] of this.tableMapping.entries())
this._intermediateBuffers.columns.get(mapping.name).push(decodeRowValue(mapping, row[i]));
}

pushRow(row: any[]) {
for (const [i, mapping] of this.tableMapping.entries())
this._intermediateBuffers.columns.get(mapping.name).push(row[i]);
}

async init() {
// context init will reload disks
await super.init();
Expand Down Expand Up @@ -102,7 +107,7 @@ export class ArrowBatchReader extends ArrowBatchContext {

// load all rows into ram buffers
for (let i = 0; i < wipTable.numRows; i++)
this.pushRow(wipTable.get(i).toArray());
this.pushRawRow(wipTable.get(i).toArray());
}

// load initial state from disk tables
Expand Down Expand Up @@ -288,7 +293,7 @@ export class ArrowBatchReader extends ArrowBatchContext {
const structRow = table.get(Number(relativeIndex));

if (!structRow)
throw new Error(`Could not find row root-${adjustedOrdinal}-${batchIndex}-${relativeIndex}!`);
throw new Error(`Could not find row ${ordinal}! ao: ${adjustedOrdinal} bi: ${batchIndex} ri: ${relativeIndex}`);

const row = structRow.toArray();
this.tableMapping.forEach((m, i) => {
Expand Down

0 comments on commit 9af413a

Please sign in to comment.