You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/01/24 07:52:31 UTC

[GitHub] [hudi] Kavin88 opened a new issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Kavin88 opened a new issue #4675:
URL: https://github.com/apache/hudi/issues/4675


   Hi Team,
   
   We are trying to create partition folders in below format using hudi 0.5.0. 
   s3://bucketname/folder1/**partition_col_nm1=**2015-01-01/
   s3://bucketname/folder1/**partition_col_nm1=**2016-01-01/
   
   But it supports only this one, without the partition column names. 
   s3://bucketname/folder1/2015-01-01/
   s3://bucketname/folder1/2016-01-01/
   
   Any workaround to achieve this format s3://bucketname/folder1/partition_col_nm1=2015-01-01/  in hudi 0.5.0 ? This will be of great help  even at the time we upgrade to the hudi latest version , there should not be need to rebuild/reload these partitioned tables.
   
   
   **Environment Description**
   
   * Hudi version : 0.5.0
   
   * Spark version : 2.4.4
   
   * Hive version : 3.1.2
   
   * Hadoop version : 3.2.1
   
   * Storage (HDFS/S3/GCS..) :s3
   
   * Running on Docker? (yes/no) : no
   
   
   inputDF = spark.createDataFrame(
       [
           ("100", "2015-01-01", "2015-01-01T13:51:39.340396Z"),
           ("101", "2015-01-01", "2015-01-01T12:14:58.597216Z"),
           ("102", "2015-01-01", "2015-01-01T13:51:40.417052Z"),
           ("103", "2015-01-01", "2015-01-01T13:51:40.519832Z"),
           ("104", "2015-01-02", "2015-01-01T12:15:00.512679Z"),
           ("105", "2015-01-02", "2015-01-01T13:51:42.248818Z"),
       ],
       ["id", "creation_date", "last_update_time"],
   )
   
   # Specify common DataSourceWriteOptions in the single hudiOptions variable
   hudiOptions = {
       "hoodie.table.name": "my_hudi_table",
       "hoodie.datasource.write.recordkey.field": "id",
       "hoodie.datasource.write.partitionpath.field": "creation_date",
       "hoodie.datasource.write.precombine.field": "last_update_time",
       "hoodie.datasource.write.hive_style_partitioning": "true"
   }
   
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1027578046


   Thanks @ganczarek @nsivabalan  
   Just used the 0.5 jars which are existing and has no custom changes. Will check the possibility of writing custom key generator to overwrite getPartitionPath in hudi 0.5 code. . No other workarounds to achieve this ?  
   
   Good practice we think is to implement partitioning path like this s3://bucketname/folder1/partition_col_nm1=2015-01-01/ in 0.5  .  So even when hudi is upgrade from 0.5 to higher versions(say > 0.8) , the partitioning consistency will be maintained.  


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls edited a comment on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls edited a comment on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1027578046


   Thanks @ganczarek @nsivabalan  
   Just used the 0.5 jars which are existing and has no custom changes. Will check the possibility of writing custom key generator to overwrite getPartitionPath in hudi 0.5 code. . No other workarounds to achieve this ?  
   
   Good practice we think is to implement partitioning path like this s3://bucketname/folder1/partition_col_nm1=2015-01-01/ in 0.5  .  So even when hudi is upgraded from 0.5 to higher versions(say > 0.8) , the partitioning consistency will be maintained.  


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1030879317


   got it, thanks. Will go ahead and close this one out. 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls edited a comment on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls edited a comment on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1027578046


   Thanks @ganczarek @nsivabalan  
   Just used the 0.5 jars which are existing and has no custom changes. Will check the possibility of writing custom key generator to overwrite getPartitionPath in hudi 0.5 code. . No other workarounds to achieve this ?  
   
   We are planning to implement partitioning path like this s3://bucketname/folder1/partition_col_nm1=2015-01-01/ in 0.5 hudi release.  So even when hudi is upgraded from 0.5 to higher versions(say > 0.8) , the partitioning consistency will be maintained.  


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan closed issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
nsivabalan closed issue #4675:
URL: https://github.com/apache/hudi/issues/4675


   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] nsivabalan commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1025661408


   yeah. I can't think of other options. What @ganczarek suggested makes sense. KeyGenUtils is where hive style partitioning is enforced. 
   ```
     public static String getPartitionPath(GenericRecord record, String partitionPathField,
         boolean hiveStylePartitioning, boolean encodePartitionPath, boolean consistentLogicalTimestampEnabled) {
       String partitionPath = HoodieAvroUtils.getNestedFieldValAsString(record, partitionPathField, true, consistentLogicalTimestampEnabled);
       if (partitionPath == null || partitionPath.isEmpty()) {
         partitionPath = HUDI_DEFAULT_PARTITION_PATH;
       }
       if (encodePartitionPath) {
         partitionPath = PartitionPathEncodeUtils.escapePathName(partitionPath);
       }
       if (hiveStylePartitioning) {
         partitionPath = partitionPathField + "=" + partitionPath;
       }
       return partitionPath;
     }
   ```
   
   If you can put up a patch against 0.5.0, we can take a look to see if something is missing. Unfortunately we don't backport fixes. 
   
   
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] ganczarek commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
ganczarek commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1019941303


   @wjcwin Looking at the documentation, it appears that Hive style partitioning was implemented in v0.5.3.
   
   Have you tried creating custom key generator? Please note I'm new to Hudi and haven't used v0.5.0, but in theory the following should work:
   1. extend [SimpleKeyGenerator](https://github.com/apache/hudi/blob/master/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/SimpleKeyGenerator.java) (or whatever key generator you're currently using, SImpleKeyGenerator is default) and override `getPartitionPath`. That allows you to control partition path. Refer to [KeyGenUtils](https://github.com/apache/hudi/blob/cfde45b548fe5c425c0415e45993d4bbec1a1c5a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java#L156) and [RowKeyGeneratorHelper](https://github.com/apache/hudi/blob/36790709f76f71e72026f3f54218ea8b8e247ed2/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/RowKeyGeneratorHelper.java#L153) to see how it's done in the latest Hudi.
   2. set [hoodie.datasource.write.keygenerator.class](https://hudi.apache.org/docs/0.5.0/configurations#keygenerator_class_opt_key) with your custom key generator class.
   
   I hope it helps.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls edited a comment on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls edited a comment on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1027578046


   Thanks @ganczarek @nsivabalan  
   Currently using the 0.5 jars which has no custom changes. Will check the possibility of writing custom key generator to overwrite getPartitionPath in hudi 0.5 code. . No other workarounds to achieve this ?  
   
   We are planning to implement partitioning path like this s3://bucketname/folder1/partition_col_nm1=2015-01-01/ in 0.5 hudi release.  So even when hudi is upgraded from 0.5 to higher versions(say > 0.8) , the partitioning consistency will be maintained.  


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls edited a comment on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls edited a comment on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1020030963


   Thanks @ganczarek for the reply.  Does keygenerator changes the way partition folders are created ?
   @nsivabalan @codope  - Can you please suggest on how to implement this in 0.5.0 ?


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] stackls commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
stackls commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1020030963


   Not working.  I dont think keygenerator changes the way partition folders are created. 
   @nsivabalan @codope  - Can you please suggest on how to implement this in 0.5.0 ? 


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] ganczarek commented on issue #4675: [SUPPORT] Hudi Hive Style partitioning not working in 0.5.0

Posted by GitBox <gi...@apache.org>.
ganczarek commented on issue #4675:
URL: https://github.com/apache/hudi/issues/4675#issuecomment-1019976454


   I called a wrong person. I meant @stackls.


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org