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 2019/07/07 09:06:39 UTC

[GitHub] [incubator-iceberg] aokolnychyi commented on a change in pull request #263: [WIP] Make metrics collection configurable via table properties

aokolnychyi commented on a change in pull request #263: [WIP] Make metrics collection configurable via table properties
URL: https://github.com/apache/incubator-iceberg/pull/263#discussion_r300857161
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/MetricsSpec.java
 ##########
 @@ -0,0 +1,72 @@
+/*
+ * 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 com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import java.util.Locale;
+import java.util.Map;
+
+import static org.apache.iceberg.TableProperties.DEFAULT_WRITE_METRICS_MODE;
+import static org.apache.iceberg.TableProperties.DEFAULT_WRITE_METRICS_MODE_DEFAULT;
+
+public class MetricsSpec {
+  public enum MetricsMode {
+    FULL,
+    COUNTS,
+    NONE;
+
+    static MetricsMode fromString(String mode) {
+      Preconditions.checkArgument(mode != null, "Cannot convert null into a metrics mode");
+      return MetricsMode.valueOf(mode.toUpperCase(Locale.ENGLISH));
+    }
+  }
+
+  private static final String COLUMN_CONF_PREFIX = "write.metadata.metrics.column.";
+
+  private Map<String, MetricsMode> columnModes = Maps.newHashMap();
+  private MetricsMode defaultMode;
+
+  private MetricsSpec() {}
 
 Review comment:
   I think people should be able to configure all metrics by column. How will properties look like?
   ```
   write.metadata.truncate-length=10
   write.metadata.metrics.default=none
   write.metadata.metrics.column.col1=counts
   write.metadata.metrics.column.col1=truncate(10)
   write.metadata.metrics.column.col1=all
   ```
   
   Do we need a separate property for truncating? Can we configure it like this?
   
   ```
   write.metadata.metrics.default=none
   write.metadata.metrics.column.col1=counts
   write.metadata.metrics.column.col1=truncate(10)
   write.metadata.metrics.column.col1=full
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org