Closed nshiab closed 8 months ago
It's maybe a decimal value represented as arrow which needs some work (https://github.com/apache/arrow/issues/28804). Try casting to int or float.
Ah! It works! Thanks, @domoritz! But just for my understanding, is this a bug or something I should be aware of?
Decimal handling needs to be improved in Arrow but there are also issues with how DuckDB was maps types to arrow types.
This particular issue is a bit tricky since there is no decimal type in JavaScript. One could argue that you should do the decoding yourself here but I think Arrow could be more ergonomic and return e.g. a float.
We are tracking decimal issues in Arrow (see https://github.com/apache/arrow/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+decimal+label%3A%22Component%3A+JavaScript%22) and it's second on my mental queue (after addressing some bundling issues). I think the issue can be closed here until we improve Arrow.
For now, the workaround is to cast to float or int.
Alright! Thanks a lot for the explanations, @domoritz . :)
What happens?
I loaded some data in a notebook and ran sum() over a column. It returned an array instead of a number.
See notebook here: https://observablehq.com/d/8821f2b8f94550a2
And see the screenshot attached.
To Reproduce
You can fork the observable notebook here: https://observablehq.com/d/8821f2b8f94550a2
Browser/Environment:
Version 120.0.6099.234 (Official Build) (arm64)
Device:
Macbook Pro
DuckDB-Wasm Version:
Not sure of the version, it's within Observable Notebooks
DuckDB-Wasm Deployment:
Not sure of the version, it's within Observable Notebooks
Full Name:
Nael Shiab
Affiliation:
CBC/Radio-Canada