gemini-code-assist[bot] commented on code in PR #39022:
URL: https://github.com/apache/beam/pull/39022#discussion_r3437304283
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/AddFiles.java:
##########
@@ -532,17 +532,25 @@ private Table getOrCreateTable(String filePath,
FileFormat format) throws IOExce
org.apache.iceberg.Schema schema = getSchema(filePath, format);
PartitionSpec spec = PartitionUtils.toPartitionSpec(partitionFields,
schema);
SortOrder sortOrder = SortOrderUtils.toSortOrder(sortFields, schema);
-
- Catalog.TableBuilder builder =
- catalogConfig
- .catalog()
- .buildTable(tableId, schema)
- .withPartitionSpec(spec)
- .withSortOrder(sortOrder);
+ Map<String, String> properties = new HashMap<>();
if (tableProps != null) {
- builder.withProperties(tableProps);
+ properties.putAll(tableProps);
+ }
+ if (properties.get(TableProperties.DEFAULT_NAME_MAPPING) == null) {
Review Comment:

We can simplify the initialization of the `properties` map using a ternary
operator and use `containsKey` instead of checking if `get()` is `null`.
Checking `containsKey` is more idiomatic and robust as it explicitly checks for
the presence of the key and avoids ambiguity if a key is mapped to a `null`
value.
```suggestion
Map<String, String> properties =
tableProps != null ? new HashMap<>(tableProps) : new
HashMap<>();
if (!properties.containsKey(TableProperties.DEFAULT_NAME_MAPPING))
{
```
--
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]