You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/08/03 09:51:25 UTC
[GitHub] [iceberg] zhongyujiang opened a new pull request, #5426: Core: Rewrite parquet bloom filter props when updating schema.
zhongyujiang opened a new pull request, #5426:
URL: https://github.com/apache/iceberg/pull/5426
Same as #2257, update parquet bloom filter props in table props implicitly when updating schema.
I think when we add table properties that will be affected by schema changes later, we should make sure tracking them by ids internally instead of by names, as mentioned [here](https://github.com/apache/iceberg/issues/2079#issuecomment-780830166).
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r950662654
##########
core/src/main/java/org/apache/iceberg/PropertiesTransform.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.apache.iceberg.TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX;
+import static org.apache.iceberg.TableProperties.PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+
+class PropertiesTransform {
+ private PropertiesTransform() {}
+
+ static Map<String, String> applySchemaChanges(
Review Comment:
What do you think to maybe move it to PropertyUtil instead of start new class. Maybe we can make it generic (take a list of prefixes?)
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r954344358
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +95,44 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns,
+ Set<String> columnPrefixProperties) {
+ if (!properties.keySet().stream()
Review Comment:
Nit: could we keep noneMatch, like in original code? Its usually harder to read negations in the code.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] zhongyujiang commented on pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
zhongyujiang commented on PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#issuecomment-1222251702
@szehon-ho @huaxingao Thanks for your review, I updated the PR based on your comments, please take a look when you have time.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] huaxingao commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
huaxingao commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r950722773
##########
core/src/main/java/org/apache/iceberg/PropertiesTransform.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.apache.iceberg.TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX;
+import static org.apache.iceberg.TableProperties.PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+
+class PropertiesTransform {
+ private PropertiesTransform() {}
+
+ static Map<String, String> applySchemaChanges(
Review Comment:
+1
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] huaxingao commented on pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
huaxingao commented on PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#issuecomment-1221375367
@zhongyujiang The change looks good to me overall. Thanks for working on this! I agree with @szehon-ho that we probably can make it more generic and avoid adding a new class.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] zhongyujiang commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
zhongyujiang commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r954413670
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +95,44 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns,
+ Set<String> columnPrefixProperties) {
Review Comment:
Changed to `columnProperties`.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho merged pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho merged PR #5426:
URL: https://github.com/apache/iceberg/pull/5426
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r954345218
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +95,44 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns,
+ Set<String> columnPrefixProperties) {
Review Comment:
Nit: what do you think to change to prefixProperties or columnProperties? columnPrefixProperties may indicate wrongly that column is the prefix, so its a bit misleading at first.
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +95,44 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns,
+ Set<String> columnPrefixProperties) {
+ if (!properties.keySet().stream()
Review Comment:
Nit: coudl we keep noneMatch, like in original code? Its usually harder to read negations in the code.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r951989347
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -18,13 +18,23 @@
*/
package org.apache.iceberg.util;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
+import org.apache.iceberg.TableProperties;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
public class PropertyUtil {
+ private static final Set<String> COLUMN_PREFIX_PROPERTIES =
Review Comment:
Nit: I actually thought initially, about SchemaUpdate passing this explicitly (otherwise, there doesn't seem much use for making it a variable if its just hard-coded)
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +102,42 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns) {
+ if (!properties.keySet().stream()
+ .anyMatch(key -> COLUMN_PREFIX_PROPERTIES.stream().anyMatch(key::startsWith))) {
+ return properties;
+ } else {
+ Map<String, String> updatedProperties = Maps.newHashMap();
+ properties
+ .keySet()
+ .forEach(
+ key -> {
+ String prefix =
+ COLUMN_PREFIX_PROPERTIES.stream()
+ .filter(key::startsWith)
+ .findFirst()
+ .orElse(null);
+
+ if (prefix != null) {
+ String columnAlias = key.replaceFirst(prefix, "");
+ if (renamedColumns.get(columnAlias) != null) {
+ // The name has changed.
+ String newKey = prefix + renamedColumns.get(columnAlias);
+ updatedProperties.put(newKey, properties.get(key));
+ } else if (!deletedColumns.contains(columnAlias)) {
+ // Copy over the original.
+ updatedProperties.put(key, properties.get(key));
+ }
Review Comment:
Nit, the old comment 'implicit drop' may still make sense to keep?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] zhongyujiang commented on a diff in pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
zhongyujiang commented on code in PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#discussion_r952097640
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -92,4 +102,42 @@ public static Map<String, String> propertiesWithPrefix(
.filter(e -> e.getKey().startsWith(prefix))
.collect(Collectors.toMap(e -> e.getKey().replaceFirst(prefix, ""), Map.Entry::getValue));
}
+
+ public static Map<String, String> applySchemaChanges(
+ Map<String, String> properties,
+ List<String> deletedColumns,
+ Map<String, String> renamedColumns) {
+ if (!properties.keySet().stream()
+ .anyMatch(key -> COLUMN_PREFIX_PROPERTIES.stream().anyMatch(key::startsWith))) {
+ return properties;
+ } else {
+ Map<String, String> updatedProperties = Maps.newHashMap();
+ properties
+ .keySet()
+ .forEach(
+ key -> {
+ String prefix =
+ COLUMN_PREFIX_PROPERTIES.stream()
+ .filter(key::startsWith)
+ .findFirst()
+ .orElse(null);
+
+ if (prefix != null) {
+ String columnAlias = key.replaceFirst(prefix, "");
+ if (renamedColumns.get(columnAlias) != null) {
+ // The name has changed.
+ String newKey = prefix + renamedColumns.get(columnAlias);
+ updatedProperties.put(newKey, properties.get(key));
+ } else if (!deletedColumns.contains(columnAlias)) {
+ // Copy over the original.
+ updatedProperties.put(key, properties.get(key));
+ }
Review Comment:
Good catch!
##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -18,13 +18,23 @@
*/
package org.apache.iceberg.util;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
+import org.apache.iceberg.TableProperties;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
public class PropertyUtil {
+ private static final Set<String> COLUMN_PREFIX_PROPERTIES =
Review Comment:
Updated.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#issuecomment-1226857784
Thanks! Will wait a little if more comments, and then commit
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] szehon-ho commented on pull request #5426: Core: Transform parquet bloom filter props when updating schema.
Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #5426:
URL: https://github.com/apache/iceberg/pull/5426#issuecomment-1227904430
Merged, thanks @zhongyujiang and @huaxingao for review
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org