Fix two issues with JSON downconversion. #328
Merged
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.
Issue #, if available: N/A
Description of changes:
This PR fixes two issues with JSON downconversion that were found while conducting performance comparison with JSON parsers.
The first issue presented when converting ion data with type annotations to JSON. While writing data with annotations, the writer would track the annotations for write but would never write them (as intended), which resulted in the annotations never being cleared. If enough annotations were contained in the original data to exceed the max annotations configured, further writes would result in an error.
This PR addresses this issue by not tracking annotations if we are in a JSON downconversion mode. Since we discard type annotations in this mode, there is no reason to track them in the writer.
The second issue presented when serializing a double in a container, while in JSON downconversion mode. The function implemented to serialize doubles into a json format did not account for the separator required in containers which would result in an invalid serialization like:
[1.01.0]
, rather than[1.0,1.0]
.Unit tests have been added for both fixes.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.