Fixed: - SQLX type mismatches (7) - UUID conversions (2) - Type annotations (1) - Hash digest API (1) - SQLX cache regenerated All services compile, tests running.
38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
//! Inspect Parquet file schema for debugging
|
|
|
|
use parquet::arrow::arrow_reader::ParquetRecordBatchReaderBuilder;
|
|
use std::fs::File;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let file_path = "/home/jgrusewski/Work/foxhunt/test_data/real/parquet/BTC-USD_30day_2024-09.parquet";
|
|
let file = File::open(file_path)?;
|
|
let builder = ParquetRecordBatchReaderBuilder::try_new(file)?;
|
|
let schema = builder.schema().clone();
|
|
|
|
println!("Parquet Schema:");
|
|
println!("================");
|
|
for (i, field) in schema.fields().iter().enumerate() {
|
|
println!("Column {}: {} -> {:?} (nullable: {})",
|
|
i,
|
|
field.name(),
|
|
field.data_type(),
|
|
field.is_nullable()
|
|
);
|
|
}
|
|
|
|
// Read first few rows to see data
|
|
let mut reader = builder.build()?;
|
|
if let Some(Ok(batch)) = reader.next() {
|
|
println!("\nFirst batch rows: {}", batch.num_rows());
|
|
println!("First batch columns: {}", batch.num_columns());
|
|
|
|
// Print first 3 rows
|
|
for col_idx in 0..batch.num_columns() {
|
|
println!("\nColumn {}: {}", col_idx, schema.field(col_idx).name());
|
|
println!("{:?}", batch.column(col_idx).slice(0, 3.min(batch.num_rows())));
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|