aokolnychyi commented on a change in pull request #2257:
URL: https://github.com/apache/iceberg/pull/2257#discussion_r630508484
##########
File path: core/src/main/java/org/apache/iceberg/MetricsConfig.java
##########
@@ -46,6 +47,35 @@ public static MetricsConfig getDefault() {
return spec;
}
+ public static Map<String, String> updateProperties(Map<String, String>
props, List<String> deletedColumns,
+ Map<String, String>
renamedColumns) {
+ if (props.keySet().stream().noneMatch(key ->
key.startsWith(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX))) {
+ return props;
+ } else {
+ Map<String, String> updatedProperties = Maps.newHashMap();
+ // Put all of the non metrics columns we aren't modifying
+ props.keySet().forEach(key -> {
+ if (key.startsWith(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX)) {
+ String columnAlias =
key.replaceFirst(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX, "");
+ if (renamedColumns.get(columnAlias) != null) {
+ // The name has changed.
+ String newKey = TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX +
Review comment:
Can we add a static import for `METRICS_MODE_COLUMN_CONF_PREFIX` like we
have for other two props in this class? That way, the class will be a little
bit more consistent and this logic will fit on one line.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]