Skip to content

Commit

Permalink
[Kernel] Itty bitty refactor (#4188)
Browse files Browse the repository at this point in the history
<!--
Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md
2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]
Your PR title ...'.
  3. Be sure to keep the PR description updated to reflect all changes.
  4. Please write your PR title to summarize what this PR proposes.
5. If possible, provide a concise example to reproduce the issue for a
faster review.
6. If applicable, include the corresponding issue number in the PR title
and link it in the body.
-->

#### Which Delta project/connector is this regarding?
<!--
Please add the component selected below to the beginning of the pull
request title
For example: [Spark] Title of my pull request
-->

- [ ] Spark
- [ ] Standalone
- [ ] Flink
- [x] Kernel
- [ ] Other (fill in here)

## Description

Just itty bitty clean up -- reduces changes in add/remove action API
prototype.

## How was this patch tested?

Existing tests suffice.

## Does this PR introduce _any_ user-facing changes?

No
  • Loading branch information
allisonport-db authored Feb 27, 2025
1 parent 4a61561 commit 0fbe9b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static CloseableIterator<FilteredColumnarBatch> transformLogicalData(
// Note: `partitionValues` are not used as of now in this API, but taking the partition
// values as input forces the connector to not pass data from multiple partitions this
// API in a single call.
StructType tableSchema = getLogicalSchema(engine, transactionState);
StructType tableSchema = getLogicalSchema(transactionState);
List<String> partitionColNames = getPartitionColumnsList(transactionState);
validateAndSanitizePartitionValues(tableSchema, partitionColNames, partitionValues);

Expand Down Expand Up @@ -167,7 +167,7 @@ static CloseableIterator<FilteredColumnarBatch> transformLogicalData(
*/
static DataWriteContext getWriteContext(
Engine engine, Row transactionState, Map<String, Literal> partitionValues) {
StructType tableSchema = getLogicalSchema(engine, transactionState);
StructType tableSchema = getLogicalSchema(transactionState);
List<String> partitionColNames = getPartitionColumnsList(transactionState);

partitionValues =
Expand Down Expand Up @@ -209,7 +209,7 @@ static CloseableIterator<Row> generateAppendActions(
return fileStatusIter.map(
dataFileStatus -> {
if (isIcebergCompatV2Enabled) {
IcebergCompatV2Utils.validDataFileStatus(dataFileStatus);
IcebergCompatV2Utils.validateDataFileStatus(dataFileStatus);
}
AddFile addFileRow =
AddFile.convertDataFileStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private IcebergCompatV2Utils() {}
*
* @param dataFileStatus The {@link DataFileStatus} to validate.
*/
public static void validDataFileStatus(DataFileStatus dataFileStatus) {
public static void validateDataFileStatus(DataFileStatus dataFileStatus) {
if (!dataFileStatus.getStatistics().isPresent()) {
// presence of stats means always has a non-null `numRecords`
throw DeltaErrors.missingNumRecordsStatsForIcebergCompatV2(dataFileStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ private TransactionStateRow(HashMap<Integer, Object> valueMap) {
* Get the logical schema of the table from the transaction state {@link Row} returned by {@link
* Transaction#getTransactionState(Engine)}}
*
* @param engine {@link Engine} instance to use for parsing the schema
* @param transactionState Transaction state state {@link Row}
* @return Logical schema of the table as {@link StructType}
*/
public static StructType getLogicalSchema(Engine engine, Row transactionState) {
public static StructType getLogicalSchema(Row transactionState) {
String serializedSchema =
transactionState.getString(COL_NAME_TO_ORDINAL.get("logicalSchemaString"));
return DataTypeJsonSerDe.deserializeStructType(serializedSchema);
Expand Down

0 comments on commit 0fbe9b9

Please sign in to comment.