Fix type inference for int64/uint64 (BIGINT) and float64 (DOUBLE) #316
+157
−7
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
Fixes type inference bugs for numeric parameters:
SqlIntegerinstead ofSqlBigInt(fixes inferType is incorrect for int64 and uint64 in parameters.go, should be SqlBigInt instead of SqlInteger #250)SqlFloatinstead ofSqlDouble(fixes float64 parameters incorrectly mapped to SqlFloat (32-bit) #314)Problems Fixed
1. int64/uint64 → BIGINT
When inserting int64/uint64 values into BIGINT columns, the driver was sending them with type
INTEGERinstead ofBIGINT, causing the server to reject large values with error:Additionally, int64 was using
strconv.Itoa(int(value))which truncates values larger than int32.2. float64 → DOUBLE
When inserting float64 values into DOUBLE columns, the driver was sending them with type
FLOAT(32-bit) instead ofDOUBLE(64-bit), causing:3. Panic with explicit Parameter type
When using
Parameter{Type: SqlBigInt, Value: int64(...)}with a non-string value, the driver panicked atconvertNamedValuesToSparkParamsdue to unsafe type assertion.Changes
parameters.go:strconv.FormatInt()and maps toSqlBigIntSqlBigIntSqlDoubleinstead ofSqlFloatconvertNamedValuesToSparkParamsTest plan
TestParameter_BigInt)TestParameter_Float)🤖 Generated with Claude Code