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

Adds support for reading binary Ion 1.1 timestamps. #640

Merged
merged 5 commits into from
Nov 20, 2023

Conversation

tgregg
Copy link
Contributor

@tgregg tgregg commented Nov 15, 2023

Description of changes:
Short and long-form, as of the current revision of the Ion 1.1 spec. Reading the fractional component of long-form timestamps will change slightly if amazon-ion/ion-docs#286 is merged.

I copied the CsvSource parameters from IonEncoder_1_1Test. Ideally we'd be able to share these more easily, but a static final String[] isn't accepted by JUnit. Leaving that for future improvement. Additional test coverage should probably come from ion-tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tgregg tgregg requested a review from popematt November 15, 2023 22:34
Copy link
Contributor

@popematt popematt left a comment

Choose a reason for hiding this comment

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

There's a few small things that look like they might be typos, but otherwise it looks good.

Comment on lines 583 to 584
int month = 0;
int day = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these default to 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, it doesn't end up mattering because Timestamp does its own defaulting, but it looks better with them set to valid values.

Comment on lines 654 to 655
int month = 0;
int day = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Should these default to 1?

public static final int NANOSECOND_SCALE = 9;
public static final int MAX_MICROSECONDS = 999999;
public static final int MICROSECOND_SCALE = 6;
public static final short MAX_MILLISECONDS = 999;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason why this one is a short instead of an int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, changed

@tgregg tgregg merged commit 3086098 into ion-11-encoding-read-pr1 Nov 20, 2023
2 checks passed
@tgregg tgregg deleted the ion-11-encoding-read-pr2 branch November 20, 2023 22:44
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