Decode raw bytes (symbol columns or string data) from a pipeline.
(data: &[u8], codec: ColumnCodec)
| 190 | |
| 191 | /// Decode raw bytes (symbol columns or string data) from a pipeline. |
| 192 | pub fn decode_bytes_pipeline(data: &[u8], codec: ColumnCodec) -> Result<Vec<u8>, CodecError> { |
| 193 | match codec { |
| 194 | ColumnCodec::FsstLz4 => { |
| 195 | let fsst_bytes = crate::lz4::decode(data)?; |
| 196 | let strings = crate::fsst::decode(&fsst_bytes)?; |
| 197 | strings.into_iter().next().ok_or(CodecError::Corrupt { |
| 198 | detail: "FSST decode produced no output".into(), |
| 199 | }) |
| 200 | } |
| 201 | ColumnCodec::FsstRans => { |
| 202 | let fsst_bytes = crate::rans::decode(data)?; |
| 203 | let strings = crate::fsst::decode(&fsst_bytes)?; |
| 204 | strings.into_iter().next().ok_or(CodecError::Corrupt { |
| 205 | detail: "FSST decode produced no output".into(), |
| 206 | }) |
| 207 | } |
| 208 | ColumnCodec::Raw => crate::raw::decode(data), |
| 209 | ColumnCodec::Lz4 => crate::lz4::decode(data), |
| 210 | ColumnCodec::Zstd => crate::zstd_codec::decode(data), |
| 211 | ColumnCodec::FastLanesLz4 => { |
| 212 | let i64_vals = decode_fastlanes_lz4_i64(data)?; |
| 213 | Ok(i64_vals |
| 214 | .iter() |
| 215 | .flat_map(|&v| (v as u32).to_le_bytes()) |
| 216 | .collect()) |
| 217 | } |
| 218 | _ => crate::raw::decode(data).or_else(|_| Ok(data.to_vec())), |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // --------------------------------------------------------------------------- |
| 223 | // Cascading chain implementations |