MCPcopy Create free account
hub / github.com/apache/datafusion / convert_parquet_statistics

Function convert_parquet_statistics

datafusion-cli/src/functions.rs:255–301  ·  view source on GitHub ↗
(
    value: &Statistics,
    converted_type: ConvertedType,
)

Source from the content-addressed store, hash-verified

253}
254
255fn convert_parquet_statistics(
256 value: &Statistics,
257 converted_type: ConvertedType,
258) -> (Option<String>, Option<String>) {
259 match (value, converted_type) {
260 (Statistics::Boolean(val), _) => (
261 val.min_opt().map(|v| v.to_string()),
262 val.max_opt().map(|v| v.to_string()),
263 ),
264 (Statistics::Int32(val), _) => (
265 val.min_opt().map(|v| v.to_string()),
266 val.max_opt().map(|v| v.to_string()),
267 ),
268 (Statistics::Int64(val), _) => (
269 val.min_opt().map(|v| v.to_string()),
270 val.max_opt().map(|v| v.to_string()),
271 ),
272 (Statistics::Int96(val), _) => (
273 val.min_opt().map(|v| v.to_string()),
274 val.max_opt().map(|v| v.to_string()),
275 ),
276 (Statistics::Float(val), _) => (
277 val.min_opt().map(|v| v.to_string()),
278 val.max_opt().map(|v| v.to_string()),
279 ),
280 (Statistics::Double(val), _) => (
281 val.min_opt().map(|v| v.to_string()),
282 val.max_opt().map(|v| v.to_string()),
283 ),
284 (Statistics::ByteArray(val), ConvertedType::UTF8) => (
285 byte_array_to_string(val.min_opt()),
286 byte_array_to_string(val.max_opt()),
287 ),
288 (Statistics::ByteArray(val), _) => (
289 val.min_opt().map(|v| v.to_string()),
290 val.max_opt().map(|v| v.to_string()),
291 ),
292 (Statistics::FixedLenByteArray(val), ConvertedType::UTF8) => (
293 fixed_len_byte_array_to_string(val.min_opt()),
294 fixed_len_byte_array_to_string(val.max_opt()),
295 ),
296 (Statistics::FixedLenByteArray(val), _) => (
297 val.min_opt().map(|v| v.to_string()),
298 val.max_opt().map(|v| v.to_string()),
299 ),
300 }
301}
302
303/// Convert to a string if it has utf8 encoding, otherwise print bytes directly
304fn byte_array_to_string(val: Option<&ByteArray>) -> Option<String> {

Callers 1

call_with_argsMethod · 0.85

Calls 4

byte_array_to_stringFunction · 0.85
mapMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…