rfyu commented on code in PR #7620:
URL: https://github.com/apache/iceberg/pull/7620#discussion_r1206081907
##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/IcebergTableSink.java:
##########
@@ -70,9 +78,30 @@ public SinkRuntimeProvider getSinkRuntimeProvider(Context
context) {
!overwrite || context.isBounded(),
"Unbounded data stream doesn't support overwrite operation.");
- List<String> equalityColumns =
+ List<String> primaryKeys =
tableSchema.getPrimaryKey().map(UniqueConstraint::getColumns).orElseGet(ImmutableList::of);
+ List<String> partitionFields = ImmutableList.of();
+ if (Boolean.parseBoolean(writeProps.get(TableProperties.UPSERT_ENABLED))) {
+ tableLoader.open();
+ try (TableLoader loader = tableLoader) {
+ Table table = loader.loadTable();
+ if (table.spec().isPartitioned()) {
+ partitionFields =
+
table.spec().fields().stream().map(PartitionField::name).collect(Collectors.toList());
+ }
+ } catch (IOException e) {
+ throw new UncheckedIOException(
+ "Failed to load iceberg table from table loader: " + tableLoader,
e);
+ }
+ }
+
+ List<String> equalityColumns =
Review Comment:
Thanks for your review. I made this modification because I noticed a prompt
on the official website that requires including the partition field in the
equality column when writing to a partitioned table in upsert mode. If we want
to update rows in the entire table based on the primary key, what
recommendations do you have?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]