@@ -70,11 +70,15 @@ pub const OTEL_METRICS_KNOWN_FIELD_LIST: [&str; 37] = [
7070 "scope_dropped_attributes_count" ,
7171 "resource_dropped_attributes_count" ,
7272 "resource_schema_url" ,
73- // Precomputed per-sample identity of the physical series. Stable hash
74- // of `metric_name` + sorted attribute key/value pairs. Lets the query
75- // layer group samples into physical series via a single u64 column
76- // read instead of decoding every label column and hashing per row.
77- "_series_hash" ,
73+ // Precomputed per-sample identity of the physical series. Stable
74+ // u64 hash of `metric_name` + sorted attribute key/value pairs,
75+ // stored as a decimal-encoded string so arrow-json infers Utf8 and
76+ // we get byte-exact roundtrip. Int64/Float64 inference dropped bits
77+ // for hashes near the high range; string sidesteps that entirely.
78+ // Lets the query layer group samples into physical series via a
79+ // single column read instead of decoding every label column and
80+ // hashing per row.
81+ "__series_hash" ,
7882] ;
7983
8084/// Compute a stable u64 identifier for the physical series a sample
@@ -618,13 +622,12 @@ fn process_resource_metrics<T, S, M>(
618622 // perspective). Computed once per data point — O(label
619623 // count) per sample, ~200 ns at typical attribute counts.
620624 let series_hash = compute_series_hash ( & dp) ;
621- // Bit-reinterpret u64 → i64 so arrow-json infers a
622- // signed integer column (it would coerce u64 values >
623- // i64::MAX to Float64 and lose precision). The query
624- // side reverses the cast: `i64.to_le_bytes() as u64`.
625+ // Stored as decimal-encoded string. Arrow-json
626+ // infers Utf8, preserving all 64 bits — Int64/Float64
627+ // inference truncated values near the high range.
625628 dp. insert (
626- "_series_hash " . to_string ( ) ,
627- Value :: Number ( ( series_hash as i64 ) . into ( ) ) ,
629+ "__series_hash " . to_string ( ) ,
630+ Value :: String ( series_hash. to_string ( ) ) ,
628631 ) ;
629632 vec_otel_json. push ( Value :: Object ( dp) ) ;
630633 }
0 commit comments