Skip to content

Commit 7687b15

Browse files
committed
Fix for handling NUMBER scale correctly when use_high_precision is false :
When use_high_precision is false, NUMBER columns with non-zero scale are incorrectly returned as Int64 instead of Float64, causing data descrepency. This fix checks the scale value to determine the appropriate Arrow type (Int64 vs Float64) to set the behaviour per documentation at https://arrow.apache.org/adbc/main/driver/snowflake.html
1 parent fe23d35 commit 7687b15

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

go/adbc/driver/snowflake/record_reader.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,12 @@ func rowTypesToArrowSchema(_ context.Context, ld gosnowflake.ArrowStreamLoader,
351351
Scale: int32(srcMeta.Scale),
352352
}
353353
} else {
354-
fields[i].Type = arrow.PrimitiveTypes.Int64
354+
// Check scale to determine if this is an integer or decimal
355+
if srcMeta.Scale == 0 {
356+
fields[i].Type = arrow.PrimitiveTypes.Int64
357+
} else {
358+
fields[i].Type = arrow.PrimitiveTypes.Float64
359+
}
355360
}
356361
case "real":
357362
fields[i].Type = arrow.PrimitiveTypes.Float64

0 commit comments

Comments
 (0)