Move 17 library crates into crates/, CLI binary into bin/fxt, consolidate 10 test crates into testing/, split config crate from deployment config files. Root directory reduced from 38+ to ~17 directories. All Cargo.toml paths and build.rs proto refs updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.3 KiB
Rust
43 lines
1.3 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(())
|
|
}
|