luoyuxia commented on code in PR #1565:
URL: https://github.com/apache/fluss/pull/1565#discussion_r2284662150
##########
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:
No, we can't set the whole tableBucket object. The `tableBucket` object
doesn't have the partition name info. We need to retrieve partition from
`partitionName`
--
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]