@@ -1041,15 +1041,12 @@ void testAppendWrite(boolean clustering) {
10411041 }
10421042
10431043 @ ParameterizedTest
1044- @ EnumSource (value = ExecMode .class )
1045- void testWriteAndReadWithTimestampPartitioning (ExecMode execMode ) {
1046- // can not read the hive style and timestamp based partitioning table
1047- // in batch mode, the code path in CopyOnWriteInputFormat relies on
1048- // the value on the partition path to recover the partition value,
1049- // but the date format has changed(milliseconds switch to hours).
1044+ @ MethodSource ("executionModeAndPartitioningParams" )
1045+ void testWriteAndReadWithTimestampPartitioning (ExecMode execMode , boolean hiveStylePartitioning ) {
10501046 TableEnvironment tableEnv = execMode == ExecMode .BATCH ? batchTableEnv : streamTableEnv ;
10511047 String hoodieTableDDL = sql ("t1" )
10521048 .option (FlinkOptions .PATH , tempFile .getAbsolutePath ())
1049+ .option (FlinkOptions .HIVE_STYLE_PARTITIONING , hiveStylePartitioning )
10531050 .partitionField ("ts" ) // use timestamp as partition path field
10541051 .end ();
10551052 tableEnv .executeSql (hoodieTableDDL );
@@ -1068,6 +1065,26 @@ void testWriteAndReadWithTimestampPartitioning(ExecMode execMode) {
10681065 + "+I[id8, Han, 56, 1970-01-01T00:00:08, par4]]" );
10691066 }
10701067
1068+ @ Test
1069+ void testMergeOnReadCompactionWithTimestampPartitioning () {
1070+ TableEnvironment tableEnv = batchTableEnv ;
1071+
1072+ String hoodieTableDDL = sql ("t1" )
1073+ .option (FlinkOptions .PATH , tempFile .getAbsolutePath ())
1074+ .option (FlinkOptions .TABLE_TYPE , FlinkOptions .TABLE_TYPE_MERGE_ON_READ )
1075+ .option (FlinkOptions .COMPACTION_DELTA_COMMITS , 1 )
1076+ .option (FlinkOptions .COMPACTION_TASKS , 1 )
1077+ .partitionField ("ts" )
1078+ .end ();
1079+ tableEnv .executeSql (hoodieTableDDL );
1080+ execInsertSql (tableEnv , TestSQL .INSERT_T1 );
1081+
1082+ List <Row > rows = CollectionUtil .iterableToList (
1083+ () -> tableEnv .sqlQuery ("select * from t1" ).execute ().collect ());
1084+
1085+ assertRowsEquals (rows , TestData .DATA_SET_SOURCE_INSERT );
1086+ }
1087+
10711088 @ ParameterizedTest
10721089 @ ValueSource (strings = {FlinkOptions .PARTITION_FORMAT_DAY , FlinkOptions .PARTITION_FORMAT_DASHED_DAY })
10731090 void testWriteAndReadWithDatePartitioning (String partitionFormat ) {
0 commit comments