Skip to content

feat(spanner): add interval type support#12009

Merged
rahul2393 merged 4 commits intomainfrom
spanner-interval-support
Apr 22, 2025
Merged

feat(spanner): add interval type support#12009
rahul2393 merged 4 commits intomainfrom
spanner-interval-support

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

No description provided.

@rahul2393 rahul2393 requested review from a team April 17, 2025 08:56
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Apr 17, 2025
@rahul2393 rahul2393 force-pushed the spanner-interval-support branch 2 times, most recently from cb6525d to dd53646 Compare April 17, 2025 09:04
@rahul2393 rahul2393 force-pushed the spanner-interval-support branch from dd53646 to a0e23fc Compare April 17, 2025 11:44
@rahul2393 rahul2393 requested a review from harshachinta April 17, 2025 11:44
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)?)?$`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

decimal can be represented through both , and '.'

@rahul2393 rahul2393 force-pushed the spanner-interval-support branch from 5803ec4 to c9cec2a Compare April 21, 2025 06:02
@rahul2393 rahul2393 force-pushed the spanner-interval-support branch from c9cec2a to 76b3bd3 Compare April 21, 2025 06:03
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 21, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 21, 2025
@rahul2393 rahul2393 requested a review from sagarwaal April 21, 2025 06:19
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  1. Can we also have tests for passing parameters of type Interval and Interval Array (both NULL and non NULL params).
  2. Can we also have tests for reading NULL Interval and NULL Interval Array.

nanos.Neg(nanos)
}

nanosPerHour := new(big.Int).SetInt64(3600000000000)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should we use constants, same at the other places?

fractionStr += "0"
}
if len(fractionStr) > 9 {
fractionStr = fractionStr[:9]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we should never reach this, the regex parsing will fail for more than 9 digits after decimal.

@rahul2393 rahul2393 merged commit 5152488 into main Apr 22, 2025
9 checks passed
@rahul2393 rahul2393 deleted the spanner-interval-support branch April 22, 2025 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants