feat(spanner): add interval type support#12009
Merged
Conversation
cb6525d to
dd53646
Compare
dd53646 to
a0e23fc
Compare
sagarwaal
reviewed
Apr 21, 2025
spanner/value.go
Outdated
| var interval Interval | ||
| interval.Nanos = new(big.Int) | ||
|
|
||
| pattern := `^P(-?\d+Y)?(-?\d+M)?(-?\d+D)?(T(-?\d+H)?(-?\d+M)?(-?(\d+(\.\d{1,9})?|\.\d{1,9})S)?)?$` |
There was a problem hiding this comment.
decimal can be represented through both , and '.'
5803ec4 to
c9cec2a
Compare
c9cec2a to
76b3bd3
Compare
sagarwaal
approved these changes
Apr 21, 2025
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
- Can we also have tests for passing parameters of type Interval and Interval Array (both NULL and non NULL params).
- Can we also have tests for reading NULL Interval and NULL Interval Array.
| nanos.Neg(nanos) | ||
| } | ||
|
|
||
| nanosPerHour := new(big.Int).SetInt64(3600000000000) |
There was a problem hiding this comment.
should we use constants, same at the other places?
| fractionStr += "0" | ||
| } | ||
| if len(fractionStr) > 9 { | ||
| fractionStr = fractionStr[:9] |
There was a problem hiding this comment.
we should never reach this, the regex parsing will fail for more than 9 digits after decimal.
harshachinta
approved these changes
Apr 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.