Skip to content

fix(snowflake): convert Decimal columns to float64 instead of object dtype#11994

Open
fadil4u wants to merge 2 commits intoibis-project:mainfrom
fadil4u:fix/snowflake-decimal-float64
Open

fix(snowflake): convert Decimal columns to float64 instead of object dtype#11994
fadil4u wants to merge 2 commits intoibis-project:mainfrom
fadil4u:fix/snowflake-decimal-float64

Conversation

@fadil4u
Copy link
Copy Markdown

@fadil4u fadil4u commented Apr 20, 2026

Issue

When querying a Snowflake table with NUMBER(p, s) columns where scale > 0 (e.g. NUMBER(38, 8)), the resulting pandas DataFrame has object dtype instead of float64: see #11990

t = con.table("MY_TABLE")  # has NUMBER(38, 8) column
df = t.execute()
print(df["my_col"].dtype)  # object, expected float64

Snowflake returns NUMBER(38, 8) as double in Arrow format, so the data is already float64 after _fetch_from_cursor. However __pandas_result__ was defaulting to plain PandasData as the data_mapper, which runs normalize_decimal on every value — wrapping each float64 in a Python decimal.Decimal object and producing object dtype.

Fix

  1. Override execute() in the Snowflake backend to pass data_mapper=SnowflakePandasData to __pandas_result__
  2. Add convert_Decimal to SnowflakePandasData that casts to float64 instead of running normalize_decimal

Issues closed

@github-actions github-actions Bot added the snowflake The Snowflake backend label Apr 20, 2026
@NickCrews
Copy link
Copy Markdown
Contributor

see the linked issue, I'm not yet convinced this is a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snowflake The Snowflake backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Snowflake: NUMBER columns return as object dtype via Arrow (Decimal128 not cast to float64)

2 participants