convert-to-parquet
convert-to-parquet is a multi-format converter to Parquet written in Rust.
It converts CSV/TSV, JSON/JSONL/NDJSON and Excel spreadsheets (xlsx/xlsm/xlsb/xls/ods) to compressed Parquet files (ZSTD), with automatic schema inference and parallel processing.
It also supports reverse conversion: Parquet → CSV, Parquet → JSONL, Parquet → JSON (array of objects), and Parquet → XLSX (Excel workbook).
Key Features
- Automatic type inference: Boolean, Int64, UInt64, Float64, Date32, Timestamp(ms), LargeUtf8
- ZSTD compression (level 5) for optimized Parquet files
- Parallelism: reading in blocks of 100,000 rows, parallel conversion (rayon), ordered writing (crossbeam)
- Automatic detection of delimiter and header
- Glob patterns:
convert_to_parquet *.csv - stdin input:
cat data.csv | convert_to_parquet - - Compressed files:
.gz,.zstautomatically decompressed - Detailed validation report for each conversion
- Interactive mode: full-screen Parquet viewer (ratatui) with data preview and export to CSV / JSONL / JSON / XLSX
- GUI application: graphical interface (egui/eframe) with schema editing, preview, batch conversion
Supported Formats
| Input | Output |
|---|---|
| CSV, TSV, and other delimiters | Parquet (.parquet) |
| JSON, JSONL, NDJSON | Parquet |
| XLSX, XLSM, XLSB, XLS, ODS | Parquet (one sheet = one file) |
| Parquet | CSV |
| Parquet | JSONL |
| Parquet | JSON |
| Parquet | XLSX (Excel workbook) |
Installation
Prerequisites
- Rust (edition 2021)
- An internet connection to download dependencies
Building from Source
# Clone the repository
git clone https://github.com/gildas-le-drogoff/convert_to_parquet.git
cd convert_to_parquet
# Build in release mode
cargo build --release
The binary is located in target/release/convert_to_parquet.
System Installation
# Install the CLI + GUI binaries, man page, .desktop launcher, and icon
make install
Installs convert_to_parquet and convert_to_parquet_gui to $(BINDIR), the man page to $(MANDIR), the icon to $(ICONDIR), and a .desktop launcher to $(DESKTOPDIR).
By default, installation is in /usr/local. To change the prefix:
make install PREFIX=~/.local
Verification
# Display version
./target/release/convert_to_parquet --version
# Display help
./target/release/convert_to_parquet --help
# Generate man page
./target/release/convert_to_parquet --man | man -l -
Getting Started
Simple Conversion
convert_to_parquet file.csv
Produces file.parquet in the same directory.
Custom Output
convert_to_parquet data.csv -o archive/data.parquet
Batch Processing (glob)
convert_to_parquet *.csv
convert_to_parquet datasets/**/*.csv
Each file produces its own .parquet file.
Compressed File
convert_to_parquet logs.csv.gz
convert_to_parquet logs.csv.zst
Decompression is automatic. For other formats (.bz2, .xz), use standard input:
bzcat logs.csv.bz2 | convert_to_parquet -
Reverse Conversion
# Parquet → CSV
convert_to_parquet --to-csv data.parquet -o data.csv
# Parquet → JSONL
convert_to_parquet --to-jsonl data.parquet -o data.jsonl
Inspecting a Parquet File
convert_to_parquet --view-schema data.parquet
Opening a Parquet file in a terminal launches a full-screen viewer (ratatui) for data preview and on-the-fly export to CSV, JSONL, JSON, or XLSX.
Subcommands
The tool automatically detects the operation to perform based on the input file type and provided flags.
Conversion → Parquet (default mode)
convert_to_parquet [OPTIONS] <INPUT...>
Automatic input format detection:
| Extension | Format Processed |
|---|---|
.csv, .tsv | CSV/TSV (delimiter auto-detected) |
.json, .jsonl, .ndjson | JSON / JSONL / NDJSON |
.xlsx, .xlsm, .xlsb, .xls, .ods | Excel / LibreOffice Spreadsheet |
.parquet | Interactive schema inspection |
.gz, .zst | Automatic decompression then conversion |
Reverse Conversion: Parquet → CSV
convert_to_parquet --to-csv <FILE.parquet> -o <OUTPUT.csv>
Reverse Conversion: Parquet → JSONL
convert_to_parquet --to-jsonl <FILE.parquet> -o <OUTPUT.jsonl>
Reverse Conversion: Parquet → JSON
convert_to_parquet --to-json <FILE.parquet> -o <OUTPUT.json>
Produces a JSON array of objects from the Parquet file. Null fields are omitted.
Reverse Conversion: Parquet → XLSX
convert_to_parquet --to-xlsx <FILE.parquet> -o <OUTPUT.xlsx>
Writes the Parquet data into an Excel workbook (XLSX). Each Parquet file becomes a single sheet in the workbook.
Preview Mode: JSON/JSONL
convert_to_parquet --preview <FILE.json>
Prints a tabular preview to stdout without writing a Parquet file. Nested JSON is shown flattened (see --flatten-separator, --flatten-max-level).
Schema Inspection
convert_to_parquet --view-schema <FILE.parquet>
Displays Parquet file metadata (compressed/decompressed size per column, null count).
Interactive Mode
When a Parquet file is passed without an export flag and the terminal is interactive, a full-screen viewer (ratatui) opens:
- Data preview with navigation through rows and columns
- On-the-fly export to CSV, JSONL, JSON, or XLSX
When the output is redirected (non-interactive), it falls back to printing the schema and statistics instead.
Generating the Man Page
convert_to_parquet --man > convert_to_parquet.1
General Options
| Option | Description |
|---|---|
-o, --output <OUTPUT> | Output file or directory. Treated as directory for multiple inputs |
-d, --delimiter <DELIM> | Force delimiter (; , \t |). Overrides automatic detection |
--force-header | Treat the first line as column headers, skipping header auto-detection |
--no-header | Treat the first line as data (no header row), skipping auto-detection |
--overwrite | Overwrite an existing output file instead of adding a timestamp suffix |
--null-values <LIST> | Comma-separated extra tokens treated as NULL in text columns (e.g. NA,ND) |
--timezone <TZ> | Timezone for timestamps, e.g. UTC, +02:00 (default: +00:00) |
--flatten | Flatten nested JSON into dot-separated columns instead of Arrow Struct/List |
--flatten-separator <SEP> | Column-name separator for --flatten (default: .) |
--flatten-max-level <N> | Max nesting depth for --flatten; deeper values are serialized as JSON strings |
--preview | Preview tabular data for a JSON/JSONL file (flattened nested view) without converting |
--to-csv | Reverse conversion: Parquet → CSV |
--to-jsonl | Reverse conversion: Parquet → JSONL |
--to-json | Reverse conversion: Parquet → JSON (array of objects) |
--to-xlsx | Reverse conversion: Parquet → XLSX (Excel workbook) |
--full-schema-inference | Analyze entire file for type inference (instead of first 10,000 rows) |
--force-utf8 | Force all columns to LargeUtf8 (disables inference, preserves raw data) |
--view-schema | Display logical and physical schema of a Parquet file |
--sheet-concurrency <N> | Number of Excel sheets processed in parallel (default: ncpu/2) |
--diagnose | Log per-phase timing and RSS to stderr (also via CONVERT_TO_PARQUET_DIAG) |
--man | Generate man page in roff format |
Details
--output
- With a single input file: output file path
- With multiple files (glob): treated as a directory
- If path ends with
/: always treated as a directory
--delimiter
Accepted values: , ; \t | or any character. Useful for files without standard extensions.
--force-utf8
Useful for heterogeneous data where type inference would produce unexpected mixing. No semantic loss, but larger files.
--force-header
Forces the first line to be treated as column headers, bypassing the header auto-detection heuristic. Useful when the heuristic misclassifies a header row as data (or vice versa).
--full-schema-inference
By default, only the first 10,000 rows are analyzed for schema inference. This option analyzes the entire file. Slower, but more accurate for files where types vary beyond the first rows.
--no-header
Forces the first line to be treated as data, bypassing the header auto-detection heuristic. Mutually exclusive with --force-header.
--null-values
Extra tokens (comma-separated, case-insensitive) treated as NULL in text columns, on top of the always-null null sentinel, e.g. --null-values NA,ND,NR.
--timezone
Sets the timezone applied when parsing textual timestamps (e.g. UTC, +02:00). Defaults to +00:00.
--flatten, --flatten-separator, --flatten-max-level
By default, nested JSON is preserved as Arrow Struct/List columns (see Input Converters). --flatten instead flattens nested objects into dot-separated columns (e.g. address.city), using --flatten-separator as the joiner and --flatten-max-level to cap nesting depth (deeper values are serialized as JSON strings). Only affects JSON input.
--preview
Prints a tabular preview of a JSON/JSONL file (flattened view for nested data) to stdout without producing a Parquet file. Requires exactly one JSON input.
--overwrite
By default, an existing output file is preserved and a timestamp suffix is appended to the new one. This flag overwrites the existing file instead.
--diagnose
Logs per-phase timing and memory (RSS) to stderr for each conversion phase. Can also be enabled via the CONVERT_TO_PARQUET_DIAG environment variable.
Supported Input Formats
CSV / TSV
Delimiters automatically detected: , ; \t |.
Detection is performed by counting occurrences of each potential delimiter on the first 20 lines. The most frequent and consistent delimiter is selected.
Header is detected via heuristics: comparing the profile of the first line (inferred types) with the rest of the data. If no header is found, columns are named col_0, col_1, etc.
JSON / JSONL / NDJSON
Supported formats:
- Array of objects:
[{...}, {...}] - Single object:
{...} - One object per line (JSONL / NDJSON):
{...}\n{...}\n
Flat JSON is first converted to intermediate CSV (keys become headers), then the standard pipeline converts it to Parquet.
When nested objects or arrays are detected, a native Arrow path is used instead, preserving the structure as Struct/List columns rather than flattening it to strings.
Excel / LibreOffice Spreadsheets
Supported formats:
| Extension | Format |
|---|---|
.xlsx | Excel 2007+ (cell-by-cell streaming) |
.xlsm | Excel with macros |
.xlsb | Binary Excel (streaming) |
.xls | Excel 97-2003 |
.ods | OpenDocument Spreadsheet |
Each sheet produces a distinct Parquet file: <file>__<sheet>.parquet.
Parallel sheet processing is configurable with --sheet-concurrency.
Compressed Files
The extensions .gz (gzip) and .zst (Zstandard) are automatically decompressed to a temporary file before conversion.
For unsupported formats (.bz2, .xz), use standard input:
bzcat data.csv.bz2 | convert_to_parquet -
Pipeline Overview
The conversion pipeline is the heart of the project. It transforms tabular data into a Parquet file efficiently and in parallel.
General Schema
Source File
│
├─ Delimiter detection (first 20 lines)
├─ Header detection (heuristics)
├─ Schema inference (sample of 10,000 rows)
│
├─ Reading in memory-adaptive blocks (10k-100k rows) ┐
│ │
│ ┌─ Block 0 ─► Parallel analysis (rayon) ──┐ │
│ ├─ Block 1 ─► Parallel analysis (rayon) ──┤ │
│ ├─ Block 2 ─► Parallel analysis (rayon) ──┤ │
│ └─ Block N ─► Parallel analysis (rayon) ──┘ │
│ │ │
│ crossbeam channel (ordered by index) │
│ │ │
│ Ordered Parquet writing │
│ (ZSTD level 5) │
│ │
└─────────────────────────────────────────────────┘
│
└─ Validation report (stderr)
Detailed Steps
1. Input Format Resolution
The file is inspected to determine:
- The delimiter (unless forced with
-d) - Presence of a header
- File type (CSV, JSON, XLSX, Parquet…)
2. Schema Inference
A sample of 10,000 rows is analyzed to determine the type of each column. See Type Inference.
3. Parallel Pipeline
The file is read in blocks sized by memory::adaptive_block_size (10,000-100,000 rows, based on available memory and column count — see Parallel Processing). Each block is sent through a crossbeam channel (block_sender) to a pool of rayon workers that:
- Convert each value according to the inferred type
- Build an Arrow
RecordBatch - Gather metrics (valid values, nulls, errors)
RecordBatch objects are returned via a second channel (batch_sender) with their original index.
4. Ordered Writing
The Parquet writing thread receives batches out of order (parallelism does not guarantee order). It reorders them using an internal BTreeMap before writing, ensuring that the row order from the source file is preserved.
5. Validation Report
Once conversion is complete, a detailed report is displayed on stderr:
========== VALIDATION REPORT ==========
CSV rows 1000000
Parquet rows 1000000
Parse errors 0
========== COLUMNS ==========
name type null % err % valid % conf
--------------------------------------------------------------------------------------
id Int64 0.00 0.00 100.00 100.00
Progress Ticker
A ticker thread runs in the background and updates the progress bar in real-time (MB/s) based on bytes read.
Diagnostics
With --diagnose (or CONVERT_TO_PARQUET_DIAG), each phase (csv_resolve_input_format, csv_resolve_schema, csv_run_pipeline, csv_count_parquet_lines, …) logs its duration and notes like csv_block_size, csv_analysis_threads, and memory_budget_bytes to stderr via src/diag.rs.
Type Inference
Type inference is a critical phase: it determines the Parquet schema that will be used for all data.
Method
Analysis is performed on a sample of 10,000 rows (except with --full-schema-inference). For each column, a TypeState accumulates observations:
#![allow(unused)]
fn main() {
struct TypeState {
can_bool: bool,
can_date: bool,
can_timestamp: bool,
can_int: bool,
can_uint: bool,
can_float: bool,
min_value: i128,
max_value: i128,
// timestamp format counters
ts_seconds: u64,
ts_millis: u64,
ts_micros: u64,
ts_nanos: u64,
ts_textual: u64,
total_values: u64,
}
}
Each non-null value disables incompatible types. For example, a value containing a . disables can_bool, can_int, and can_uint.
Inferred Types
| Parquet Type | Detection Conditions |
|---|---|
Boolean | true/false, yes/no, y/n, on/off, t/f, 0/1 |
Int64 | Signed integers within i64 range |
UInt64 | Positive integers exceeding i64 but within u64 range |
Float64 | Numbers containing ., e or E |
Date32 | Formats YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY |
Timestamp(ms) | RFC3339, YYYY-MM-DD HH:MM:SS, variants with fractions and timezone |
LargeUtf8 | Anything that doesn’t match above |
Type Precedence
Types are tested in this order. The first type still possible at the end of sampling is selected:
BooleanInt64/UInt64Float64Date32Timestamp(ms)LargeUtf8(fallback)
Timestamps have a confidence threshold of 80%: if less than 80% of non-null values in a column are valid timestamps, the type is downgraded to LargeUtf8.
Null Values
These values are treated as null regardless of column:
null, NULL, None, NaN, N/A, na, nd, nr, -, -- and empty strings.
Additional case-insensitive tokens can be added per-run with --null-values (e.g. --null-values NA,ND,NR); null is always treated as null.
Ambiguous Dates
For DD/MM/YYYY vs MM/DD/YYYY formats: both are tested, first successful parse wins. If both are valid, DD/MM/YYYY is retained.
--force-utf8 Mode
When this flag is enabled, inference is disabled and all columns are forced to LargeUtf8. Raw data is preserved without any conversion.
Full Inference (--full-schema-inference)
By default, only 10,000 rows are sampled. This flag analyzes the entire file, which is slower but more robust for files whose structure varies beyond the first rows.
Time Precision
The time unit is automatically detected:
- Seconds: Unix timestamps < 10^10
- Milliseconds: timestamps between 10^10 and 10^13
- Microseconds: timestamps between 10^13 and 10^16
- Nanoseconds: timestamps > 10^16
Textual values are parsed with chrono and converted to milliseconds.
Timestamps default to UTC (+00:00); override with --timezone (e.g. --timezone +02:00).
Parallel Processing
The project uses two complementary parallelism libraries: rayon and crossbeam.
Parallel Pipeline Architecture
┌──────────────────────────┐
│ Sequential reading │
│ (adaptive blocks, 10k- │
│ 100k rows) │
└──────────┬────────────────┘
│
┌──────────▼────────────┐
│ block_sender │
│ (crossbeam, capacity │
│ 8 blocks) │
└──────────┬────────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌──────▼──────┐ ┌────▼─────┐ ┌──────▼───┐
│ Worker 0 │ │ Worker 1 │ │ Worker N │
│ (rayon) │ │ (rayon) │ │ (rayon) │
└──────┬──────┘ └────┬─────┘ └──────┬───┘
│ │ │
└──────────────┼──────────────┘
│
┌──────────▼─────────────┐
│ batch_sender │
│ (crossbeam, capacity │
│ 8 batches) │
└──────────┬─────────────┘
│
┌──────────▼────────────┐
│ Ordered writing │
│ (BTreeMap + Parquet) │
└───────────────────────┘
Rayon: Data Parallelism
Rayon converts each CSV block to an Arrow RecordBatch in parallel via par_bridge():
#![allow(unused)]
fn main() {
block_receiver
.into_iter()
.par_bridge()
.try_for_each(|block| {
let result = analyze_block(&block.records, schema.clone(), force_utf8)?;
batch_sender.send((block.index, result.batch, block.bytes_read))?;
Ok(())
})
}
Each block is processed independently on a rayon thread pool, allowing efficient use of all CPU cores.
Memory-Bounded Sizing (src/memory.rs)
Block size and worker thread count are no longer fixed: both are derived from available system memory.
memory::memory_budget()— 90% of currently available RAM (via/proc/meminfoon Linux,vm_stat/sysctlon macOS,GlobalMemoryStatusExon Windows), minus a 64 MB safety marginmemory::adaptive_block_size(ncols)— targets 10% of the memory budget per block, clamped to 10,000-100,000 rowsmemory::max_threads_for_memory(ncols, block_size)— caps the analysis thread pool so thatthreads × block_size × columnsstays within budget, further capped bynum_cpusmemory::max_concurrent_jobs()— used by the GUI to cap how many files convert concurrently (budget / 512 MB per job)
This keeps memory usage bounded on both small (e.g. containers, CI) and large machines, instead of a one-size-fits-all block size. The CSV pipeline, the native JSON pipeline (conversion/json_pipeline.rs), and the GUI worker all consult these functions. Values are logged via src/diag.rs when --diagnose is set.
Crossbeam: Bounded Channels
Crossbeam provides inter-thread communication channels with bounded capacity:
block_sender(capacity: 8 blocks) — from reader to workersbatch_sender(capacity: 8 batches) — from workers to writer
The advantage of bounded channels is backpressure: if workers are too slow, reading slows down; if the writer is too slow, workers slow down. The system naturally balances itself.
Strict Ordering
Blocks are numbered sequentially (block.index). Since parallelism does not preserve order, each RecordBatch is sent with its original index.
The writing thread maintains a BTreeMap that reorders batches:
#![allow(unused)]
fn main() {
let mut pending: BTreeMap<usize, (RecordBatch, u64)> = BTreeMap::new();
let mut next_index = 0;
// On each reception:
pending.insert(index, (batch, bytes));
// Write all ready batches in order
while let Some((batch, bytes)) = pending.remove(&next_index) {
writer.write(&batch)?;
next_index += 1;
}
}
This ensures that the row order from the source file is strictly preserved in the final Parquet file.
Progress Ticker
A dedicated thread (ticker) updates the progress bar in real-time:
- Display in MB/s (megabytes per second)
- 2-second smoothing window
- Clean shutdown via
AtomicBool - Cleaned up even on error (thanks to
TickerStopGuard)
Excel Sheet Concurrency
For multi-sheet workbooks, each sheet is processed in a separate rayon pool, configurable with --sheet-concurrency. Default: ncpu / 2 threads.
Sheets are independent: each produces its own Parquet file.
Input Converters
Before entering the main pipeline (CSV → Parquet conversion), non-CSV formats are first converted to intermediate CSV.
JSON Converter
Module: src/json.rs
Supported Formats
- Array of objects:
[{"col": "val"}, {"col": "val2"}] - Single object:
{"col": "val"} - JSONL / NDJSON:
{"col": "val"}\n{"col": "val2"}
Operation
- File is parsed with
serde_json - For JSONL, a first pass scans the first 100 lines to collect all keys (headers)
- Data is exported to temporary CSV with
csv_writer - This temporary CSV is passed to the standard pipeline
Handling Missing Values
Missing keys in an object are written as empty strings (which will be treated as nulls by the pipeline).
Excel / LibreOffice Converter
Module: src/xlsx.rs
Library: calamine
Calamine allows reading spreadsheets without depending on Excel or LibreOffice:
| Format | Support |
|---|---|
.xlsx | Cell-by-cell streaming (low memory footprint) |
.xlsm | Cell-by-cell streaming |
.xlsb | Cell-by-cell streaming |
.xls | Full reading |
.ods | Full reading |
Operation
- List sheets: workbook is opened to list sheet names
- Export by sheet: each sheet is exported to temporary CSV
- Parallelism: sheets are processed in parallel (configurable rayon pool)
- Name sanitization: sheet names are sanitized for filesystems
Output
Each sheet produces a Parquet file named <file>__<sheet>.parquet.
Reverse Converter: Parquet → CSV
Module: src/to_csv.rs
Uses the Arrow API to read the Parquet file and write CSV with csv_writer.
Reverse Converter: Parquet → JSONL
Module: src/to_jsonl.rs
- One JSON object per line
- Null fields are omitted
- Uses Arrow formatters for type fidelity
Reverse Converter: Parquet → JSON
Module: src/to_json.rs
- Produces a single JSON array containing one object per row
- Null fields are omitted
- Uses Arrow JSON writer for accurate type representation
- Suitable for feeding into JSON-based tools and APIs
Reverse Converter: Parquet → XLSX
Module: src/to_xlsx.rs
- Writes Parquet data into an Excel workbook (
.xlsx) - Each Parquet file creates a single worksheet
- Column headers use Parquet column names
- Uses the
rust_xlsxwriterlibrary for robust XLSX generation
Native Arrow Path: JSON with Nested Structure
Modules: src/json_arrow.rs (schema inference + public entry point), src/conversion/json_pipeline.rs (parallel block engine)
When JSON data contains nested objects or arrays, the standard CSV-intermediate approach would flatten them into strings, losing structure. The native Arrow path handles this:
- JSON is parsed with
serde_jsoninto aserde_json::Valuetree - The tree is analyzed to infer an Arrow schema with
StructandListtypes - Nested objects become Arrow
StructArraycolumns - Nested arrays become Arrow
ListArraycolumns json_arrow::convert_json_to_parquetdelegates the actual conversion toconversion::convert_json_nested_parallel(json_pipeline.rs), which reads the records in memory-adaptive blocks and converts each block to aRecordBatchon a rayon pool sized bymemory::max_threads_for_memory— the same block/thread/ordering model as the CSV pipeline (see Parallel Processing)
This preserves the full JSON structure in the Parquet file, enabling downstream consumers (e.g. DuckDB, Spark, Pandas) to navigate nested fields natively.
Additional JSON modules:
src/json_leaf_infer.rs— Promotes leaf types (e.g. string → numeric) during JSON inference for better schema accuracysrc/json_normalize.rs— Flattens nested JSON objects into dot-notation columns (e.g.address.city,address.zip), used by the CLI’s--flattenflag as an alternative to the native Struct/List path
JSON diagnostics
src/diag.rs provides lightweight phase-timing/RSS instrumentation (diag::phase, diag::note) used throughout both the CSV and JSON pipelines; enable it with --diagnose or CONVERT_TO_PARQUET_DIAG.
Handling Compressed Files
Module: src/utils.rs
Extensions .gz and .zst are automatically detected. The file is decompressed to a temporary file (deleted at the end of execution thanks to NamedTempFile from tempfile).
For other formats (.bz2, .xz), the user must decompress via stdin:
bzcat data.csv.bz2 | convert_to_parquet -
GUI Application
The project includes a native desktop GUI built with egui/eframe, an immediate-mode GUI framework for Rust.
Launch
cargo run --bin convert_to_parquet_gui
The gui Cargo feature (enabling eframe, rfd, egui_extras) is a default feature, so a plain build/run enables it; on a build with --no-default-features, pass --features gui explicitly. The binary is declared in Cargo.toml as convert_to_parquet_gui, with its entry point at src/bin/gui_convert.rs; the GUI modules live under src/gui/.
Features
| Feature | Description |
|---|---|
| File drag-and-drop | Drag input files onto the window, or use the file/folder picker (rfd) |
| Schema editing | Inspect and modify inferred column types/names before conversion |
| Column renaming (Parquet) | For Parquet inputs, rename columns in place via parquet_rewrite::rename_parquet_columns |
| Data preview | View a sample of the data before committing to conversion |
| JSON flatten options | Toggle --flatten / separator / max-level per file, same as the CLI |
| Batch conversion | Queue multiple files and convert them in one operation, capped by memory-aware concurrency (memory::max_concurrent_jobs) |
| Overwrite guards | Warns when an output file already exists; lets you confirm |
| Export format selection | Choose output format(s): Parquet, CSV, JSONL, JSON, and/or XLSX (multiple at once) |
Architecture
The GUI follows a model-view separation pattern:
┌────────────────────────────────────────────────────────────┐
│ convert_to_parquet_gui │
│ src/bin/gui_convert.rs (entry point → gui::run()) │
├────────────────────────────────────────────────────────────┤
│ src/gui/ │
│ ├── mod.rs ── Module wiring │
│ ├── app.rs ── ConverterApp state, egui App impl │
│ ├── model.rs ── UI state types (FileOptions, │
│ │ OutputSelection, EditableField, ...) │
│ ├── worker.rs ── Background analysis/conversion │
│ │ threads (mpsc channel) │
│ ├── analysis.rs ── Input format detection │
│ ├── paths.rs ── Output path resolution │
│ ├── theme.rs ── egui theme setup │
│ └── view/ │
│ ├── mod.rs ── Menu bar, sidebar, outputs panel, │
│ │ overwrite modal │
│ ├── detail.rs ── Per-file detail tabs (data/schema/ │
│ │ options/validation/parquet stats) │
│ └── preview.rs ── Data preview tab rendering │
└────────────────────────────────────────────────────────────┘
Model-View Separation
- Model (
model.rs): data structures holding UI state — loaded files (FileEntry), per-file options (FileOptions, column edits), requested outputs (OutputSelection), job state (JobState). - View (
view/): panels render the model and pushUiActions back toapp.rs, which mutates state and forwards work toworker.rs.
Background Worker Threads
Long-running analysis and conversions run on background worker threads (src/gui/worker.rs) to keep the UI responsive:
- Each queued file is analyzed (
spawn_analysis) and, once started, converted (spawn_conversion) on its ownstd::thread::spawnthread. - Concurrency is capped at
memory::max_concurrent_jobs()(memory-budget-aware); queued jobs beyond the cap wait inJobState::Queueduntil a slot frees up. - Workers send
WorkerMsg(Analyzed,Progress,ProgressBytes,Done,Failed) back to the UI thread through anmpscchannel. - The UI polls the channel each frame and updates per-file progress and results.
This design prevents the UI from freezing during large file conversions and bounds total memory use across concurrent jobs.
Usage Walkthrough
- Launch the application with
cargo run --bin convert_to_parquet_gui - Add files by dragging them onto the window or using the file picker
- Review schema for each file — adjust column types if needed
- Select output format from the drop-down (Parquet, CSV, JSONL, JSON, XLSX)
- Set output directory and confirm overwrite behaviour
- Click Convert — progress bars show per-file status
- View results in the results panel after completion
Key Source Files
| File | Purpose |
|---|---|
src/bin/gui_convert.rs | Entry point for the convert_to_parquet_gui binary |
src/gui/app.rs | ConverterApp state, egui App trait implementation, job scheduling |
src/gui/model.rs | UI state types: FileOptions, OutputSelection, EditableField, JobState, DetailTab |
src/gui/worker.rs | Background analysis/conversion threads, WorkerMsg channel |
src/gui/analysis.rs | Input format detection for a dropped/picked file |
src/gui/paths.rs | Output path resolution (per-file and per-sheet) |
src/gui/theme.rs | egui visual theme setup |
src/gui/view/mod.rs | Menu bar, sidebar, output-format panel, overwrite confirmation modal |
src/gui/view/detail.rs | Per-file detail tabs: data preview, schema editor, options, validation, Parquet stats |
src/gui/view/preview.rs | Tabular data preview rendering |
Contributing
Contributions are welcome! Here’s how to participate in the project.
Prerequisites
- Rust (edition 2021)
- Make (for build targets)
Workflow
# 1. Fork the repository
# 2. Clone your fork
git clone https://github.com/<your-username>/convert_to_parquet.git
cd convert_to_parquet
# 3. Create a branch
git checkout -b my-feature
# 4. Code!
# 5. Test
make test
# 6. Format
make fmt
# 7. Lint
make lint
# 8. Commit and push
git push origin my-feature
# 9. Open a Pull Request
Code Structure
src/
├── main.rs # CLI entry point (clap, format dispatch)
├── bin/
│ └── gui_convert.rs # Entry point for the convert_to_parquet_gui binary
├── lib.rs # Module declarations
├── conversion/
│ ├── mod.rs # Main pipeline (orchestration, ConvertOptions)
│ ├── csv_blocks.rs # CSV reading in blocks
│ ├── parquet_writer.rs# Ordered Parquet writing
│ ├── pipeline.rs # Parallel analysis workers
│ ├── json_pipeline.rs # Parallel block engine for native nested-JSON conversion
│ ├── ticker.rs # MB/s progress bar
│ └── counting.rs # Parquet row counting
├── analysis/
│ ├── mod.rs # Block analysis
│ ├── builders.rs # RecordBatch construction
│ ├── conversions.rs # Value → Arrow type conversion
│ └── types.rs # Metrics and error counters
├── schema.rs # Type inference (sampling)
├── utils.rs # Delimiter/header detection, dates, nulls
├── inspect.rs # Parquet metadata display
├── json.rs # JSON → intermediate CSV converter
├── json_arrow.rs # Native Arrow path for nested JSON (entry point)
├── json_leaf_infer.rs # Leaf type promotion in JSON inference
├── json_normalize.rs # JSON flatten to dot-notation columns (--flatten)
├── xlsx.rs # Excel → intermediate CSV converter
├── to_csv.rs # Parquet → CSV converter
├── to_jsonl.rs # Parquet → JSONL converter
├── to_json.rs # Parquet → JSON (array of objects)
├── to_xlsx.rs # Parquet → XLSX (Excel workbook)
├── export.rs # Unified export dispatch
├── preview.rs # Headless data preview (non-interactive)
├── tui.rs # Interactive full-screen viewer (ratatui)
├── parquet_rewrite.rs # Column renaming for Parquet files
├── data_generator.rs # Test data generator binary
├── memory.rs # System memory detection, adaptive block/thread sizing
├── diag.rs # Per-phase timing/RSS diagnostics (--diagnose)
└── gui/ # egui/eframe GUI application
├── mod.rs # Module wiring, run()
├── app.rs # ConverterApp state, egui App trait impl
├── model.rs # File/schema/output UI state (FileOptions, OutputSelection, ...)
├── worker.rs # Background analysis/conversion threads (mpsc channel)
├── analysis.rs # Input format detection for the GUI
├── paths.rs # Output path resolution
├── theme.rs # egui theme setup
└── view/
├── mod.rs # Menu bar, sidebar, outputs panel, modals
├── detail.rs # Per-file detail tabs (data/schema/options/validation/parquet stats)
└── preview.rs # Data preview tab rendering
Conventions
Code
- Formatting:
cargo fmt(standard rustfmt) - Linting:
cargo clippy -- -D warnings - No warnings: code must compile without warnings
- Tests: any new feature must include tests
Commits
- Commit messages in English
- Prefixes:
feat:,fix:,refactor:,docs:,test:,chore: - One line ≤ 72 characters for title
Documentation
Public modules must have a documentation comment (/// or //!). Public functions should document parameters and return value when behavior is not obvious.
API Reference
The complete Rust API documentation (generated by rustdoc) is available here:
- API Documentation (link to be adapted based on hosting)
Generate Documentation Locally
cargo doc --open
Main Modules
| Module | Description |
|---|---|
conversion | Conversion pipeline: orchestration, reading, writing |
analysis | Block analysis, RecordBatch construction, metrics |
schema | Type inference via sampling |
utils | Delimiter/header detection, date parsing |
inspect | Parquet metadata inspection |
json | JSON → intermediate CSV conversion |
xlsx | Spreadsheet → intermediate CSV conversion |
to_csv | Reverse Parquet → CSV conversion |
to_jsonl | Reverse Parquet → JSONL conversion |
Tests
Running Tests
# All tests
cargo test
# With output display
cargo test -- --nocapture
# Specific test
cargo test test_name
# Integration tests only
cargo test --test integration
Test Structure
The project has 20 integration test files in tests/, plus inline unit tests in several src/ modules.
Unit Tests (inline #[cfg(test)] mod tests in src/)
json.rs,json_arrow.rs,json_leaf_infer.rs,json_normalize.rs— JSON parsing, nested-type inference, flatteningxlsx.rs,to_xlsx.rs— spreadsheet reading and XLSX writingmemory.rs—/proc/meminfoparsing, adaptive block/thread sizing (Linux only)diag.rs— phase-timing/RSS instrumentationconversion/json_pipeline.rs— parallel nested-JSON block engine
Integration Tests (tests/)
schema_tests.rs,schema_threshold_tests.rs,schema_override_tests.rs— type inference, timestamp confidence threshold, forced column typesconversions_tests.rs— value → Arrow conversiondelimiter_tests.rs— delimiter auto-detectionanalysis_tests.rs,error_analysis_tests.rs— block analysis, error countersheuristic_robustness_tests.rs,noise_robustness_tests.rs— header/type heuristics under noisy datastrict_order_tests.rs— strict block ordering under parallel conversionintegration_pipeline_tests.rs— end-to-end CSV → Parquet pipelinenormalized_tests.rs— large scenario suite (also covers.gz/.zstauto-decompression)utils_tests.rs— utilities (delimiter/header/date helpers)xlsx_e2e.rs— Excel → Parquet round-tripexport_formats_tests.rs— JSON-array and multi-sheet-XLSX round-trips (forward and reverse)inverse_and_inspect_tests.rs— Parquet → CSV/JSONL and schema/stats inspectionparquet_to_csv_robust_tests.rs— Parquet → CSV robustnessnested_json_tests.rs— native nested-JSON Arrow path and--flatten(separator, max-level, mixed depth)parquet_rewrite_tests.rs— Parquet column renaming (GUI’s column-rename feature)preview_tests.rs— headless data preview (--preview, viewer)
Fixture Generation
The src/data_generator.rs binary generates test data in CSV, TSV, JSON, and JSONL formats:
cargo run --bin data_generator
Produces datasets in datasets_tests/ with various noise strategies, typed columns, and edge-case scenarios.
Python Test
A Python script allows validating Parquet output:
python3 test_convert_to_parquet.py
Requirements: pyarrow (pip install pyarrow).
Makefile
make test # cargo test
make check # cargo check (quick verification)
make lint # cargo clippy -- -D warnings
make fmt # cargo fmt
Changelog
[0.4.1] - 2026-07-24
✨ New Features
GUI Application
- Desktop GUI (
cargo run --bin convert_to_parquet_gui): egui/eframe app with drag-and-drop, schema/column editing, multi-format output selection (Parquet/CSV/JSONL/JSON/XLSX), Parquet column renaming, and memory-bounded concurrent batch conversion. See GUI Application.
CLI Options
--no-header,--overwrite,--diagnose--null-values <LIST>: extra NULL sentinels--timezone <TZ>: timestamp timezone override--flatten,--flatten-separator,--flatten-max-level: flatten nested JSON to dot-notation columns instead of Arrow Struct/List--preview: headless tabular preview of a JSON/JSONL file
🔧 Technical Improvements
- Memory-adaptive pipeline (
src/memory.rs): block size (10k-100k rows) and worker thread count now scale with available RAM instead of fixed constants, shared by the CSV pipeline, the native nested-JSON pipeline, and the GUI’s job concurrency - Native nested-JSON pipeline (
src/conversion/json_pipeline.rs): parallel block engine backingjson_arrow::convert_json_to_parquet, mirroring the CSV pipeline’s ordering/threading model - Diagnostics (
src/diag.rs,--diagnose/CONVERT_TO_PARQUET_DIAG): per-phase timing and memory notes on stderr - Parquet column renaming (
src/parquet_rewrite.rs): rewrite column names in an existing Parquet file src/csv_generator.rsreplaced bysrc/data_generator.rs(CSV, TSV, JSON, JSONL fixtures)
🧪 Tests
tests/parquet_rewrite_tests.rs,tests/preview_tests.rs,tests/schema_override_tests.rstests/nested_json_tests.rsextended with--flattencoverage (separator, max-level, mixed depth)
[0.4.0] - 2026-06-19
✨ New Features
Interactive Viewer (TUI)
- Parquet Interactive Mode: opening a
.parquetfile in a terminal launches a full-screen viewer (ratatui)- Data preview, navigation, and on-the-fly export to CSV / JSONL / JSON / XLSX
- Automatic fallback to schema + statistics display when output is redirected
New Export Formats (Parquet → …)
- Parquet → JSON: export as a JSON array (
src/to_json.rs) - Parquet → XLSX: export as an Excel workbook (
src/to_xlsx.rs) - Unified export module
src/export.rs
Nested JSON Objects
- Nested JSON: support for nested objects/arrays via Arrow (
src/json_arrow.rs)
🔧 Technical Improvements
- Exposed a reusable library (
src/lib.rs) consumed by integration tests rust_xlsxwriterpromoted to a runtime dependency (XLSX export), addedratatui- Regenerated man page (
convert_to_parquet.1): up-to-date version and synopsis
🧪 Tests
tests/export_formats_tests.rs: CSV/JSONL/JSON/XLSX exporttests/nested_json_tests.rs: nested JSON objectstests/noise_robustness_tests.rs: robustness against noisy data
[0.3.0] - 2026-06-14
✨ New Features
Support for New Input Formats
- JSON / JSONL: automatic conversion of
.json,.jsonl,.ndjsonfiles to Parquet- Support for arrays of objects, single object, or one object per line
- Header extraction via two-pass scan for JSONL
- Excel Files: support for
.xlsx,.xlsm,.xlsb,.xls,.ods- Cell-by-cell streaming for xlsx/xlsb (low memory footprint)
- Parallel sheet processing (configurable with
--sheet-concurrency) - One sheet = one Parquet file:
<filename>__<sheetname>.parquet
- Compressed Files: support for
.gzand.zstinput (automatic decompression to temporary file)
Reverse Conversion (Parquet → Other Formats)
- Parquet → CSV: new
--to-csvoption - Parquet → JSONL: new
--to-jsonloption- One JSON object per line, null fields omitted
- Using Arrow formatters for type fidelity
Enhanced CLI Interface
- Glob Expansion:
convert_to_parquet *.csvprocesses all matching files - Forced Delimiter:
--delimiter(supports,;\t|) - Flexible Output:
-ocan be a file or folder (automatic detection) - Parquet Interactive Mode: if interactive terminal, displays schema + statistics then offers CSV/JSONL export
- Man Page Generation:
--manunchanged
Parquet File Inspection
- New
--view-schemacommand (already existing, but improved) - Display column statistics: compressed/decompressed sizes, null count
🔧 Technical Improvements
Temporal Precision
- Timestamp: preservation of sub-millisecond precision (microseconds, nanoseconds)
- Direct conversion to target unit without loss (Second, Millisecond, Microsecond, Nanosecond)
- Smarter unit detection (textual or numeric, with plausibility window)
CSV Reading Reliability
- Multi-line Field Handling: quotes are correctly interpreted
- Blocks sent with their byte position (reliable progress bar)
- Block reordering in Parquet writing (even in parallel)
Metrics and Progress
- Progress bar based on MB/s (replaces “rows/s”)
- Ticker thread cleanup (prevents zombie processes)
- Conversion metrics: valid values, explicit nulls, conversion errors, error samples
Schema Inference
- Confidence threshold for timestamps: 80% (configurable)
- Improved type detection (bool, date, timestamp, int, uint, float)
- Sampling limited to 10,000 rows (except
--full-schema-inference)
📁 Structural Changes
New Modules
src/json.rs: JSON → temporary CSV conversionsrc/xlsx.rs: Excel spreadsheet readingsrc/inspect.rs: Parquet statisticssrc/to_csv.rs: Parquet → CSVsrc/to_jsonl.rs: Parquet → JSONL
Refactored Modules
src/analysis/: cleaner splitting, generic builderssrc/conversion/: parallel pipeline, MB/s ticker, block handling with positionsrc/schema.rs: types renamed to English, inference logic clarifiedsrc/utils.rs: compression functions, advanced temporal parsing
🗑️ Deletions
- Empty module
automatic_rejection_tests.rs - Unused variables in
ErrorCounters - Dependency on CSV reconstruction in
analyze_block()
🧪 Tests
- New integration tests for JSON, XLSX and multi-line CSV fields
- Timestamp precision tests (microseconds, nanoseconds)
- Verification of strict row ordering in parallel pipeline
🌐 Internationalization
- Codebase fully in English: variable names, error messages, logs, comments, and end-user messages