/// Read IOx statistics from parquet row group metadata.
Read IOx statistics from parquet row group metadata.
Read IOx statistics from parquet row group metadata .
fn read_statistics_from_parquet_row_group(
    row_group: &ParquetRowGroupMetaData,
    row_group_idx: usize,
    schema: &Schema,
) -> Result<Vec<ColumnSummary>> {
    let mut column_summaries = Vec::with_capacity(schema.len());
    for ((iox_type, field), column_chunk_metadata) in schema.iter().zip(row_group.columns()) {
        if let Some(iox_type) = iox_type {
            let parquet_stats =
                column_chunk_metadata
                    .statistics()
                    .context(StatisticsMissingSnafu {
                        row_group: row_group_idx,
                        column: field.name().clone(),
                    })?;
            let min_max_set = parquet_stats.has_min_max_set();
            if min_max_set && parquet_stats.is_min_max_deprecated() {
                StatisticsMinMaxDeprecatedSnafu {
                    row_group: row_group_idx,
                    column: field.name().clone(),
                }
                .fail()?;
            }
            let count = row_group.num_rows().max(0) as u64;
            let stats = extract_iox_statistics(
                parquet_stats,
                min_max_set,
                iox_type,
                count,
                row_group_idx,
                field.name(),
            )?;
            column_summaries.push(ColumnSummary {
                name: field.name().clone(),
                influxdb_type: Some(match iox_type {
                    InfluxColumnType::Tag => InfluxDbType::Tag,
                    InfluxColumnType::Field(_) => InfluxDbType::Field,
                    InfluxColumnType::Timestamp => InfluxDbType::Timestamp,
                }),
                stats,
            });
        } else {
            debug!(?field, "Provided schema of the field does not include IOx Column Type such as Tag, Field, Time");
        }
    }
    Ok(column_summaries)
}
fn read_statistics_from_parquet_row_group ( row_group : & ParquetRowGroupMetaData , row_group_idx : usize , schema : & Schema , ) -> Result < Vec < ColumnSummary > > { let mut column_summaries = Vec :: with_capacity ( schema . len ( ) ) ; for ( ( iox_type , field ) , column_chunk_metadata ) in schema . iter ( ) . zip ( row_group . columns ( ) ) { if let Some ( iox_type ) = iox_type { let parquet_stats = column_chunk_metadata . statistics ( ) . context ( StatisticsMissingSnafu { row_group : row_group_idx , column : field . name ( ) . clone ( ) , } ) ? ; let min_max_set = parquet_stats . has_min_max_set ( ) ; if min_max_set && parquet_stats . is_min_max_deprecated ( ) { StatisticsMinMaxDeprecatedSnafu { row_group : row_group_idx , column : field . name ( ) . clone ( ) , } . fail ( ) ? ; } let count = row_group . num_rows ( ) . max ( 0 ) as u64 ; let stats = extract_iox_statistics ( parquet_stats , min_max_set , iox_type , count , row_group_idx , field . name ( ) , ) ? ; column_summaries . push ( ColumnSummary { name : field . name ( ) . clone ( ) , influxdb_type : Some ( match iox_type { InfluxColumnType :: Tag => InfluxDbType :: Tag , InfluxColumnType :: Field ( _ ) => InfluxDbType :: Field , InfluxColumnType :: Timestamp => InfluxDbType :: Timestamp , } ) , stats , } ) ; } else { debug ! ( field " " ) ; } } Ok ( column_summaries ) }
Read IOx statistics from parquet row group metadata.
Read IOx statistics from parquet row group metadata .
row_group
&ParquetRowGroupMetaData
row_group_idx
usize
schema
&Schema