MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / encode_f64_pipeline

Function encode_f64_pipeline

nodedb-codec/src/pipeline.rs:59–89  ·  view source on GitHub ↗

Encode f64 values through a cascading pipeline.

(values: &[f64], codec: ColumnCodec)

Source from the content-addressed store, hash-verified

57
58/// Encode f64 values through a cascading pipeline.
59pub fn encode_f64_pipeline(values: &[f64], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> {
60 match codec {
61 // Cascading chains — lz4 terminal.
62 ColumnCodec::AlpFastLanesLz4 => encode_alp_fastlanes_lz4(values),
63 ColumnCodec::AlpRdLz4 => {
64 let alp_rd_bytes = crate::alp_rd::encode(values)?;
65 Ok(crate::lz4::encode(&alp_rd_bytes))
66 }
67 ColumnCodec::PcodecLz4 => {
68 let pco_bytes = crate::pcodec::encode_f64(values)?;
69 Ok(crate::lz4::encode(&pco_bytes))
70 }
71 // Cascading chains — rANS terminal (cold tier).
72 ColumnCodec::AlpFastLanesRans => encode_alp_fastlanes_rans(values),
73 // Single-step codecs (small partitions / non-ALP-encodable data).
74 ColumnCodec::Gorilla => Ok(crate::gorilla::encode_f64(values)),
75 ColumnCodec::Raw => {
76 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
77 Ok(crate::raw::encode(&raw))
78 }
79 ColumnCodec::Lz4 => {
80 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
81 Ok(crate::lz4::encode(&raw))
82 }
83 ColumnCodec::Zstd => {
84 let raw: Vec<u8> = values.iter().flat_map(|v| v.to_le_bytes()).collect();
85 crate::zstd_codec::encode(&raw)
86 }
87 _ => Ok(crate::gorilla::encode_f64(values)),
88 }
89}
90
91/// Encode raw bytes (symbol columns or string data) through a pipeline.
92pub fn encode_bytes_pipeline(raw: &[u8], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> {

Callers 6

legacy_codecs_still_workFunction · 0.85
empty_valuesFunction · 0.85
encode_f64_with_validityFunction · 0.85
encode_columnFunction · 0.85

Calls 6

encode_alp_fastlanes_lz4Function · 0.85
collectMethod · 0.80
encodeFunction · 0.70
encode_f64Function · 0.70
iterMethod · 0.45

Tested by 4

legacy_codecs_still_workFunction · 0.68
empty_valuesFunction · 0.68