Package io.delta.kernel.internal.actions
Class GenerateIcebergCompatActionUtils
Object
io.delta.kernel.internal.actions.GenerateIcebergCompatActionUtils
Utilities to convert Iceberg add/removes to Delta Kernel add/removes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RowconvertRemoveDataFileStatus(StructType physicalSchema, URI tableRoot, DataFileStatus dataFileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor) static RowcreateRemoveFileRowWithExtendedFileMetadata(String path, long deletionTimestamp, boolean dataChange, MapValue partitionValues, long size, Optional<DataFileStatistics> stats, StructType physicalSchema, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVector) static RowgenerateIcebergCompatWriterV1AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Map<String, String> tags, Optional<StructType> physicalSchemaOpt) Create an add actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg add.static RowgenerateIcebergCompatWriterV1AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<StructType> physicalSchemaOpt) static RowgenerateIcebergCompatWriterV1RemoveAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<StructType> physicalSchemaOpt) Create a remove actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg remove.static RowgenerateIcebergCompatWriterV3AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Map<String, String> tags, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor, Optional<StructType> physicalSchemaOpt) Create an add actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg add.static RowgenerateIcebergCompatWriterV3RemoveAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor, Optional<StructType> physicalSchemaOpt) Create a remove actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg remove.
-
Constructor Details
-
GenerateIcebergCompatActionUtils
public GenerateIcebergCompatActionUtils()
-
-
Method Details
-
generateIcebergCompatWriterV1AddAction
public static Row generateIcebergCompatWriterV1AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Map<String, String> tags, Optional<StructType> physicalSchemaOpt) Create an add actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg add.- Parameters:
transactionState- the transaction state from the built transactionfileStatus- the file status to create the add with (contains path, time, size, and stats)partitionValues- the partition values for the adddataChange- whether or not the add constitutes a dataChange (i.e. append vs. compaction)tags- key-value metadata to be attached to the add actionphysicalSchemaOpt- An optional pre-parsed physical schema. Improves performance for batch operations by avoiding repeated JSON parsing. Recommended when generating many actions with the same schema.- Returns:
- add action row that can be included in the transaction
- Throws:
UnsupportedOperationException- if icebergWriterCompatV1 is not enabledUnsupportedOperationException- if maxRetries != 0 in the transactionKernelException- if stats are not present (required for icebergCompatV2)UnsupportedOperationException- if the table is partitioned (currently unsupported)
-
generateIcebergCompatWriterV1AddAction
public static Row generateIcebergCompatWriterV1AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<StructType> physicalSchemaOpt) -
generateIcebergCompatWriterV3AddAction
public static Row generateIcebergCompatWriterV3AddAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Map<String, String> tags, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor, Optional<StructType> physicalSchemaOpt) Create an add actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg add.- Parameters:
transactionState- the transaction state from the built transactionfileStatus- the file status to create the add with (contains path, time, size, and stats)partitionValues- the partition values for the adddataChange- whether or not the add constitutes a dataChange (i.e. append vs. compaction)tags- key-value metadata to be attached to the add actiondeletionVectorDescriptor- optional deletion vector descriptor for the add actionphysicalSchemaOpt- An optional pre-parsed physical schema. Improves performance for batch operations by avoiding repeated JSON parsing. Recommended when generating many actions with the same schema.- Returns:
- add action row that can be included in the transaction
- Throws:
UnsupportedOperationException- if icebergWriterCompatV3 is not enabledUnsupportedOperationException- if maxRetries != 0 in the transactionKernelException- if stats are not present (required for icebergCompatV3)UnsupportedOperationException- if the table is partitioned (currently unsupported)
-
generateIcebergCompatWriterV1RemoveAction
public static Row generateIcebergCompatWriterV1RemoveAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<StructType> physicalSchemaOpt) Create a remove actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg remove.- Parameters:
transactionState- the transaction state from the built transactionfileStatus- the file status to create the remove with (contains path, time, size, and stats)partitionValues- the partition values for the removedataChange- whether or not the remove constitutes a dataChange (i.e. delete vs. compaction)physicalSchemaOpt- An optional pre-parsed physical schema. Improves performance for batch operations by avoiding repeated JSON parsing. Recommended when generating many actions with the same schema.- Returns:
- remove action row that can be committed to the transaction
- Throws:
UnsupportedOperationException- if icebergWriterCompatV1 is not enabledUnsupportedOperationException- if maxRetries != 0 in the transactionKernelException- if the table is an append-only table and dataChange=trueUnsupportedOperationException- if the table is partitioned (currently unsupported)
-
generateIcebergCompatWriterV3RemoveAction
public static Row generateIcebergCompatWriterV3RemoveAction(Row transactionState, DataFileStatus fileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor, Optional<StructType> physicalSchemaOpt) Create a remove actionRowthat can be passed toTransaction.commit(Engine, CloseableIterable)from an Iceberg remove.- Parameters:
transactionState- the transaction state from the built transactionfileStatus- the file status to create the remove with (contains path, time, size, and stats)partitionValues- the partition values for the removedataChange- whether or not the remove constitutes a dataChange (i.e. delete vs. compaction)deletionVectorDescriptor- optional deletion vector descriptor for the add actionphysicalSchemaOpt- An optional pre-parsed physical schema. Improves performance for batch operations by avoiding repeated JSON parsing. Recommended when generating many actions with the same schema.- Returns:
- remove action row that can be committed to the transaction
- Throws:
UnsupportedOperationException- if icebergWriterCompatV3 is not enabledUnsupportedOperationException- if maxRetries != 0 in the transactionKernelException- if the table is an append-only table and dataChange=trueUnsupportedOperationException- if the table is partitioned (currently unsupported)
-
convertRemoveDataFileStatus
@VisibleForTesting public static Row convertRemoveDataFileStatus(StructType physicalSchema, URI tableRoot, DataFileStatus dataFileStatus, Map<String, Literal> partitionValues, boolean dataChange, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVectorDescriptor) -
createRemoveFileRowWithExtendedFileMetadata
@VisibleForTesting public static Row createRemoveFileRowWithExtendedFileMetadata(String path, long deletionTimestamp, boolean dataChange, MapValue partitionValues, long size, Optional<DataFileStatistics> stats, StructType physicalSchema, Optional<Long> baseRowId, Optional<Long> defaultRowCommitVersion, Optional<DeletionVectorDescriptor> deletionVector)
-