hudi-agent commented on code in PR #19399:
URL: https://github.com/apache/hudi/pull/19399#discussion_r3677526213
##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/append/TestAppendWriteFunctionWithBufferSort.java:
##########
@@ -81,6 +99,114 @@ public void testCustomSortKeysOverrideDefault() {
assertEquals(Arrays.asList("age", "name"), resolvedSortKeys);
}
+ @Test
+ public void testEmptySortKeysAreRejected() {
+ conf.set(FlinkOptions.WRITE_BUFFER_SORT_KEYS, " , , ");
+
+ assertThrows(IllegalArgumentException.class, () ->
AppendWriteFunctions.resolveSortKeys(conf));
+ }
+
+ @ParameterizedTest
+ @EnumSource(BufferType.class)
+ public void testFactorySelectsConfiguredBuffer(BufferType bufferType) {
+ conf.set(FlinkOptions.WRITE_BUFFER_TYPE, bufferType.name());
+ RowType rowType = TestConfigurations.ROW_TYPE;
+
+ AppendWriteFunction<RowData> function = AppendWriteFunctions.create(conf,
rowType);
+
+ switch (bufferType) {
+ case CONTINUOUS_SORT:
+ assertInstanceOf(AppendWriteFunctionWithContinuousSort.class,
function);
+ break;
+ case DISRUPTOR:
+ assertInstanceOf(AppendWriteFunctionWithDisruptorBufferSort.class,
function);
+ break;
+ case BOUNDED_IN_MEMORY:
+ assertInstanceOf(AppendWriteFunctionWithBIMBufferSort.class, function);
+ break;
+ case NONE:
+ assertEquals(AppendWriteFunction.class, function.getClass());
+ break;
+ default:
+ throw new AssertionError("Unexpected buffer type " + bufferType);
+ }
+ }
+
+ @ParameterizedTest
+ @EnumSource(value = BufferType.class, names = {"CONTINUOUS_SORT",
"DISRUPTOR", "BOUNDED_IN_MEMORY"})
+ public void testBufferedAppendFunctionsWriteAndFlushOnCheckpoint(BufferType
bufferType) throws Exception {
+ Configuration writeConf =
TestConfigurations.getDefaultConf(tempFile.getAbsolutePath());
Review Comment:
🤖 nit: this writeConf setup block (operation/metadata/buffer type/sort
keys/size + the continuous/disruptor if-else) is duplicated verbatim in
testBufferedAppendFunctionsPersistRowsInSortOrder — could you pull it into a
small `buildWriteConf(bufferType)` helper?
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]