/// 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,
    table_name: &str,
) -> Result<TableSummary> {
    let mut column_summaries = vec![];
    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(StatisticsMissing {
                    row_group: row_group_idx,
                    column: field.name().clone(),
                })?;
            if !parquet_stats.has_min_max_set() || parquet_stats.is_min_max_deprecated() {
                StatisticsMinMaxMissing {
                    row_group: row_group_idx,
                    column: field.name().clone(),
                }
                .fail()?;
            }
            let count =
                (row_group.num_rows().max(0) as u64).saturating_sub(parquet_stats.null_count());
            let stats = extract_iox_statistics(
                parquet_stats,
                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,
            });
        }
    }
    let table_summary = TableSummary {
        name: table_name.to_string(),
        columns: column_summaries,
    };
    Ok(table_summary)
}
fn read_statistics_from_parquet_row_group ( row_group : & ParquetRowGroupMetaData , row_group_idx : usize , schema : & Schema , table_name : & str , ) -> Result < TableSummary > { let mut column_summaries = vec ! [ ] ; 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 ( StatisticsMissing { row_group : row_group_idx , column : field . name ( ) . clone ( ) , } ) ? ; if ! parquet_stats . has_min_max_set ( ) || parquet_stats . is_min_max_deprecated ( ) { StatisticsMinMaxMissing { row_group : row_group_idx , column : field . name ( ) . clone ( ) , } . fail ( ) ? ; } let count = ( row_group . num_rows ( ) . max ( 0 ) as u64 ) . saturating_sub ( parquet_stats . null_count ( ) ) ; let stats = extract_iox_statistics ( parquet_stats , 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 , } ) ; } } let table_summary = TableSummary { name : table_name . to_string ( ) , columns : column_summaries , } ; Ok ( table_summary ) }
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
table_name
&str