Skip to content

Conversation

@passuied
Copy link
Contributor

@passuied passuied commented Jan 1, 2026

Description

Opt-in spec compliant encoding

1. Add new codec option

  • Add EnableDecimalBinarySpecCompliantEncoding to CodecOption in codec.go
  • Default: false (legacy behavior)

2. Conditionally use spec-compliant encoding

  • When option is true: Use proper two's complement binary encoding and human-readable textual
  • When option is false: Use legacy ASCII string encoding (original behavior)

Issue Reference

#296

@passuied
Copy link
Contributor Author

passuied commented Jan 1, 2026

@rockwotj another review when you get a chance. The CI failed but it seems to be an unrelated issue

logical_type.go Outdated
}

// Check if bytes look like ASCII decimal string (backwards compat)
if looksLikeASCIIDecimal(bs) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think this is backwards compatible, are we sure there is never valid encoding of a number that would look like valid ascii? I don’t believe so. We need an option for this unless you have some proof this is never wrong

Copy link
Contributor Author

@passuied passuied Jan 3, 2026

Choose a reason for hiding this comment

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

You're right... I have added an option and reduced the scope of the heuristic for determining that the bytes are a valid ascii..

... Or alternatively, we could have a compatibility mode (by default) which can be overridden to false so the encoding is modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rockwotj ok decided to go with fully backwards compatible option and NOT try to recover badly encoded data (since it's imperfect logic). So enabling the spec compliant option will switch to the new mode...

@passuied passuied requested a review from rockwotj January 3, 2026 02:05
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.

2 participants