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

Extension incorrectly parses int64 type #97

Open
Yanpas opened this issue Feb 6, 2024 · 6 comments
Open

Extension incorrectly parses int64 type #97

Yanpas opened this issue Feb 6, 2024 · 6 comments

Comments

@Yanpas
Copy link

Yanpas commented Feb 6, 2024

We store in one column int64 values.

In grid view last two digits become zeroes.
In visualization they are rendered as int32_min.

E.g.
1608532083302613811 in grid view becomes 1608532083302613800. In visualization: -2,147,483,648

@jshinonome
Copy link
Owner

It is because javascript doesn't support int64 type. You have to convert it to string before load them in grid or virtualization mode.

@Yanpas
Copy link
Author

Yanpas commented Feb 7, 2024

The bad thing is that extension silently misleads about the data that's contained in the table (this big number in the example was an id).

JS has BigInt class to deal with larger integer types.

Also I'm fine with treating it as string but I guess sorting will work incorrect then.

@jshinonome
Copy link
Owner

The underlying lib node-q doesn't use bigint. Though my lib (jkdb) uses bigint, sending json message to grid or virtualization still has to convert bigint to general number. I will think if it is possible to send arrow format. However, I am less likely to implement the feature for vscode-q. You could try kx's official plugin and ask them to fix it.

@Yanpas
Copy link
Author

Yanpas commented Feb 7, 2024

This is already available in vscode-q from a quick overlook:
https://github.com/michaelwittig/node-q?tab=readme-ov-file#types-footnote5

There's a long2number parameter of q.ConnectionParameters

@jshinonome
Copy link
Owner

Grid/virtualization mode is an independent html page from vscode-q conn manager, when vscode-q got data from kdb, it has to send data to grid/virtualization html page. The data conversion caused losing precision. Sending as string data type to grid/virtualization page, the chart cannot display properly.

@Yanpas
Copy link
Author

Yanpas commented Feb 8, 2024

Side question: do debug breakpoints for typescript code of the extension (client) work in your environment? Looks like mine vscode can't find sourcemaps:
image
The diagnostic tells:

We couldn't find a corresponding source location, and didn't find any source with the name client.ts.
How did you expect this file to be loaded? (If you have a compilation step, you should pick 'sourcemap')

I've tried both Webpack & Launch Extension and npx tsc and then Launch Extension

PS want to experiment with https://github.com/sidorares/json-bigint or encoding everything as an object with manual deserialization on webview side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants