public class VariantBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
protected VariantArrayBuilder |
arrayBuilder |
protected org.apache.parquet.variant.Metadata |
metadata
Object and array builders share the same Metadata object as the main builder.
|
protected VariantObjectBuilder |
objectBuilder
These are used to build nested objects and arrays, via startObject() and startArray().
|
protected byte[] |
writeBuffer
The buffer for building the Variant value.
|
protected int |
writePos |
| Constructor and Description |
|---|
VariantBuilder()
Creates a VariantBuilder.
|
VariantBuilder(org.apache.parquet.variant.Metadata metadata)
Creates a VariantBuilder with a non-default metadata object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendBinary(ByteBuffer binary)
Appends binary data to the variant builder.
|
void |
appendBoolean(boolean b)
Appends a boolean value to the Variant builder.
|
void |
appendByte(byte b)
Appends a byte value to the variant builder.
|
void |
appendDate(int daysSinceEpoch)
Appends a date value to the variant builder.
|
void |
appendDecimal(BigDecimal d)
Appends a decimal value to the variant builder.
|
void |
appendDouble(double d)
Appends a double value to the variant builder.
|
void |
appendEncodedValue(ByteBuffer value)
Directly append a Variant value.
|
void |
appendFloat(float f)
Appends a float value to the variant builder.
|
void |
appendInt(int i)
Appends an int value to the variant builder.
|
void |
appendLong(long l)
Appends a long value to the variant builder.
|
void |
appendNull()
Appends a null value to the Variant builder.
|
void |
appendNullIfEmpty() |
void |
appendShort(short s)
Appends a short value to the variant builder.
|
void |
appendString(String str)
Appends a string value to the Variant builder.
|
void |
appendTime(long microsSinceMidnight)
Appends a Time value to the variant builder.
|
void |
appendTimestampNanosNtz(long nanosSinceEpoch)
Appends a TimestampNanosNtz value to the variant builder.
|
void |
appendTimestampNanosTz(long nanosSinceEpoch)
Appends a TimestampNanosTz value to the variant builder.
|
void |
appendTimestampNtz(long microsSinceEpoch)
Appends a TimestampNtz value to the variant builder.
|
void |
appendTimestampTz(long microsSinceEpoch)
Appends a TimestampTz value to the variant builder.
|
void |
appendUUID(UUID uuid)
Appends a UUID value to the variant builder.
|
Variant |
build() |
protected void |
checkAppendWhileNested() |
protected void |
checkMultipleNested(String message) |
ByteBuffer |
encodedValue() |
void |
endArray()
Ends appending an array to this variant builder.
|
void |
endObject()
Finishes appending the object to this builder.
|
void |
endObjectIfExists() |
static int |
getMinIntegerSize(int value) |
protected void |
onAppend() |
protected void |
onStartNested() |
VariantArrayBuilder |
startArray()
Starts appending an array to this variant builder.
|
VariantObjectBuilder |
startObject()
Starts appending an object to this variant builder.
|
VariantObjectBuilder |
startOrContinueObject() |
VariantObjectBuilder |
startOrContinuePartialObject(ByteBuffer value,
Set<String> suppressedKeys) |
protected byte[] writeBuffer
protected int writePos
protected org.apache.parquet.variant.Metadata metadata
protected VariantObjectBuilder objectBuilder
protected VariantArrayBuilder arrayBuilder
public VariantBuilder()
public VariantBuilder(org.apache.parquet.variant.Metadata metadata)
public Variant build()
public ByteBuffer encodedValue()
public void appendEncodedValue(ByteBuffer value)
public void appendString(String str)
str - the string value to appendpublic void appendNull()
public void appendNullIfEmpty()
public void appendBoolean(boolean b)
b - the boolean value to appendpublic void appendLong(long l)
l - the long value to appendpublic void appendInt(int i)
i - the int to appendpublic void appendShort(short s)
s - the short to appendpublic void appendByte(byte b)
b - the byte to appendpublic void appendDouble(double d)
d - the double to appendpublic void appendDecimal(BigDecimal d)
d - the decimal value to appendpublic void appendDate(int daysSinceEpoch)
daysSinceEpoch - the number of days since the epochpublic void appendTimestampTz(long microsSinceEpoch)
microsSinceEpoch - the number of microseconds since the epochpublic void appendTimestampNtz(long microsSinceEpoch)
microsSinceEpoch - the number of microseconds since the epochpublic void appendTime(long microsSinceMidnight)
microsSinceMidnight - the number of microseconds since midnightpublic void appendTimestampNanosTz(long nanosSinceEpoch)
nanosSinceEpoch - the number of nanoseconds since the epochpublic void appendTimestampNanosNtz(long nanosSinceEpoch)
nanosSinceEpoch - the number of nanoseconds since the epochpublic void appendFloat(float f)
f - the float to appendpublic void appendBinary(ByteBuffer binary)
binary - the binary data to appendpublic void appendUUID(UUID uuid)
uuid - the UUID to appendpublic VariantObjectBuilder startObject()
Example usage: VariantBuilder builder = new VariantBuilder(); VariantObjectBuilder objBuilder = builder.startObject(); objBuilder.appendKey("key1"); objBuilder.appendString("value1"); builder.endObject();
public VariantObjectBuilder startOrContinueObject()
public VariantObjectBuilder startOrContinuePartialObject(ByteBuffer value, Set<String> suppressedKeys)
public void endObjectIfExists()
public void endObject()
public VariantArrayBuilder startArray()
Example usage: VariantBuilder builder = new VariantBuilder(); VariantArrayBuilder arrayBuilder = builder.startArray(); arrayBuilder.appendString("value1"); arrayBuilder.appendString("value2"); builder.endArray();
public void endArray()
protected void onAppend()
protected void onStartNested()
protected void checkMultipleNested(String message)
protected void checkAppendWhileNested()
public static int getMinIntegerSize(int value)
Copyright © 2024 The Apache Software Foundation. All rights reserved.