xx789633 commented on code in PR #1565:
URL: https://github.com/apache/fluss/pull/1565#discussion_r2284641890
##########
fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/utils/IcebergConversions.java:
##########
@@ -17,15 +17,38 @@
package com.alibaba.fluss.lake.iceberg.utils;
+import com.alibaba.fluss.lake.writer.WriterInitContext;
import com.alibaba.fluss.metadata.TablePath;
+import org.apache.iceberg.PartitionKey;
+import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.Table;
import org.apache.iceberg.catalog.TableIdentifier;
+import static
com.alibaba.fluss.metadata.ResolvedPartitionSpec.PARTITION_SPEC_SEPARATOR;
+
/** Utility class for static conversions between Fluss and Iceberg types. */
public class IcebergConversions {
/** Convert Fluss TablePath to Iceberg TableIdentifier. */
public static TableIdentifier toIceberg(TablePath tablePath) {
return TableIdentifier.of(tablePath.getDatabaseName(),
tablePath.getTableName());
}
+
+ public static PartitionKey toPartition(Table table, WriterInitContext
writerInitContext) {
+ PartitionSpec partitionSpec = table.spec();
+ Schema schema = table.schema();
+ PartitionKey partitionKey = new PartitionKey(partitionSpec, schema);
+ int pos = 0;
+ String partitionName = writerInitContext.partition();
+ if (partitionName != null) {
+ String[] partitionArr = partitionName.split("\\" +
PARTITION_SPEC_SEPARATOR);
+ for (String partition : partitionArr) {
Review Comment:
Instead of setting the partition key from the partition name one by one, can
we just simply set the whole tableBucket object as the partition key?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]