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

Add support for reading system e-expressions #961

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

popematt
Copy link
Contributor

@popematt popematt commented Oct 7, 2024

Issue #, if available:

#741

Description of changes:

Adds support for reading the System EExpression op-code.

In the process, I discovered two issues that seem like they are not caused by my changes. I tried to create an equivalent test using non-system macros to determine whether these issues already existed, but I ran into some trouble getting it set up. If you agree that it seems like I haven't introduced a problem in this PR, then I'll go ahead and create GH issues to follow up on these bugs.

  • There's a bug somewhere that causes the reader to get into a bad state if a top-level e-expression that produces no values is followed by another e-expression.
  • There's a (pre-existing?) problem that causes an exception to be thrown from slowFillValue() when attempting to read arguments from a length-prefixed expression group.

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

@popematt popematt requested a review from tgregg October 7, 2024 20:26
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (ion-11-encoding@36d63da). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...mazon/ion/impl/IonReaderContinuableCoreBinary.java 57.14% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##             ion-11-encoding     #961   +/-   ##
==================================================
  Coverage                   ?   70.16%           
  Complexity                 ?     6940           
==================================================
  Files                      ?      200           
  Lines                      ?    27349           
  Branches                   ?     4945           
==================================================
  Hits                       ?    19189           
  Misses                     ?     6613           
  Partials                   ?     1547           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

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

I agree that the bugs you found are existing bugs; let's just link to issues for them.

@CsvSource({
// (:values (:: ) ) 0 1
"EF 01 02 01 F0 60 61 01",
// (:values 0 1) // using length-prefixed expression group
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// (:values 0 1) // using length-prefixed expression group
// (:values (:: 0 1)) // using length-prefixed expression group

Is this right?

Copy link
Contributor Author

@popematt popematt Oct 7, 2024

Choose a reason for hiding this comment

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

Either one is legal since we can use the implicit rest param for the argument to values. I've only used (:: ) in some places to make it clear that the encoding is an empty expression group or a single-arg expression group.

If you have a preference for always being explicit about expression groups in the tests here, I can change it.

"EF 01 02 01 F0 60 61 01",
// (:values 0 1) // using length-prefixed expression group
"EF 01 02 07 60 61 01",
// (:values 0 1) // using delimited expression group
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// (:values 0 1) // using delimited expression group
// (:values (:: 0 1)) // using delimited expression group

Is this right?

"EF 01 02 01 60 61 01 F0",
// (:values (:: 0) (:values (:: 1))
"EF 01 02 03 60 EF 01 02 05 61 01",
// (:values (:values 0 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// (:values (:values 0 1))
// (:values (:values 0 1))

I guess we could choose not to use the expression group syntax for all of these, even though that's how they're encoded in binary...

@popematt
Copy link
Contributor Author

popematt commented Oct 8, 2024

I agree that the bugs you found are existing bugs; let's just link to issues for them.

I've created #962 and #963 and added links for the issues in the comments in the tests.

@popematt popematt merged commit ab1e041 into amazon-ion:ion-11-encoding Oct 8, 2024
19 of 36 checks passed
@popematt popematt deleted the read-system-macros branch October 8, 2024 17: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