You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/06/05 11:34:55 UTC

[GitHub] [hudi] leesf commented on a change in pull request #2616: [HUDI-1625] Support range partition keygen

leesf commented on a change in pull request #2616:
URL: https://github.com/apache/hudi/pull/2616#discussion_r645980052



##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/RangePartitionAvroKeyGenerator.java
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.keygen;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.exception.HoodieKeyGeneratorException;
+import org.apache.hudi.exception.HoodieNotSupportedException;
+import org.apache.hudi.keygen.constant.KeyGeneratorOptions;
+
+import org.apache.avro.generic.GenericRecord;
+
+public class RangePartitionAvroKeyGenerator extends SimpleAvroKeyGenerator {
+
+  private final Long rangePerBucket;
+  private final String partitionName;
+
+  public static class Config {
+    public static final String RANGE_PER_PARTITION_PROP = "hoodie.keygen.range.partition.num";
+    public static final Long DEFAULT_RANGE_PER_PARTITION = 100000L;
+    public static final String RANGE_PARTITION_NAME_PROP = "hoodie.keygen.range.partition.name";
+    public static final String DEFAULT_RANGE_PARTITION_NAME = "rangePartition";

Review comment:
       I am curious about what the partition name will be set in cdc scenario, should it be the incremental primary key or some other fields to make the range partition useful?




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