Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't truncate BigInts #268

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/result/ArrowResultConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default class ArrowResultConverter implements IResultsProvider<Array<any>
}

// Return other values as is
return typeof value === 'bigint' ? Number(value) : value;
return value;
}

private convertThriftTypes(record: Record<string, any>): any {
Expand Down
8 changes: 1 addition & 7 deletions lib/result/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Int64 from 'node-int64';
import {
Schema,
Field,
Expand Down Expand Up @@ -49,12 +48,7 @@ function convertJSON(value: any, defaultValue: any): any {
}

function convertBigInt(value: any): any {
if (typeof value === 'bigint') {
return Number(value);
}
if (value instanceof Int64) {
return value.toNumber();
}
Comment on lines -55 to -57
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, these lines has to be kept, but instead of converting Int64 to Number it has to be converted to BigInt

// Do not convert a BigInt away from the BigInt type
return value;
}

Expand Down