Skip to content

Conversation

@vikrantpuppala
Copy link
Collaborator

Summary

  • Fixes a bug where int64 and uint64 values were incorrectly mapped to SqlInteger instead of SqlBigInt
  • Fixes data loss issue where int64 was converted using strconv.Itoa(int(value)) which truncates large values
  • Adds safe type assertion in convertNamedValuesToSparkParams to prevent panic when Parameter.Value is not a string

Problem

When inserting int64/uint64 values into BIGINT columns, the driver was sending them with type INTEGER instead of BIGINT, causing the server to reject large values with error:

[INVALID_PARAMETER_MARKER_VALUE.INVALID_VALUE_FOR_DATA_TYPE] An invalid parameter mapping was provided: 
the value '1311768467463790320' for parameter 'null' cannot be cast to INT because it is malformed.

Test plan

  • Added unit tests for int64/uint64 type inference (TestParameter_BigInt)
  • Verified large int64 values are correctly inserted and retrieved from BIGINT columns
  • All existing parameter tests pass

🤖 Generated with Claude Code

This fixes a bug where int64 and uint64 values were incorrectly mapped
to SqlInteger instead of SqlBigInt, causing insert failures for large
values with error: INVALID_PARAMETER_MARKER_VALUE.INVALID_VALUE_FOR_DATA_TYPE

Changes:
- int64 now uses strconv.FormatInt() and maps to SqlBigInt
- uint64 now maps to SqlBigInt
- Added safe type assertion in convertNamedValuesToSparkParams to prevent
  panic when Parameter.Value is not a string

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings January 12, 2026 09:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a critical bug where int64 and uint64 values were incorrectly mapped to SqlInteger (INT) instead of SqlBigInt (BIGINT), causing data truncation and server rejection of large values.

Changes:

  • Fixed int64 type inference to use strconv.FormatInt and SqlBigInt instead of lossy int casting
  • Fixed uint64 type inference to use SqlBigInt and removed redundant type cast
  • Added defensive type assertion in convertNamedValuesToSparkParams to handle non-string Parameter values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
parameters.go Fixed int64/uint64 type mappings from INTEGER to BIGINT and corrected value conversion to prevent data loss; added safe type handling for Parameter.Value
parameter_test.go Added comprehensive test suite covering int64/uint64 BIGINT inference, edge cases (min/max values), explicit Parameter handling, and int32 preservation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vikrantpuppala
Copy link
Collaborator Author

Closing in favor of #316 which includes this fix along with the float64 fix

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant