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/03/01 06:06:36 UTC

[GitHub] [hudi] pmgod8922 opened a new issue #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

pmgod8922 opened a new issue #4929:
URL: https://github.com/apache/hudi/issues/4929


   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?
   
   - Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.
   
   - If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   
   A clear and concise description of the problem.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   1. Create Sparksession  
           SparkSession sparkSession = SparkSession.builder().enableHiveSupport().appName("HudiTest")
                   .config("spark.serializer","org.apache.spark.serializer.KryoSerializer")
                   .getOrCreate();
           Dataset<Row> dSet = sparkSession.sql(" .....  ");
   2.Configure hudi parameters
           optionMap.put(DataSourceWriteOptions.RECORDKEY_FIELD().key(),"uuid");
           optionMap.put(DataSourceWriteOptions.PRECOMBINE_FIELD().key(),"dt");
           optionMap.put(DataSourceWriteOptions.PARTITIONPATH_FIELD().key(),"dt");
           optionMap.put("hoodie.insert.shuffle.parallelism","10");
           optionMap.put("hoodie.upsert.shuffle.parallelism","10");
           optionMap.put("hoodie.datasource.write.operation","insert");
           optionMap.put("hoodie.parquet.small.file.limit","94857600");
           optionMap.put("hoodie.parquet.max.file.size","200829120");
           optionMap.put("hoodie.merge.allow.duplicate.on.inserts","true");
           optionMap.put(HoodieWriteConfig.TBL_NAME.key(),"my_table_B");
   3. Output  Data To Hdfs 
   4.Found small files not merged
   <img width="1428" alt="image" src="https://user-images.githubusercontent.com/13418464/156114291-f07d625d-f8e3-42dd-8ed7-c5f23ece838f.png">
   
   
   **Expected behavior**
   
   A clear and concise description of what you expected to happen.
   
   **Environment Description**
   
   * Hudi version :
   hudi-spark-bundle_2.11 0.9.0  
   * Spark version :
   spark-core_2.11 2.3.1
   * Hive version :
   
   * Hadoop version :
   
   * Storage (HDFS/S3/GCS..) :
   
   * Running on Docker? (yes/no) :
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   


-- 
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 #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

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


   


-- 
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 #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

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


   In general, small file handling logic in hudi is as follows. 
   In Commit C1, if you end up writing files of size 10MB(filegroup1), 20MB(file group2) , 100MB(file group3) for eg.
   in Commit C2, if you get inserts, hudi bin packs them into file group1 and file group2 so that it can grow upto 100MB (assuming you have set max parquet file size to 100MB). 
   
   Within the same batch, atleast for the first commit, hudi will not have idea on the size of the record and so it assumes avg record size as 1KB and creates the splits. 
   


-- 
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] pmgod8922 commented on issue #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

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


   thank you very much


-- 
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 #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

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


   I assume all files seen in snapshot are written in one commit. and not across diff commits. 
   and I guess its the first commit you are making to the hudi table.
   if thats the case, may be you need to set the right value for 
   https://hudi.apache.org/docs/configurations/#hoodiecopyonwriterecordsizeestimate 
   
   If you are not sure of your record size, you can check the commit metadata of already committed file.
   
   ```
   ls -ltr /tmp/hudi_trips_cow/.hoodie/
   total 32
   drwxr-xr-x  2 nsb  wheel    64 Mar  2 10:08 archived
   -rw-r--r--  1 nsb  wheel   600 Mar  2 10:08 hoodie.properties
   -rw-r--r--  1 nsb  wheel     0 Mar  2 10:08 20220302100851024.commit.requested
   -rw-r--r--  1 nsb  wheel  2594 Mar  2 10:08 20220302100851024.inflight
   -rw-r--r--  1 nsb  wheel  4428 Mar  2 10:08 20220302100851024.commit
   ```
   ```
   cat /tmp/hudi_trips_cow/.hoodie/20220302100851024.commit
   {
     "partitionToWriteStats" : {
       "americas/brazil/sao_paulo" : [ {
         "fileId" : "12a03b4e-e371-4586-913e-fa496332a982-0",
         "path" : "americas/brazil/sao_paulo/12a03b4e-e371-4586-913e-fa496332a982-0_0-28-33_20220302100851024.parquet",
         "prevCommit" : "null",
         "numWrites" : 1,
         "numDeletes" : 0,
         "numUpdateWrites" : 0,
         "numInserts" : 1,
         "totalWriteBytes" : 437642,
         "totalWriteErrors" : 0,
         "tempPath" : null,
         "partitionPath" : "americas/brazil/sao_paulo",
         "totalLogRecords" : 0,
         "totalLogFilesCompacted" : 0,
         "totalLogSizeCompacted" : 0,
         "totalUpdatedRecordsCompacted" : 0,
         "totalLogBlocks" : 0,
         "totalCorruptLogBlock" : 0,
         "totalRollbackBlocks" : 0,
         "fileSizeInBytes" : 437642,
         "minEventTime" : null,
         "maxEventTime" : null
       } ],
       "americas/united_states/san_francisco" : [ {
         "fileId" : "bfb3b7ac-e484-4264-b4f0-51d3154de619-0",
         "path" : "americas/united_states/san_francisco/bfb3b7ac-e484-4264-b4f0-51d3154de619-0_1-34-34_20220302100851024.parquet",
   .
   .
   ```
   
   you can calculate using numWrites and fileSizeInBytes. 
   
   
   


-- 
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 edited a comment on issue #4929: [SUPPORT] SparkSession To Hudi Small files are not merged

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


   In general, small file handling logic in hudi is as follows. 
   In Commit C1, if you end up writing files of size 10MB(filegroup1), 20MB(file group2) , 100MB(file group3) for eg.
   in Commit C2, if you get inserts, hudi bin packs them into file group1 and file group2 so that it can grow upto 100MB (assuming you have set max parquet file size to 100MB). 
   
   Within the same batch, atleast for the first commit, hudi will not have idea on the size of the record and so it assumes avg record size as 1KB and creates the splits. 
   may be, thats the reason you are seeing lot of 6.5 MB files. another reason could be, you are using too much of parallelism, and so every spark task gets only 6.5MB worth of data. 


-- 
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