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, wait
getRecordSetter, getRecordSetter, getRecordWriter, getSetter, writeRecord
public LocalTableWriter(@NotNull
LocalAppendableTable table)
table - The table to write topublic boolean supportAllTypes()
TableWritersupportAllTypes in interface TableWriter
public String[] getColumnNames()
TableWritergetColumnNames in interface TableWriter
public Class[] getColumnTypes()
TableWritergetColumnTypes in interface TableWriter
public long size()
Rowpublic Row getRowWriter()
TableWritergetRowWriter in interface TableWriter
public RowSetter getSetter(@NotNull String columnName)
TableWriterThe implementation is likely to delegate to Row.getSetter(String) in a default Row instance.
getSetter in interface Row
getSetter in interface TableWriter
columnName - 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 Row
setFlags in interface TableWriter
public 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 Row
writeRow in interface TableWriter
IOException - problem writing the rowpublic boolean dirty()
public void flush()
TableWriterflush in interface TableWriter
flush in interface BufferedAppendable
public void prepareCheckpoint()
BufferedAppendableBufferedAppendable.force().
Should be called directly after BufferedAppendable.flush(), with no intervening modification operations.prepareCheckpoint in interface BufferedAppendable
public 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 BufferedAppendable
public void close()
TableWriterclose in interface TableWriter
close in interface BufferedAppendable
public void release()
BufferedAppendableBufferedAppendable.force() operations.release in interface BufferedAppendable
public 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