Skip to content

Commit

Permalink
Make directLoadTable return null if batchIndex > max table index, sto…
Browse files Browse the repository at this point in the history
…p converting buffers to hex string on checksum types by default
  • Loading branch information
guilledk committed Apr 23, 2024
1 parent e9b50ce commit 4d60897
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export class ArrowBatchCache {
return [tableName, null];

const metadata = await ArrowBatchProtocol.readFileMetadata(filePath);
if (batchIndex >= metadata.batches.length)
return [tableName, null];

return [
tableName,
await ArrowBatchProtocol.readArrowBatchTable(
Expand Down
4 changes: 2 additions & 2 deletions src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ const decodeFunctions = {
string: (value: any) => value,

checksum160: (bytes: string) => {
return Buffer.from(bytes, 'base64').toString('hex');
return Buffer.from(bytes, 'base64');
},
checksum256: (bytes: string) => {
return Buffer.from(bytes, 'base64').toString('hex');
return Buffer.from(bytes, 'base64');
}
};

Expand Down

0 comments on commit 4d60897

Please sign in to comment.