Handle integer-backed Arrow decimals via logical type metadata#653
Open
rahul-iyer wants to merge 2 commits into
Open
Handle integer-backed Arrow decimals via logical type metadata#653rahul-iyer wants to merge 2 commits into
rahul-iyer wants to merge 2 commits into
Conversation
adsharma
reviewed
Jul 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ADBC exposes Arrow schemas and arrays, but some Snowflake types are not fully recoverable from the Arrow
physical type alone. In particular, Snowflake NUMBER/DECIMAL columns may arrive with their semantics
encoded in field metadata rather than standard Arrow decimal format.
The Snowflake ADBC driver documents two relevant metadata channels:
Without interpreting those annotations, Ladybug can bind Snowflake decimals as plain numeric storage
types.
What changed
Added Snowflake-specific decoding for decimal types from:
Added decimal scanning support for Snowflake FIXED values when the Arrow batch is:
Refactored Arrow metadata handling into separate decoder components:
Design
The refactor separates three concerns:
The rest of the Arrow pipeline still consumes normalized logical type information only. This keeps
Snowflake-specific behavior out of the core binding and scan code paths except where the recovered
logical type is applied.
This structure is intended to make future support for other sources, such as Databricks/Spark-specific
metadata, straightforward to add as separate decoders rather than as scattered conditionals.
https://arrow.apache.org/adbc/current/driver/snowflake.html
DATA_TYPEDATA_TYPE=NUMBER(12,4)DECIMAL(12,4)DATA_TYPEwith implicit scaleDATA_TYPE=NUMBER(18)DECIMAL(18,0)0.DATA_TYPEDATA_TYPE=NUMERIC(10,3)orDATA_TYPE=DECIMAL(10,3)DECIMAL(10,3)logicalType=FIXED,precision=7,scale=2INT8/16/32/64,UINT8/16/32/64)DECIMAL(7,2)logicalType=FIXED,precision=9,scale=2FLOAT,DOUBLE)DECIMAL(9,2)DATA_TYPEplus validlogicalType=FIXEDmetadataDECIMAL(p,s)fromlogicalTypemetadataDATA_TYPEparsing fails, SnowflakelogicalTypeparsing is tried next.DATA_TYPE=NUMBER(12,4)plus genericlogicalType=DECIMAL,precision=9,scale=3DECIMAL(12,4)