Get Top N Rows from Parquet Files Online
Extract the top N rows per group from Parquet files directly in your browser. Get the top 5 products per category, highest scores per team, or any ranked subset — no upload required.
How to get Top N Rows from Parquet files
- Drop your file onto the upload area. The first 200 rows are shown and the first numeric column is pre-selected as the ranking column.
- Choose Rank by column and a Direction: Highest first for the largest values, Lowest first for the smallest.
- Optionally choose a Group by column to get the top rows within each group. Leave it on (none) to rank the whole table.
- Set Top N (default 5). Tick Include rank position column if you want a rank_in_group column showing 1, 2, 3 within each group.
- Click Get Top N, check the row count and preview, then download the result in the same format.
Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.
Worked example
A race organiser has marathon finish times and wants the two fastest runners in each age group for the podium list.
Input (Parquet)
Parquet file (binary, columnar) — shown as a table with its schema
| runner | age_group | finish_minutes |
|---|---|---|
| Aroha Ngata | F40-49 | 212.5 |
| Megan Doyle | F40-49 | 198.25 |
| Lena Fischer | F40-49 | 205 |
| Tom Reid | M50-59 | 187.75 |
| Raj Patel | M50-59 | 201 |
| Owen Clarke | M50-59 | 179.5 |
Schema: runner VARCHAR, age_group VARCHAR, finish_minutes DOUBLE
Settings
- Rank by column: finish_minutes
- Direction: Lowest first
- Group by: age_group
- Top N: 2
- Include rank position column: on
Result
| runner | age_group | finish_minutes | rank_in_group |
|---|---|---|---|
| Megan Doyle | F40-49 | 198.25 | 1 |
| Lena Fischer | F40-49 | 205 | 2 |
| Owen Clarke | M50-59 | 179.5 | 1 |
| Tom Reid | M50-59 | 187.75 | 2 |
Lower times are better, so Lowest first is used. Each age group is ranked on its own, and the slowest runner in each group drops out. The output is sorted by age_group and then by finish_minutes. The rank_in_group column is added at the end only because the rank option was ticked. With Group by left on (none), the result would be the two fastest runners overall: Owen Clarke and Tom Reid.
Working with Parquet files
Parquet columns keep their stored types, so a DECIMAL revenue column or an INT64 score ranks numerically without any guessing. Timestamp columns rank correctly at full precision, which makes "latest 3 events per device" a simple setting: rank by the timestamp, Highest first, N = 3. Two events a few microseconds apart are ranked separately even if they look identical in the preview.
The Group by list includes every column, but grouping by a struct or list column is rarely useful. Pick a scalar key such as a customer ID or region code instead. The result is written with COPY to a new Parquet file with the same column types, plus an INT64 rank_in_group column if you asked for it. Row groups are rewritten, so a file that was sorted or partitioned a certain way upstream will be ordered by group and rank afterwards. Because the whole file is ranked in memory, very large files are limited by the memory available to your browser tab.
Frequently Asked Questions
Can I get the latest N records per ID from a Parquet file?
Yes. Set Rank by to the timestamp column, Direction to Highest first, Group by to the ID column, and Top N to the number you need.
Does the Parquet output keep DECIMAL and TIMESTAMP types?
Yes. All original columns keep their types. The optional rank_in_group column is added as an integer.
What happens when two rows tie at the Nth position?
The tool uses ROW_NUMBER, so exactly N rows are returned per group and one of the tied rows is dropped. Which one is not guaranteed. If ties matter, use the Rank tool, which supports RANK and DENSE_RANK, and then filter.
Can I rank by a text or date column?
Yes. Rank by lists every column. Text ranks alphabetically and dates rank chronologically. The first numeric column is only the default.
Where are NULL values placed in the ranking?
After all non-NULL values, whichever direction you choose. They only appear in the result when a group has fewer than N rows with a value.
Related Tools
Sort Parquet Files Online
Sort Parquet files by any column, ascending or descending, directly in your browser.
Rank Rows in Parquet Files Online
Add a rank column to Parquet files based on any column's values. Choose RANK, DENSE RANK, or ROW NUMBER, with optional partitioning — runs entirely in your browser.
Aggregate Parquet Files Online
Group and aggregate Parquet files by any column directly in your browser. Calculate sum, average, min, max, and count for any numeric column — no upload required.
Get Top N Rows from CSV Files Online
Extract the top N rows per group from CSV files directly in your browser. Get the top 5 products per category, highest scores per team, or any ranked subset — no upload required.
Get Top N Rows from Excel Files Online
Extract the top N rows per group from Excel files directly in your browser. Get the top 5 products per category, highest scores per team, or any ranked subset — no upload required.
Get Top N Rows from JSON Files Online
Extract the top N rows per group from JSON files directly in your browser. Get the top 5 products per category, highest scores per team, or any ranked subset — no upload required.
Parquet Viewer Online
View and inspect Parquet files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.
Convert Parquet to CSV Online
Convert Parquet files to CSV format directly in your browser. No upload required — your data never leaves your device.