public class LocalTableWriter extends Object implements TableWriter, BufferedAppendable
Record.RecordSetter<T extends RecordData>NULL_SETTER| Constructor and Description |
|---|
LocalTableWriter(LocalAppendableTable table)
Construct a writer for the supplied table.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the writer.
|
boolean |
dirty()
Test if there is data to flush.
|
void |
flush()
Flushes data out.
|
void |
force()
Force all flushed data to be persisted to permanent storage.
|
String[] |
getColumnNames()
Gets the column names for the table.
|
Class[] |
getColumnTypes()
Gets the column types for the table.
|
Row |
getRowWriter()
Get a writer for a Row entries.
|
RowSetter |
getSetter(String columnName)
Gets a setter for a column.
|
boolean |
inTransaction() |
void |
maybeAbortTransaction()
Abort a transaction if one is in progress.
|
void |
prepareCheckpoint()
Optional operation.
|
void |
release()
Release any resources held.
|
void |
setFlags(Row.Flags flags) |
void |
setImportDetails(Properties importDetails)
Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.
|
void |
setImportState(ImportState importState)
Set an import state object to be part of checkpoints for the output table.
|
long |
size()
Number of rows written out.
|
boolean |
supportAllTypes()
True if all data types can be written out; false otherwise.
|
void |
updateImportState(UnaryOperator<ImportState> updater)
Set the import state object (as in
LocalTableWriter.setImportState(ImportState)) after applying the supplied updater
function to the existing import state object. |
void |
writeRow()
Writes out a new row (values set using setters).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflushDeferredRows, getRecordSetter, getRecordSetter, getRecordWriter, getSetter, writeDeferredRow, writeRecordgetColumnPartitionValue, setColumnPartitionValuepublic LocalTableWriter(@NotNull
LocalAppendableTable table)
table - The table to write topublic boolean supportAllTypes()
TableWritersupportAllTypes in interface TableWriterpublic String[] getColumnNames()
TableWritergetColumnNames in interface TableWriterpublic Class[] getColumnTypes()
TableWritergetColumnTypes in interface TableWriterpublic long size()
Rowpublic Row getRowWriter()
TableWritergetRowWriter in interface TableWriterpublic RowSetter getSetter(@NotNull String columnName)
TableWriterThe implementation is likely to delegate to Row.getSetter(String) in a default Row instance.
getSetter in interface RowgetSetter in interface TableWritercolumnName - column namepublic void setFlags(@NotNull
Row.Flags flags)
TableWriterThe implementation is likely to delegate to Row.setFlags(Flags) in a default Row instance.
setFlags in interface RowsetFlags in interface TableWriterpublic boolean inTransaction()
public void maybeAbortTransaction()
public void writeRow()
throws IOException
TableWriter The implementation is likely to delegate to Row.writeRow() in a default Row instance.
writeRow in interface RowwriteRow in interface TableWriterIOException - problem writing the rowpublic boolean dirty()
public void flush()
TableWriterflush in interface TableWriterflush in interface BufferedAppendablepublic void prepareCheckpoint()
BufferedAppendableBufferedAppendable.force().
Should be called directly after BufferedAppendable.flush(), with no intervening modification operations.prepareCheckpoint in interface BufferedAppendablepublic void force()
BufferedAppendableBufferedAppendable.prepareCheckpoint().
Does not imply BufferedAppendable.flush(), as this is a distinct operation in all implementations.
May be called concurrently by threads other than the "writing thread".force in interface BufferedAppendablepublic void close()
TableWriterclose in interface TableWriterclose in interface BufferedAppendablepublic void release()
BufferedAppendableBufferedAppendable.force() operations.release in interface BufferedAppendablepublic void updateImportState(@NotNull
UnaryOperator<ImportState> updater)
LocalTableWriter.setImportState(ImportState)) after applying the supplied updater
function to the existing import state object.updater - The import state updaterpublic void setImportState(ImportState importState)
importState - The import statepublic void setImportDetails(Properties importDetails)
importDetails - The import details