Seventeen years of January taxi files in Databricks: what changing columns and file order decide
Letting Databricks convert column types loaded every January taxi file from 2011 to 2025; only 2009 and 2010 needed a column map.
Map columns only where names changed.
A pipeline built for the 2025 taxi files refused 15 of New York's 17 January files since 2009. Column names changed twice, and the number format of a column, its type, changed more often. A column map is a list pairing each old name with today's. The 2009 and 2010 files needed one: their columns have other names, and their payment codes are text.
Trips loaded with a pickup time, in millions, from the January file of each year, 2009 to 2025
Every file: results.
The mapped trips were then stored three ways and queried on a Databricks SQL warehouse, the cloud compute that runs queries on the platform. The files were written in month order. So a question about one source file's month opened at most the 1 or 2 of 22 files holding it. Each file records its months, and Databricks skips the rest. Splitting the table by month, which Databricks advises against at this size, helped only from 2020, where several months share a file.
What to do
- Map columns only where names changed. Compare each file's own column names and types with today's first: schema merging adds a renamed column as a new column rather than filling today's. Where only number formats differ, add each file in turn, let Databricks convert the types, and check that no value was cut. Map the years with other names, here 2009 and 2010, with casts that turn a bad value into an empty one, and count the empties.
- Check what a query already skips before you split a table. The platform's query history shows how many files each query opened and skipped.
- Load new files in time order. Then each file holds one month or a few, and a question about one source file's month opens only those files.
- Re-sort by zone only if most questions filter by zone. Re-sorting the files by day and zone, which Databricks calls clustering, cut a one-zone question from 238 MB to 42 MB. It also made a one-day question read 2.6 times more.
What it is worth
Read with the 2025 types, a reload of this history stops on 15 of 17 files and loads 4.2% of the rows. With the types converted it loads 81%. Predicted before any run: the old files would load with pickup times silently empty. They were refused instead, which is safer but stops the reload.
Splitting by month would save little. Asked about every month, the split table read the same as the ordered one until 2019. From 2020 it read up to 6 times less: 235 MB in total against 296 MB. Not worth a rewrite.
Losing the load order costs more than splitting saves. A copy of the same rows in random order took 50% more storage. Databricks bills a warehouse for the time it runs, not for data read, and at this size run time rose only 1.6 times. At Databricks' list prices, the pipeline, the benchmark and the random-order copy came to about US$3.25. The stopped reload is the real cost. With the 2025 types, 147.2 million of 153.6 million rows stay unloaded. Converted, only the 29.0 million of 2009 and 2010 do.
How to put it to work with a team
- Land files unchanged, then compare names and types. Here a census of each landed file's column types, taken before any load ran, listed exactly the 15 files the load later refused.
- One job, one owner per step. The pipeline is one Databricks job of 6 tasks, with one retry per task. When the old files were refused, it recorded each refusal and still ran the mapped load. The data engineer owns the column map.
The three numbers that matter
- 15 of 17 January files refused with the 2025 columns, and 2 with the types converted.
- 1 of 22 files read by the January 2023 question on the table kept in load order. It filters on the source file's month, written in order; by pickup date, up to 7 of the 22 files overlap a month.
- 35 times the data read by that question when the same trips were stored in full random order, the worst case: 453 MB from all 103 files. For one day, 28 times.
What would change the conclusion
If a file holds even one value the conversion would cut, map that file instead. The layout call depends on one count, taken for all 17 months: how many files hold the month a question asks about. In load order it was 1 or 2 of 22, and in random order all 103. If a large reload or a merge of late data raises that count past the 2 measured here, find out why before changing anything. More or smaller files for one month are harmless. Files that each span many months mean the order is going. Then benchmark a copy re-sorted by month, and switch only if it cuts what the common queries read.
Limits
- One month a year: 153.6 million rows and 2.3 GB of tables, on the smallest query engine of Databricks Free Edition, median of 3 runs. Larger tables were not tested.
- The simpler loads, the every-month count and the random-order copy were added after the results, each declared before it ran. The converted load and the map were not run together into one table. A later check, also declared first, found no fractional passenger count or rate code in 2019 to 2023, so converting them lost nothing.
- Costs are the metered use, at list prices, in the hours of the main run and the random-order copy. Nothing run later is included. Free Edition charged nothing.
- The random-order copy had more files and compressed worse, so its 35-fold figure does not separate order from file size.
- Of eight predictions written before any run, six held, one came out the opposite way and one missed. Splitting cut data read less than predicted, and clustering made the one-day question read more.
- Defects are flagged, not fixed, so each question can choose its own rule; a repair would build one rule into every answer. The code repairs none: values it cannot convert become empty and are counted.
Detail pages
- Results: every file, defect, query and layout.
- Method: the pipeline, the job and how to rerun it.
- Related: the congestion fee and ride-hail trips, what cuts a BigQuery bill, pipelines that break.