Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp support #565

Merged
merged 21 commits into from
May 17, 2021
Merged

Timestamp support #565

merged 21 commits into from
May 17, 2021

Conversation

xerial
Copy link
Member

@xerial xerial commented May 11, 2021

Follow-up work of #431

This PR is based on the commits at #431 and the timestamp implementation of airframe-msgpack https://github.com/wvlet/airframe/tree/master/airframe-msgpack/src/main/scala/wvlet/airframe/msgpack/spi

  • Add pack/unpackTimestamp. (Instant, milliseconds, sec+nano interface). Don't need to add other interfaces like unpackTimestamp(java.util.Date), unpackTimestamp(DateTime), etc. as these datetime instances can be converted into milliseconds or Instant at ease. Instant class requires JDK8 or later. So JDK7 users can't use timestamp but it should be ok as JDK7 is no longer maintained.
  • Add corner-case tests for various Timestamp values
  • Fix uint32 handling around nano seconds
  • Add Value support for Timestamp. Decided not to support Timestamp as the first-class ValueType because Timestamp requires reading 1 to 3 bytes for deciding ValueType while the other types only need the first 1 byte.
  • Extend Variable to support reading Timestamp values
  • Enhance Variable tests
  • Fix property-based testing. Needed to migrate to AirSpec https://wvlet.org/airframe/docs/airspec. ScalaTests with ScalaCheck was not properly running forAll methods
  • Remove ScalaTest, xerial-java dependencies

@xerial xerial requested a review from komamitsu May 12, 2021 07:25
Comment on lines +608 to +616
// Corner-cases around uint32 boundaries
for (v <- Seq(
Instant.ofEpochSecond(Instant.now().getEpochSecond, 123456789L), // uint32 nanoseq (out of int32 range)
Instant.ofEpochSecond(-1302749144L, 0), // 1928-09-19T21:14:16Z
Instant.ofEpochSecond(-747359729L, 0), // 1946-04-27T00:04:31Z
Instant.ofEpochSecond(4257387427L, 0) // 2104-11-29T07:37:07Z
)) {
check(v, _.packTimestamp(v), _.unpackTimestamp())
}
Copy link
Member Author

@xerial xerial May 12, 2021

Choose a reason for hiding this comment

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

These test cases are for fixing uint32 conversion bugs in #431

@xerial
Copy link
Member Author

xerial commented May 17, 2021

@komamitsu I'll merge this and prepare 0.9.0 release.

@xerial xerial merged commit 1b2ec92 into msgpack:develop May 17, 2021
@dmikurube
Copy link

@xerial @komamitsu If msgpack-java goes to 0.9.0, not next 0.8, can we consider this type of change? 0.8 -> 0.9 is a good chance to include some incompatibility...

#571

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.

3 participants