Package org.apache.parquet.variant
Class VariantJsonParser
java.lang.Object
org.apache.parquet.variant.VariantJsonParser
Parses JSON into
Variant values using Jackson streaming.
This class isolates the Jackson dependency from VariantBuilder,
so that core variant construction does not require Jackson on the classpath.
Ported from Apache Spark's VariantBuilder.parseJson.
-
Method Details
-
parseJson
Parses a JSON string and returns the correspondingVariant.Uses Jackson streaming parser for single-pass conversion with no intermediate tree. Number handling preserves precision: integers use the smallest fitting type, floating-point numbers prefer decimal encoding (no scientific notation) and fall back to double.
- Parameters:
json- the JSON string to parse- Returns:
- the parsed Variant
- Throws:
IOException- if the JSON is malformed or an I/O error occurs
-
parseJson
Parses a JSON value from an already-positionedJsonParserand returns the correspondingVariant. The parser must have its current token set (i.e.,parser.nextToken()or equivalent must have been called).- Parameters:
parser- a positioned Jackson JsonParser- Returns:
- the parsed Variant
- Throws:
IOException- if the JSON is malformed or an I/O error occurs
-