Package org.apache.parquet.io.api
Class RecordConsumer
java.lang.Object
org.apache.parquet.io.api.RecordConsumer
- Direct Known Subclasses:
RecordConsumerLoggingWrapper,ValidatingRecordConsumer
Abstraction for writing records
It decouples the striping algorithm from the actual record model
example:
startMessage()
startField("A", 0)
addValue(1)
addValue(2)
endField("A", 0)
startField("B", 1)
startGroup()
startField("C", 0)
addValue(3)
endField("C", 0)
endGroup()
endField("B", 1)
endMessage()
would produce the following message:
{
A: [1, 2]
B: {
C: 3
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidadd a binary value in the current fieldabstract voidaddBoolean(boolean value) add a boolean value in the current fieldabstract voidaddDouble(double value) add a double value in the current fieldabstract voidaddFloat(float value) add a float value in the current fieldabstract voidaddInteger(int value) add an int value in the current fieldabstract voidaddLong(long value) add a long value in the current fieldabstract voidend of a field in a group or messageabstract voidendGroup()end of a group in a fieldabstract voidend of a recordvoidflush()NoOps by default Subclass class can implement its own flushing logicabstract voidstartField(String field, int index) start of a field in a group or message if the field is repeated the field is started only once and all values added in between start and endabstract voidstart of a group in a fieldabstract voidstart a new record
-
Constructor Details
-
RecordConsumer
public RecordConsumer()
-
-
Method Details
-
startMessage
public abstract void startMessage()start a new record -
endMessage
public abstract void endMessage()end of a record -
startField
start of a field in a group or message if the field is repeated the field is started only once and all values added in between start and end- Parameters:
field- name of the fieldindex- of the field in the group or message
-
endField
end of a field in a group or message- Parameters:
field- name of the fieldindex- of the field in the group or message
-
startGroup
public abstract void startGroup()start of a group in a field -
endGroup
public abstract void endGroup()end of a group in a field -
addInteger
public abstract void addInteger(int value) add an int value in the current field- Parameters:
value- an int value
-
addLong
public abstract void addLong(long value) add a long value in the current field- Parameters:
value- a long value
-
addBoolean
public abstract void addBoolean(boolean value) add a boolean value in the current field- Parameters:
value- a boolean value
-
addBinary
add a binary value in the current field- Parameters:
value- a binary value
-
addFloat
public abstract void addFloat(float value) add a float value in the current field- Parameters:
value- a float value
-
addDouble
public abstract void addDouble(double value) add a double value in the current field- Parameters:
value- a double value
-
flush
public void flush()NoOps by default Subclass class can implement its own flushing logic
-