You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "hudi-bot (via GitHub)" <gi...@apache.org> on 2025/11/30 04:35:45 UTC

[I] Code cleanup: HFileDataBock - using integer keys is never used [hudi]

hudi-bot opened a new issue, #14942:
URL: https://github.com/apache/hudi/issues/14942

   KeyField can never be empty for File. If so, there is really no need for falling back to sequential integer keys in the HFileDataBlock::serializeRecords() code path.
   
    
   {noformat}
   // Build the record key
   final Field schemaKeyField = records.get(0).getSchema().getField(this.keyField);
   if (schemaKeyField == null) {
     // Missing key metadata field. Use an integer sequence key instead.
     useIntegerKey = true;
     keySize = (int) Math.ceil(Math.log(records.size())) + 1;
   }
   
   while (itr.hasNext()) {
     IndexedRecord record = itr.next();
     String recordKey;
     if (useIntegerKey) {
       recordKey = String.format("%" + keySize + "s", key++);
     } else {
       recordKey = record.get(schemaKeyField.pos()).toString();
     }
   
   {noformat}
   
   ## JIRA info
   
   - Link: https://issues.apache.org/jira/browse/HUDI-2954
   - Type: Wish
   - Fix version(s):
     - 1.1.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.apache.org

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