zhangyue19921010 commented on code in PR #13409:
URL: https://github.com/apache/hudi/pull/13409#discussion_r2135279329


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/configuration/FlinkOptions.java:
##########
@@ -586,6 +586,35 @@ private FlinkOptions() {
       .withDescription("Maximum memory in MB for a write task, when the 
threshold hits,\n"
           + "it flushes the max size data bucket to avoid OOM, default 1GB");
 
+  @AdvancedConfig
+  public static final ConfigOption<Boolean> WRITE_BUFFER_SORT_ENABLED = 
ConfigOptions
+      .key("write.buffer.sort.enabled")
+      .booleanType()
+      .defaultValue(false) // default no limit
+      .withDescription("Whether to enable buffer sort within append write 
function.");
+
+  @AdvancedConfig
+  public static final ConfigOption<String> WRITE_BUFFER_SORT_KEYS = 
ConfigOptions
+      .key("write.buffer.sort.keys")
+      .stringType()
+      .noDefaultValue() // default no limit
+      .withDescription("Sort keys concatenated by comma for append write 
function.");
+
+  @AdvancedConfig
+  public static final ConfigOption<Long> WRITE_BUFFER_SIZE = ConfigOptions
+      .key("write.buffer.size")
+      .longType()
+      .defaultValue(1000L) // default no limit
+      .withDescription("Buffer size of each partition key for append write 
function.");
+
+  @AdvancedConfig
+  public static final ConfigOption<Long> WRITE_TIMER_INTERVAL = ConfigOptions

Review Comment:
   IMO, It is recommended to reuse existing capabilities 
   ```
   public class BufferUtils {
     // minimum pages for a BinaryInMemorySortBuffer
     private static final int MIN_REQUIRED_BUFFERS = 3;
   
     public static BinaryInMemorySortBuffer createBuffer(RowType rowType, 
MemorySegmentPool memorySegmentPool) {
       if (memorySegmentPool.freePages() < MIN_REQUIRED_BUFFERS) {
         // there is no enough free pages to create a binary buffer, may need 
flush first.
         throw new MemoryPagesExhaustedException("Free pages are not enough to 
create a BinaryInMemorySortBuffer.");
       }
       // currently do not need to sort records in the binary buffer.
       NormalizedKeyComputer keyComputer = new NaturalOrderKeyComputer();
       RecordComparator recordComparator = new NaturalOrderRecordComparator();
       return BinaryInMemorySortBuffer.createBuffer(
           keyComputer,
           new RowDataSerializer(rowType),
           new BinaryRowDataSerializer(rowType.getFieldCount()),
           recordComparator,
           memorySegmentPool);
     }
   }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to