nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: snowflakedb/gosnowflake
Pull request #1384 (2025-04-28 14:58:55)

SNOW-2052246 Fix scan type for higher precision
### Description

SNOW-2052246 Fixed scan type when higher precision was enabled.

### Checklist
- [x] Created tests which fail without the change (if possible)
- [x] Extended the README / documentation, if necessary



Patch:
diff --git a/converter.go b/converter.go
index 1ef32e8..ee6f4fa 100644
--- a/converter.go
+++ b/converter.go
@@ -143,6 +143,12 @@ func snowflakeTypeToGo(ctx context.Context, dbtype snowflakeType, scale int64, f
 	structuredTypesEnabled := structuredTypesEnabled(ctx)
 	switch dbtype {
 	case fixedType:
+		if higherPrecisionEnabled(ctx) {
+			if scale == 0 {
+				return reflect.TypeOf(&big.Int{})
+			}
+			return reflect.TypeOf(&big.Float{})
+		}
 		if scale == 0 {
 			return reflect.TypeOf(int64(0))
 		}


Test patch:
diff --git a/arrow_test.go b/arrow_test.go
index 27722a2..1c8b150 100644
--- a/arrow_test.go
+++ b/arrow_test.go
@@ -508,10 +508,10 @@ func TestArrowVariousTypes(t *testing.T) {
 		if ct[0].Name() != "C1" || ct[1].Name() != "C2" || ct[2].Name() != "C3" || ct[3].Name() != "C4" || ct[4].Name() != "C5" || ct[5].Name() != "C6" {
 			dbt.Errorf("failed to get column names: %#v", ct)
 		}
-		if ct[0].ScanType() != reflect.TypeOf(float64(0)) {
+		if ct[0].ScanType() != reflect.TypeOf(&big.Float{}) {
 			dbt.Errorf("failed to get scan type. expected: %v, got: %v", reflect.TypeOf(float64(0)), ct[0].ScanType())
 		}
-		if ct[1].ScanType() != reflect.TypeOf(int64(0)) {
+		if ct[1].ScanType() != reflect.TypeOf(&big.Int{}) {
 			dbt.Errorf("failed to get scan type. expected: %v, got: %v", reflect.TypeOf(int64(0)), ct[1].ScanType())
 		}
 		var pr, sc int64
diff --git a/converter_test.go b/converter_test.go
index c3c889d..d1c1c20 100644
--- a/converter_test.go
+++ b/converter_test.go
@@ -146,6 +146,8 @@ func TestSnowflakeTypeToGo(t *testing.T) {
 	}{
 		{in: fixedType, scale: 0, out: reflect.TypeOf(int64(0)), ctx: context.Background()},
 		{in: fixedType, scale: 2, out: reflect.TypeOf(float64(0)), ctx: context.Background()},
+		{in: fixedType, scale: 0, out: reflect.TypeOf(&big.Int{}), ctx: WithHigherPrecision(context.Background())},
+		{in: fixedType, scale: 2, out: reflect.TypeOf(&big.Float{}), ctx: WithHigherPrecision(context.Background())},
 		{in: realType, scale: 0, out: reflect.TypeOf(float64(0)), ctx: context.Background()},
 		{in: textType, scale: 0, out: reflect.TypeOf(""), ctx: context.Background()},
 		{in: dateType, scale: 0, out: reflect.TypeOf(time.Now()), ctx: context.Background()},