Skip to content

Add iceberg.partition.spec#786

Draft
hasyimibhar wants to merge 1 commit intoAiven-Open:mainfrom
hasyimibhar:partition-spec
Draft

Add iceberg.partition.spec#786
hasyimibhar wants to merge 1 commit intoAiven-Open:mainfrom
hasyimibhar:partition-spec

Conversation

@hasyimibhar
Copy link

@hasyimibhar hasyimibhar commented Dec 10, 2025

PartitionSpec is already implemented here:

static PartitionSpec createPartitionSpec(
final org.apache.iceberg.Schema schema, final List<String> partitionBy) {
if (partitionBy.isEmpty()) {
return PartitionSpec.unpartitioned();
}
final PartitionSpec.Builder specBuilder = PartitionSpec.builderFor(schema);
partitionBy.forEach(
partitionField -> {
final Matcher matcher = TRANSFORM_REGEX.matcher(partitionField);
if (matcher.matches()) {
final String transform = matcher.group(1);
switch (transform) {
case "year":
case "years":
specBuilder.year(matcher.group(2));
break;
case "month":
case "months":
specBuilder.month(matcher.group(2));
break;
case "day":
case "days":
specBuilder.day(matcher.group(2));
break;
case "hour":
case "hours":
specBuilder.hour(matcher.group(2));
break;
case "bucket": {
final Pair<String, Integer> args = transformArgPair(matcher.group(2));
specBuilder.bucket(args.first(), args.second());
break;
}
case "truncate": {
final Pair<String, Integer> args = transformArgPair(matcher.group(2));
specBuilder.truncate(args.first(), args.second());
break;
}
default:
throw new UnsupportedOperationException("Unsupported transform: " + transform);
}
} else {
specBuilder.identity(partitionField);
}
});
return specBuilder.build();
}

This PR simply adds iceberg.partition.spec, pass it to createPartitionSpec, then pass the partition spec to catalog. createTable.

TBD

@hasyimibhar hasyimibhar requested a review from a team as a code owner December 10, 2025 09:47
@hasyimibhar hasyimibhar marked this pull request as draft December 10, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant