Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Public data

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.

Reading all years in one go failed. Read with the 2025 columns, only the 2024 and 2025 files loaded: 6.4 million rows. Adding each file with types converted kept every row from 2011 on, 124.6 million. Only 2009 and 2010 needed a map.

Trips loaded with a pickup time, in millions, from the January file of each year, 2009 to 2025

Trips loaded with a pickup time, by how the 17 yearly files were readAll years read in one go: 0 trips with a pickup time; it stopped with an error and loaded nothing.All years read in one gononeEvery year read with the 2025 columns: 6,439,850 trips with a pickup time; it loaded only 2024 and 2025 and stopped on the other 15 files.Every year read with the 2025 columns6.4 millionAdded in turn, types converted (2011 to 2025): 124,642,029 trips with a pickup time; it loaded every row of 2011 to 2025 and refused 2009 and 2010, whose payment codes are text.Added in turn, types converted (2011 to 2025)124.6 millionReference: every year mapped (2009 to 2025): 153,598,220 trips with a pickup time; it loaded every row of all 17 files.Reference: every year mapped (2009 to 2025)153.6 million

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

  1. 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.
  2. 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.
  3. 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.
  4. 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

The three numbers that matter

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

Detail pages