File tree Expand file tree Collapse file tree
hudi-sync/hudi-sync-common/src
main/java/org/apache/hudi/sync/common
test/java/org/apache/hudi/sync/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ public class HoodieSyncConfig extends HoodieConfig {
8686 .key ("hoodie.datasource.hive_sync.partition_extractor_class" )
8787 .defaultValue ("org.apache.hudi.hive.SlashEncodedDayPartitionValueExtractor" )
8888 .withInferFunction (cfg -> {
89- if (cfg .contains (KeyGeneratorOptions .PARTITIONPATH_FIELD_NAME )) {
89+ if (StringUtils . nonEmpty ( cfg .getString (KeyGeneratorOptions .PARTITIONPATH_FIELD_NAME ) )) {
9090 int numOfPartFields = cfg .getString (KeyGeneratorOptions .PARTITIONPATH_FIELD_NAME ).split ("," ).length ;
9191 if (numOfPartFields == 1
9292 && cfg .contains (KeyGeneratorOptions .HIVE_STYLE_PARTITIONING_ENABLE )
Original file line number Diff line number Diff line change @@ -100,6 +100,12 @@ void testInferPartitonExtractorClass() {
100100 HoodieSyncConfig config3 = new HoodieSyncConfig (new Properties (), new Configuration ());
101101 assertEquals ("org.apache.hudi.hive.NonPartitionedExtractor" ,
102102 config3 .getStringOrDefault (META_SYNC_PARTITION_EXTRACTOR_CLASS ));
103+
104+ Properties props4 = new Properties ();
105+ props4 .setProperty (KeyGeneratorOptions .PARTITIONPATH_FIELD_NAME .key (), "" );
106+ HoodieSyncConfig config4 = new HoodieSyncConfig (props4 , new Configuration ());
107+ assertEquals ("org.apache.hudi.hive.NonPartitionedExtractor" ,
108+ config4 .getStringOrDefault (META_SYNC_PARTITION_EXTRACTOR_CLASS ));
103109 }
104110
105111 @ Test
You can’t perform that action at this time.
0 commit comments