snuyanzin commented on code in PR #29026:
URL: https://github.com/apache/flink/pull/29026#discussion_r3904398373
##########
flink-core/src/main/java/org/apache/flink/types/variant/BinaryVariantInternalBuilder.java:
##########
@@ -100,27 +98,45 @@ public BinaryVariantInternalBuilder(boolean
allowDuplicateKeys) {
/**
* Parse a JSON string as a Variant value.
*
- * @throws IOException if any JSON parsing error happens.
+ * @throws IOException if the JSON is malformed, or a number is out of the
range a Variant can
+ * store.
*/
public static BinaryVariant parseJson(String json, boolean
allowDuplicateKeys)
throws IOException {
try (JsonParser parser = JSON_FACTORY.createParser(json)) {
- parser.nextToken();
- return parseJson(parser, allowDuplicateKeys);
+ return parseJson(new JacksonJsonTokenSource(parser),
allowDuplicateKeys);
}
}
/**
- * Similar {@link #parseJson(String, boolean)}, but takes a JSON parser
instead of string input.
+ * Parse the JSON value at a Jackson parser as a Variant value. The parser
may be positioned
+ * before the value, as after {@code createParser} or a tree's {@code
traverse()}, or on the
+ * value's first token when read mid-stream.
+ *
+ * @throws IOException if the JSON is malformed, or a number is out of the
range a Variant can
+ * store.
*/
- private static BinaryVariant parseJson(JsonParser parser, boolean
allowDuplicateKeys)
+ public static BinaryVariant parseJson(JsonParser jsonParser, boolean
allowDuplicateKeys)
+ throws IOException {
+ return parseJson(new JacksonJsonTokenSource(jsonParser),
allowDuplicateKeys);
Review Comment:
these 2 methods still talk about `IOException` only
is that correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]