Class MutationWriter (0.5.0)

public class MutationWriter implements Callable<Long>, Closeable

Inheritance

java.lang.Object > MutationWriter

Constructors

MutationWriter(MutationWriter.CopyTransactionMode transactionMode, Connection connection, String tableName, Map<String,TypeCode> tableColumns, int indexedColumnsCount, CSVFormat format, boolean hasHeader)

public MutationWriter(MutationWriter.CopyTransactionMode transactionMode, Connection connection, String tableName, Map<String,TypeCode> tableColumns, int indexedColumnsCount, CSVFormat format, boolean hasHeader)
Parameters
NameDescription
transactionModeMutationWriter.CopyTransactionMode
connectionConnection
tableNameString
tableColumnsMap<String,com.google.spanner.v1.TypeCode>
indexedColumnsCountint
formatorg.apache.commons.csv.CSVFormat
hasHeaderboolean

Methods

addCopyData(byte[] payload)

public void addCopyData(byte[] payload)
Parameter
NameDescription
payloadbyte[]

call()

public Long call()
Returns
TypeDescription
Long
Exceptions
TypeDescription
Exception

close()

public void close()
Exceptions
TypeDescription
IOException

closeErrorFile()

public void closeErrorFile()

getRowCount()

public long getRowCount()
Returns
TypeDescription
long

number of rows copied into Spanner

handleError(Exception exception)

public void handleError(Exception exception)
Parameter
NameDescription
exceptionException

rollback()

public void rollback()

Indicate that this mutation writer should be rolled back. This will not rollback any changes that have already been committed if the mutation writer is running in CopyTransactionMode#ImplicitNonAtomic.

writeErrorFile(Exception exception)

public void writeErrorFile(Exception exception)

Writes any error that occurred during a COPY operation to the error file.

Parameter
NameDescription
exceptionException