finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
7.73k stars 1.05k forks source link

Incorrect serialization of infinite values: Floats to 'null', Integers to '-2147483648' #2466

Closed kryaksy closed 7 months ago

kryaksy commented 7 months ago

Bug Report

Specifically, the problem arises during the serialization of this data using the to_json and to_columns methods. Notably, the serialization appears correct when using the to_csv method. The issue is demonstrated in the provided reproduction link.

image

Steps to Reproduce:

Please refer to the codeSandbox link for a self-explanatory code sample demonstrating the issue.

Expected Result:

-/+Infinity values should be correctly serialized, maintaining their integrity across different methods.

Actual Result:

Environment:

texodus commented 7 months ago

Thanks for the report, this is not a bug.

It's possible we could elaborate on support for these values for "float" types only, but discussion around this should go in its own feature request if anyone cares to elaborate on what the real use case for this would be.

kryaksy commented 7 months ago

Thanks for the prompt response, @texodus .

I understand your points regarding integers. However, for floats, while these values may be irrelevant and possibly undesirable for visualization libraries outside of data grids, there are many scenarios where data grids are more frequently used and where handling these values becomes necessary. In such contexts, there can be significant semantic differences between NaN, +/-Infinity, and null values. I am confident that in my specific situation, acknowledging these distinctions is crucial.

Considering this, I wonder if it's feasible to accurately serialize these values with a method akin to to_json. Would it be suitable to open a feature request for this particular issue?