satishkotha commented on a change in pull request #2263:
URL: https://github.com/apache/hudi/pull/2263#discussion_r532813114



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieClusteringConfig.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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.hudi.config;
+
+import org.apache.hudi.common.config.DefaultHoodieConfig;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Clustering specific configs.
+ */
+public class HoodieClusteringConfig extends DefaultHoodieConfig {
+
+  public static final String SCHEDULE_CLUSTERING_STRATEGY_CLASS = 
"hoodie.clustering.schedule.strategy.class";
+  public static final String DEFAULT_SCHEDULE_CLUSTERING_STRATEGY_CLASS =
+      
"org.apache.hudi.client.clustering.schedule.SparkBoundedDayBasedScheduleClusteringStrategy";
+
+  public static final String RUN_CLUSTERING_STRATEGY_CLASS = 
"hoodie.clustering.run.strategy.class";
+  public static final String DEFAULT_RUN_CLUSTERING_STRATEGY_CLASS =
+      
"org.apache.hudi.client.clustering.run.SparkBulkInsertBasedRunClusteringStrategy";
+
+  // Turn on inline clustering - after few commits a inline compaction will be 
run
+  public static final String INLINE_CLUSTERING_PROP = 
"hoodie.clustering.inline";
+  private static final String DEFAULT_INLINE_CLUSTERING = "false";
+
+  public static final String INLINE_CLUSTERING_NUM_COMMIT_PROP = 
"hoodie.clustering.inline.num.commits";
+  private static final String DEFAULT_INLINE_CLUSTERING_NUM_COMMITS = "4";
+
+  public static final String CLUSTERING_TARGET_PARTITIONS = 
"hoodie.clustering.target.partitions";
+  public static final String DEFAULT_CLUSTERING_TARGET_PARTITIONS = 
String.valueOf(2);
+
+  // Each clustering operation can create multiple groups. Total amount of 
data processed by clustering operation
+  // is defined by below two properties (CLUSTERING_MAX_GROUP_SIZE * 
CLUSTERING_MAX_NUM_GROUPS).
+  // Max amount of data to be included in one group
+  public static final String CLUSTERING_MAX_GROUP_SIZE = 
"hoodie.clustering.max.group.size";
+  public static final String DEFAULT_CLUSTERING_MAX_GROUP_SIZE = 
String.valueOf(2 * 1024 * 1024 * 1024L);
+
+  public static final String CLUSTERING_MAX_NUM_GROUPS = 
"hoodie.clustering.max.num.groups";
+  public static final String DEFAULT_CLUSTERING_MAX_NUM_GROUPS = "1";
+
+  // Each group can produce 'N' 
(CLUSTERING_MAX_GROUP_SIZE/CLUSTERING_TARGET_FILE_SIZE) output file groups.
+  public static final String CLUSTERING_TARGET_FILE_SIZE = 
"hoodie.clustering.target.file.size";
+  public static final String DEFAULT_CLUSTERING_TARGET_FILE_SIZE = 
String.valueOf(1 * 1024 * 1024 * 1024L);
+
+  // Any strategy specific params can be saved with this prefix
+  public static final String CLUSTERING_STRATEGY_PARAM_PREFIX = 
"hoodie.clustering.strategy.param.";
+
+  // constants related to clustering that may be used by more than 1 strategy.
+  public static final String SORT_COLUMNS_PROPERTY = 
HoodieClusteringConfig.CLUSTERING_STRATEGY_PARAM_PREFIX + "sort.columns";
+
+  public HoodieClusteringConfig(Properties props) {
+    super(props);
+  }
+
+  public static Builder newBuilder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+
+    private final Properties props = new Properties();
+
+    public Builder fromFile(File propertiesFile) throws IOException {
+      try (FileReader reader = new FileReader(propertiesFile)) {
+        this.props.load(reader);
+        return this;
+      }
+    }
+
+    public Builder withScheduleClusteringStrategyClass(String 
clusteringStrategyClass) {
+      props.setProperty(SCHEDULE_CLUSTERING_STRATEGY_CLASS, 
clusteringStrategyClass);
+      return this;
+    }
+
+    public Builder withRunClusteringStrategyClass(String 
runClusteringStrategyClass) {
+      props.setProperty(RUN_CLUSTERING_STRATEGY_CLASS, 
runClusteringStrategyClass);
+      return this;
+    }
+
+    public Builder withClusteringTargetPartitions(String 
clusteringTargetPartitions) {
+      props.setProperty(CLUSTERING_TARGET_PARTITIONS, 
clusteringTargetPartitions);
+      return this;
+    }
+
+    public Builder withClusteringMaxGroupSize(long clusteringMaxGroupSize) {

Review comment:
       Fixed

##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieClusteringConfig.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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.hudi.config;
+
+import org.apache.hudi.common.config.DefaultHoodieConfig;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Clustering specific configs.
+ */
+public class HoodieClusteringConfig extends DefaultHoodieConfig {
+
+  public static final String SCHEDULE_CLUSTERING_STRATEGY_CLASS = 
"hoodie.clustering.schedule.strategy.class";
+  public static final String DEFAULT_SCHEDULE_CLUSTERING_STRATEGY_CLASS =
+      
"org.apache.hudi.client.clustering.schedule.SparkBoundedDayBasedScheduleClusteringStrategy";
+
+  public static final String RUN_CLUSTERING_STRATEGY_CLASS = 
"hoodie.clustering.run.strategy.class";
+  public static final String DEFAULT_RUN_CLUSTERING_STRATEGY_CLASS =
+      
"org.apache.hudi.client.clustering.run.SparkBulkInsertBasedRunClusteringStrategy";
+
+  // Turn on inline clustering - after few commits a inline compaction will be 
run
+  public static final String INLINE_CLUSTERING_PROP = 
"hoodie.clustering.inline";
+  private static final String DEFAULT_INLINE_CLUSTERING = "false";
+
+  public static final String INLINE_CLUSTERING_NUM_COMMIT_PROP = 
"hoodie.clustering.inline.num.commits";
+  private static final String DEFAULT_INLINE_CLUSTERING_NUM_COMMITS = "4";
+
+  public static final String CLUSTERING_TARGET_PARTITIONS = 
"hoodie.clustering.target.partitions";
+  public static final String DEFAULT_CLUSTERING_TARGET_PARTITIONS = 
String.valueOf(2);
+
+  // Each clustering operation can create multiple groups. Total amount of 
data processed by clustering operation
+  // is defined by below two properties (CLUSTERING_MAX_GROUP_SIZE * 
CLUSTERING_MAX_NUM_GROUPS).
+  // Max amount of data to be included in one group
+  public static final String CLUSTERING_MAX_GROUP_SIZE = 
"hoodie.clustering.max.group.size";
+  public static final String DEFAULT_CLUSTERING_MAX_GROUP_SIZE = 
String.valueOf(2 * 1024 * 1024 * 1024L);
+
+  public static final String CLUSTERING_MAX_NUM_GROUPS = 
"hoodie.clustering.max.num.groups";
+  public static final String DEFAULT_CLUSTERING_MAX_NUM_GROUPS = "1";
+
+  // Each group can produce 'N' 
(CLUSTERING_MAX_GROUP_SIZE/CLUSTERING_TARGET_FILE_SIZE) output file groups.
+  public static final String CLUSTERING_TARGET_FILE_SIZE = 
"hoodie.clustering.target.file.size";
+  public static final String DEFAULT_CLUSTERING_TARGET_FILE_SIZE = 
String.valueOf(1 * 1024 * 1024 * 1024L);
+
+  // Any strategy specific params can be saved with this prefix
+  public static final String CLUSTERING_STRATEGY_PARAM_PREFIX = 
"hoodie.clustering.strategy.param.";
+
+  // constants related to clustering that may be used by more than 1 strategy.
+  public static final String SORT_COLUMNS_PROPERTY = 
HoodieClusteringConfig.CLUSTERING_STRATEGY_PARAM_PREFIX + "sort.columns";
+
+  public HoodieClusteringConfig(Properties props) {
+    super(props);
+  }
+
+  public static Builder newBuilder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+
+    private final Properties props = new Properties();
+
+    public Builder fromFile(File propertiesFile) throws IOException {
+      try (FileReader reader = new FileReader(propertiesFile)) {
+        this.props.load(reader);
+        return this;
+      }
+    }
+
+    public Builder withScheduleClusteringStrategyClass(String 
clusteringStrategyClass) {
+      props.setProperty(SCHEDULE_CLUSTERING_STRATEGY_CLASS, 
clusteringStrategyClass);
+      return this;
+    }
+
+    public Builder withRunClusteringStrategyClass(String 
runClusteringStrategyClass) {
+      props.setProperty(RUN_CLUSTERING_STRATEGY_CLASS, 
runClusteringStrategyClass);
+      return this;
+    }
+
+    public Builder withClusteringTargetPartitions(String 
clusteringTargetPartitions) {
+      props.setProperty(CLUSTERING_TARGET_PARTITIONS, 
clusteringTargetPartitions);
+      return this;
+    }
+
+    public Builder withClusteringMaxGroupSize(long clusteringMaxGroupSize) {
+      props.setProperty(CLUSTERING_MAX_GROUP_SIZE, 
String.valueOf(clusteringMaxGroupSize));
+      return this;
+    }
+
+    public Builder withClusteringMaxNumGroups(int maxNumGroups) {
+      props.setProperty(CLUSTERING_MAX_NUM_GROUPS, 
String.valueOf(maxNumGroups));
+      return this;
+    }
+
+    public Builder withClusteringTargetFileSize(long targetFileSize) {

Review comment:
       Fixed




----------------------------------------------------------------
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]


Reply via email to