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

Arrow decimal type getting read as integer #2582

Open
droher opened this issue Mar 31, 2024 · 2 comments
Open

Arrow decimal type getting read as integer #2582

droher opened this issue Mar 31, 2024 · 2 comments
Labels
bug Concrete, reproducible bugs

Comments

@droher
Copy link

droher commented Mar 31, 2024

Bug Report

Steps to Reproduce:

Run this code in jupyterlab (duckdb version was 0.10.1 but should work on any recent version)

import perspective
import duckdb
import pyarrow as pa
import io

table = duckdb.sql("SELECT 3.14::DECIMAL AS decimal_col, 3.14::FLOAT AS float_col").arrow()
buffer = io.BytesIO()

with pa.ipc.new_file(buffer, table.schema) as writer:
    writer.write_table(table)

bytes_object = buffer.getvalue()

perspective_table = perspective.Table(bytes_object)
perspective.PerspectiveWidget(perspective_table)

Expected Result:

Values should be the same
image

Actual Result:

Decimal value is deserialized as the internal Arrow representation of a decimal type (an integer)
image

Environment:

perspective-python 2.10.0 running on Python 3.11, jupyterlab 3.6.5, MacOS 14.4.1.

Additional Context:

I first noticed this issue in the JS package but it was easier for me to create a replicable example in Python.

@timkpaine
Copy link
Member

This is explicit, unsure if it's intentional

if (src == "decimal" || src == "decimal128" || src == "int64") {

@timkpaine timkpaine added the bug Concrete, reproducible bugs label Apr 11, 2024
@texodus
Copy link
Member

texodus commented Apr 12, 2024

Perspective doesn't have internal support for decimal yet. We can change this behavior to cast to float instead which is probably more useful (for the purposes of data visualization at least).

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

No branches or pull requests

3 participants