public class UnionVectorShim extends Object implements UnionWriterImpl.UnionShim
WriterEvents.ColumnWriterListener, WriterEvents.State
Constructor and Description |
---|
UnionVectorShim(UnionVector vector) |
UnionVectorShim(UnionVector vector,
AbstractObjectWriter[] variants) |
Modifier and Type | Method and Description |
---|---|
void |
addMember(AbstractObjectWriter colWriter)
Add a column writer to an existing union writer.
|
AbstractObjectWriter |
addMember(ColumnMetadata schema) |
AbstractObjectWriter |
addMember(TypeProtos.MinorType type) |
void |
addMemberWriter(AbstractObjectWriter colWriter)
Performs just the work of adding a vector to the list of existing
variants.
|
void |
bindIndex(ColumnWriterIndex index)
Bind the writer to a writer index.
|
void |
bindListener(WriterEvents.ColumnWriterListener listener)
Bind a listener to the underlying vector writer.
|
void |
bindWriter(UnionWriterImpl writer) |
void |
dump(HierarchicalFormatter format) |
void |
endArrayValue()
End a value.
|
void |
endWrite()
End a batch: finalize any vector values.
|
boolean |
hasType(TypeProtos.MinorType type) |
void |
initTypeIndex(int typeFillCount)
When promoting the list to a union, the union's
type vector was initialized for any rows written thus
far.
|
int |
lastWriteIndex()
Return the last write position in the vector.
|
ObjectWriter |
member(TypeProtos.MinorType type)
Return an existing writer for the given type, or create a new one
if needed.
|
void |
postRollover()
The vectors backing this writer rolled over.
|
void |
preRollover()
The vectors backing this vector are about to roll over.
|
void |
restartRow()
During a writer to a row, rewind the the current index position to
restart the row.
|
int |
rowStartIndex()
Position within the vector of the first value for the current row.
|
void |
saveRow()
Saves a row.
|
void |
setNull() |
void |
setType(TypeProtos.MinorType type) |
void |
startRow()
Start a new row.
|
void |
startWrite()
Start a write (batch) operation.
|
AbstractScalarWriterImpl |
typeWriter()
Return the writer for the types vector.
|
int |
writeIndex()
Current write index for the writer.
|
public UnionVectorShim(UnionVector vector)
public UnionVectorShim(UnionVector vector, AbstractObjectWriter[] variants)
public void bindWriter(UnionWriterImpl writer)
bindWriter
in interface UnionWriterImpl.UnionShim
public void bindIndex(ColumnWriterIndex index)
WriterEvents
bindIndex
in interface WriterEvents
index
- the writer index (top level or nested for
arrays)public void bindListener(WriterEvents.ColumnWriterListener listener)
WriterEvents
bindListener
in interface WriterEvents
listener
- the vector event listener to bindpublic void setNull()
setNull
in interface UnionWriterImpl.UnionShim
public boolean hasType(TypeProtos.MinorType type)
hasType
in interface UnionWriterImpl.UnionShim
public ObjectWriter member(TypeProtos.MinorType type)
UnionWriterImpl.UnionShim
member
in interface UnionWriterImpl.UnionShim
type
- desired variant typepublic void setType(TypeProtos.MinorType type)
setType
in interface UnionWriterImpl.UnionShim
public AbstractObjectWriter addMember(ColumnMetadata schema)
addMember
in interface UnionWriterImpl.UnionShim
public AbstractObjectWriter addMember(TypeProtos.MinorType type)
addMember
in interface UnionWriterImpl.UnionShim
public void addMember(AbstractObjectWriter colWriter)
addMember
in interface UnionWriterImpl.UnionShim
colWriter
- the column writer to addpublic void addMemberWriter(AbstractObjectWriter colWriter)
addMember()
and repeat those operations.colWriter
- the column (type) writer to addpublic void startWrite()
WriterEvents
startWrite
in interface WriterEvents
public void startRow()
WriterEvents
WriterEvents.restartRow()
instead.startRow
in interface WriterEvents
public void endArrayValue()
WriterEvents
WriterEvents.saveRow()
, but the save of a value
is conditional on saving the row. This version is primarily of use
in tuples nested inside arrays: it saves each tuple within the array,
advancing to a new position in the array. The update of the array's
offset vector based on the cumulative value saves is done when
saving the row.endArrayValue
in interface WriterEvents
public void restartRow()
WriterEvents
restartRow
in interface WriterEvents
public void saveRow()
WriterEvents
saveRow
in interface WriterEvents
public void preRollover()
WriterEvents
preRollover
in interface WriterEvents
public void postRollover()
WriterEvents
postRollover
in interface WriterEvents
public void endWrite()
WriterEvents
endWrite
in interface WriterEvents
public AbstractScalarWriterImpl typeWriter()
public int writeIndex()
WriterPosition
writeIndex
in interface WriterPosition
public int lastWriteIndex()
WriterPosition
lastWriteIndex
in interface UnionWriterImpl.UnionShim
lastWriteIndex
in interface WriterPosition
public int rowStartIndex()
WriterPosition
rowStartIndex
in interface UnionWriterImpl.UnionShim
rowStartIndex
in interface WriterPosition
public void initTypeIndex(int typeFillCount)
public void dump(HierarchicalFormatter format)
dump
in interface WriterEvents
Copyright © 1970 The Apache Software Foundation. All rights reserved.