fn calculate_head_length()

in crates/paimon/src/file_index/file_index_format.rs [190:212]


fn calculate_head_length(
    body_info: &HashMap<String, HashMap<String, IndexInfo>>,
) -> crate::Result<usize> {
    // Magic + Version + HeadLength + ColumnNumber + RedundantLength
    let base_length = 8 + 4 + 4 + 4 + 4;
    let mut total_length = base_length;

    for (column_name, index_info) in body_info {
        // Column name length + actual column name length
        total_length += 2 + column_name.len();
        // IndexTypeSize (index number)
        total_length += 4;

        for index_name in index_info.keys() {
            // Index name length + actual index name length
            total_length += 2 + index_name.len();
            // start_pos (8 bytes) + length (8 bytes)
            total_length += 16;
        }
    }

    Ok(total_length)
}