urlyy commented on PR #2898:
URL: https://github.com/apache/fory/pull/2898#issuecomment-3535278973
Can we modify the format of `version_hash`?
The reason is that Rust needs to compute the `version_hash` at compile time
for different compression scenarios, which requires calculating **$2^5$**
hashes (because of compress_i32 / not_compress_i32 / not_compress_i64 /
compress_to_var_i64/ compress_to_sli_i64`). If we further add `U32 / VAR_U32 /
U64 / VAR_U64 / SLI_U64`, it becomes even more explosive.
Separating the two compression flags can effectively mitigate this situation.
Which means, for `int_32` and `int_64`, when computing the hash, we only
treat them as `Types::INT32` and `Types::INT64`. Then, after finishing the loop
over all fields,
```rust
for field in fields {
fingerprint.push_str(&effective_type_id.to_string());
fingerprint.push(',');
fingerprint.push_str(if *nullable { "1;" } else { "0;" });
}
```
we can append:
```rust
fingerprint.push_str(if type_resolver.compress_int { "1;" } else { "0;" });
fingerprint.push_str(format!("{};", type_resolver.long_encoding as i16));
```
to add compress_flag information to hash value.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]