Package io.delta.kernel.internal
Class TransactionImpl
Object
io.delta.kernel.internal.TransactionImpl
- All Implemented Interfaces:
Transaction
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionTransactionImpl(boolean isNewTable, Path dataPath, Path logPath, SnapshotImpl readSnapshot, String engineInfo, Operation operation, Protocol protocol, Metadata metadata, Optional<SetTransaction> setTxnOpt) -
Method Summary
Modifier and TypeMethodDescriptioncommit(Engine engine, CloseableIterable<Row> dataActions) Commit the transaction including the data action rows generated byTransaction.generateAppendActions(io.delta.kernel.engine.Engine, io.delta.kernel.data.Row, io.delta.kernel.utils.CloseableIterator<io.delta.kernel.utils.DataFileStatus>, io.delta.kernel.DataWriteContext).getPartitionColumns(Engine engine) Get the list of logical names of the partition columns.Get the schema of the table.getStatisticsColumns(Engine engine, Row transactionState) Get the part of the schema of the table that needs the statistics to be collected per file.getTransactionState(Engine engine) Get the state of the transaction.boolean
-
Field Details
-
DEFAULT_READ_VERSION
public static final int DEFAULT_READ_VERSION- See Also:
-
DEFAULT_WRITE_VERSION
public static final int DEFAULT_WRITE_VERSION- See Also:
-
-
Constructor Details
-
TransactionImpl
public TransactionImpl(boolean isNewTable, Path dataPath, Path logPath, SnapshotImpl readSnapshot, String engineInfo, Operation operation, Protocol protocol, Metadata metadata, Optional<SetTransaction> setTxnOpt)
-
-
Method Details
-
getTransactionState
Description copied from interface:TransactionGet the state of the transaction. The state helps Kernel do the transformations to logical data according to the Delta protocol and table features enabled on the table. The engine should use this at the data writer task to transform the logical data that the engine wants to write to the table in to physical data that goes in data files usingTransaction.transformLogicalData(Engine, Row, CloseableIterator, Map)- Specified by:
getTransactionStatein interfaceTransaction
-
getPartitionColumns
Description copied from interface:TransactionGet the list of logical names of the partition columns. This helps the connector to do physical partitioning of the data before asking the Kernel to stage the data per partition.- Specified by:
getPartitionColumnsin interfaceTransaction
-
getSchema
Description copied from interface:TransactionGet the schema of the table. If the connector is adding any data to the table through this transaction, it should have the same schema as the table schema.- Specified by:
getSchemain interfaceTransaction
-
commit
public TransactionCommitResult commit(Engine engine, CloseableIterable<Row> dataActions) throws ConcurrentWriteException Description copied from interface:TransactionCommit the transaction including the data action rows generated byTransaction.generateAppendActions(io.delta.kernel.engine.Engine, io.delta.kernel.data.Row, io.delta.kernel.utils.CloseableIterator<io.delta.kernel.utils.DataFileStatus>, io.delta.kernel.DataWriteContext).- Specified by:
commitin interfaceTransaction- Parameters:
engine-Engineinstance.dataActions- Iterable of data actions to commit. These data actions are generated by theTransaction.generateAppendActions(Engine, Row, CloseableIterator, DataWriteContext). TheCloseableIterableallows the Kernel to access the list of actions multiple times (in case of retries to resolve the conflicts due to other writers to the table). Kernel provides a in-memory based implementation ofCloseableIterablewith utility APICloseableIterable.inMemoryIterable(CloseableIterator)- Returns:
TransactionCommitResultstatus of the successful transaction.- Throws:
ConcurrentWriteException- when the transaction has encountered a non-retryable conflicts or exceeded the maximum number of retries reached. The connector needs to rerun the query on top of the latest table state and retry the transaction.
-
isBlindAppend
public boolean isBlindAppend() -
getSetTxnOpt
-
getStatisticsColumns
Get the part of the schema of the table that needs the statistics to be collected per file.- Parameters:
engine-Engineinstance to use.transactionState- State of the transaction- Returns:
-