Core: add variant builder implementation#11857
Conversation
f8f8e8f to
d806c66
Compare
d806c66 to
16210a0
Compare
|
@rdblue, @RussellSpitzer Please help review. Thanks. |
16210a0 to
d4f1d0e
Compare
| Preconditions.checkArgument( | ||
| json != null && !json.isEmpty(), "Input JSON string cannot be null or empty."); | ||
|
|
||
| try (JsonParser parser = new JsonFactory().createParser(json)) { |
There was a problem hiding this comment.
There are existing utilities in JSONUtil for a lot of the boilerplate around parsing and generating JSON. Is there a reason not to use the same approach here?
There was a problem hiding this comment.
We need to parse the JSON token by token so we can encode them in binary. Seems we only have the version to parse the JSON string into a full JSONNode and then create the object.
9cba102 to
86bf18b
Compare
fa34686 to
3ad94d3
Compare
3ad94d3 to
38e6f2f
Compare
38e6f2f to
6062741
Compare
6062741 to
cc91ec0
Compare
| } | ||
|
|
||
| protected void writeNullInternal() { | ||
| valueBuffer.writePrimitive(Variants.PhysicalType.NULL, null); |
There was a problem hiding this comment.
| valueBuffer.writePrimitive(Variants.PhysicalType.NULL, null); | |
| valueBuffer.writePrimitive(PhysicalType.NULL, null); |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
This PR adds the implementation to build a variant for primitive, object and array.
The usage:
Build from Json
VariantBuilder.parseJson(json_string);build a primitive
Nested arrays and objects can be supported as well. Please see the test cases for the usage. Compared to build from JSON string, we also support some additional types such as timestamp, date.
Part of: #10392