[HUDI-2798] Fix flink query operation fields (#4041)
This commit is contained in:
@@ -39,6 +39,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -221,8 +222,9 @@ public class TestInputFormat {
|
||||
assertThat(actual2, is(expected2));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testReadBaseAndLogFilesWithDisorderUpdateDelete() throws Exception {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
void testReadBaseAndLogFilesWithDisorderUpdateDelete(boolean compact) throws Exception {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put(FlinkOptions.CHANGELOG_ENABLED.key(), "true");
|
||||
beforeEach(HoodieTableType.MERGE_ON_READ, options);
|
||||
@@ -233,7 +235,7 @@ public class TestInputFormat {
|
||||
TestData.writeData(TestData.DATA_SET_SINGLE_INSERT, conf);
|
||||
|
||||
// write another commit using logs and read again.
|
||||
conf.setBoolean(FlinkOptions.COMPACTION_ASYNC_ENABLED, false);
|
||||
conf.setBoolean(FlinkOptions.COMPACTION_ASYNC_ENABLED, compact);
|
||||
TestData.writeData(TestData.DATA_SET_DISORDER_UPDATE_DELETE, conf);
|
||||
|
||||
InputFormat<RowData, ?> inputFormat = this.tableSource.getInputFormat();
|
||||
@@ -242,9 +244,11 @@ public class TestInputFormat {
|
||||
// when isEmitDelete is false.
|
||||
List<RowData> result1 = readData(inputFormat);
|
||||
|
||||
final String rowKind = compact ? "I" : "U";
|
||||
final String expected = "[+" + rowKind + "[id1, Danny, 22, 1970-01-01T00:00:00.004, par1]]";
|
||||
|
||||
final String actual1 = TestData.rowDataToString(result1);
|
||||
final String expected1 = "[+U[id1, Danny, 22, 1970-01-01T00:00:00.004, par1]]";
|
||||
assertThat(actual1, is(expected1));
|
||||
assertThat(actual1, is(expected));
|
||||
|
||||
// refresh the input format and set isEmitDelete to true.
|
||||
this.tableSource.reset();
|
||||
@@ -254,8 +258,7 @@ public class TestInputFormat {
|
||||
List<RowData> result2 = readData(inputFormat);
|
||||
|
||||
final String actual2 = TestData.rowDataToString(result2);
|
||||
final String expected2 = "[+U[id1, Danny, 22, 1970-01-01T00:00:00.004, par1]]";
|
||||
assertThat(actual2, is(expected2));
|
||||
assertThat(actual2, is(expected));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user