Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Seventeen years of January taxi files in Databricks: what changing columns and file order decide

Read with the 2025 columns, 15 of 17 January taxi files were refused, while a map of each era's columns kept every row.

Every file, defect, query and layout behind the entry page, and four follow-ups.

The load: three ways to read 17 years

The newest-schema read takes the schema Spark reads from the 2025 file and reads every year with it, by column name. It loaded 2024 and 2025 (6,439,850 rows) and refused the rest. Thirteen files from 2011 to 2023 store zone and vendor ids as 64-bit integers, where 2025 uses 32-bit. The 2009 and 2010 files carry payment codes as text. Every refusal said "Data type mismatches when reading Parquet column ." with the column name left blank.

Reading the folder with schema merging switched on failed too, on the first pair of types it could not merge. Nothing loaded wrong without an error. The cost of the default is a stopped pipeline and an error that does not say where to look. Adding one file at a time with types converted did far better: see the third follow-up.

The schema-aware load maps each era's names and types to one schema: 2009 (its own names, text times, coordinates instead of zones), 2010 (other names, the same kinds), and 2011 on (one layout, names that differ only in case, types that drift). Every cast is a safe cast, so a value that cannot convert becomes empty. The checks count empty values after the cast and do not separate a failed cast from a value missing in the source. It kept all 153,598,220 rows, each with a pickup time.

File (January)RowsNewest-schema read
2009-0114,092,413refused: text read as a number
2010-0114,863,778refused: text read as a number
2011-0113,464,997refused: 64-bit integer read as 32-bit
2012-0113,058,348refused: 64-bit integer read as 32-bit
2013-0114,776,617refused: 64-bit integer read as 32-bit
2014-0113,782,517refused: 64-bit integer read as 32-bit
2015-0112,741,035refused: 64-bit integer read as 32-bit
2016-0110,905,067refused: 64-bit integer read as 32-bit
2017-019,710,820refused: 64-bit integer read as 32-bit
2018-018,760,687refused: 64-bit integer read as 32-bit
2019-017,696,617refused: 64-bit integer read as 32-bit
2020-016,405,008refused: 64-bit integer read as 32-bit
2021-011,369,769refused: 64-bit integer read as 32-bit
2022-012,463,931refused: 64-bit integer read as 32-bit
2023-013,066,766refused: 64-bit integer read as 32-bit
2024-012,964,624loaded
2025-013,475,226loaded

Defects across the years

Flags, never deletions. 1,458,164 rows (0.95%) fail at least one of the five checks the trip fact table uses to mark a row valid. Two trends stand out. Trips with a distance of zero or less grew from 0.82% in 2009 to 2.62% in 2025. In 2025, 16.3% of trips have no or a zero passenger count and 1.81% a negative total. The 2009 file has 175,082 trips that end before they start, and no values at all for rate code and tax.

FileDrop-off before pickupDistance zero or lessNegative totalNo or zero passengersUnknown zonePickup outside the file's month
2009-011.24%0.82%0.00%0.01%1.51%0.00%
2010-010.00%0.56%0.00%0.00%1.80%0.00%
2011-010.00%0.57%0.00%0.53%2.64%0.00%
2012-010.00%0.48%0.00%2.11%2.50%0.00%
2013-010.00%0.56%0.00%0.00%1.93%0.00%
2014-010.01%0.56%0.00%0.00%1.43%0.00%
2015-010.00%0.58%0.03%0.05%1.96%0.00%
2016-010.00%0.58%0.04%0.00%1.62%0.00%
2017-010.00%0.60%0.05%0.01%1.75%0.00%
2018-010.00%0.63%0.05%0.68%1.81%0.00%
2019-010.00%0.72%0.09%1.90%2.13%0.01%
2020-010.00%1.10%0.30%2.81%0.74%0.00%
2021-010.41%1.46%0.49%9.13%1.49%0.00%
2022-010.05%1.19%0.52%5.01%1.21%0.00%
2023-010.00%1.50%0.82%4.01%1.36%0.00%
2024-010.00%2.04%1.20%5.79%0.41%0.00%
2025-010.00%2.62%1.81%16.25%0.27%0.00%

Layouts: four questions, three ways to store the trips

The same trip fact table, written three ways: no layout (22 files), partitioned by month (17 folders), and liquid clustered by pickup day and zone (35 files after optimising). Each question ran three times per layout, interleaved, in one session. The table shows medians. The follow-up's times below come from a second session, so compare times within a table, not across the two.

Question and layoutMB readFiles readTime against no layout
Airport pickups, one month: No layout13.11 of 221.00
Airport pickups, one month: Partitioned by month5.71 of 170.85
Airport pickups, one month: Clustered by day and zone15.22 of 351.04
Revenue by zone, one day: No layout22.24 of 221.00
Revenue by zone, one day: Partitioned by month22.86 of 171.03
Revenue by zone, one day: Clustered by day and zone57.56 of 351.09
One zone, 2011 to 2025: No layout237.518 of 221.00
One zone, 2011 to 2025: Partitioned by month234.515 of 171.11
One zone, 2011 to 2025: Clustered by day and zone42.16 of 350.81
Tip share by year, no filter: No layout317.722 of 221.00
Tip share by year, no filter: Partitioned by month315.317 of 170.89
Tip share by year, no filter: Clustered by day and zone327.135 of 351.03

The table with no layout skipped 21 of 22 files on the one-month question because the table was written in one pass, by file in month order. Partitioning cut data read 2.3 times on that question, and run time barely moved. Only clustering helped the one-zone question.

Follow-up: the same rows in random order

If load order was doing the work, a table written in no particular order should lose it. A backfill that writes many months at once, or a merge of late data, moves a table that way. A full shuffle is the far end. So the same 153,598,220 rows were written in random order with no layout and ran the four questions again, three times each, interleaved with the plain and partitioned tables. The prediction, written before the run: at least 10 times the data on the one-month question and 5 times on the one-day question.

It read 35 times the data on the one-month question (452.7 MB against 13.1 MB) and 28 times on the one-day question. It read all 103 of its files every time. It also stored the same rows in 3.42 GB against 2.28 GB, because files of mixed months compress worse. Run time rose 1.6 times on the one-month question, far less than the data.

So the plain table's low reads came from how the pipeline wrote it: in month order, so each file holds one month or a few neighbouring ones. Random order spread every month across all 103 files. A team that keeps appends in time order gets most of what partitioning promises without it. A team that merges late data or backfills in parallel should measure files read after each run, and test a layout clustered on the column its common question filters by, here the source month.

Question and layoutMB readFiles readTime against no layout
Airport pickups, one month: No layout13.11 of 221.00
Airport pickups, one month: Random order, no layout452.7103 of 1031.59
Airport pickups, one month: Partitioned by month5.71 of 170.94
Revenue by zone, one day: No layout22.24 of 221.00
Revenue by zone, one day: Random order, no layout633.7103 of 1031.55
Revenue by zone, one day: Partitioned by month22.86 of 171.06
One zone, 2011 to 2025: No layout237.518 of 221.00
One zone, 2011 to 2025: Random order, no layout405.7103 of 1031.29
One zone, 2011 to 2025: Partitioned by month234.515 of 171.02
Tip share by year, no filter: No layout317.722 of 221.00
Tip share by year, no filter: Random order, no layout468.5103 of 1031.23
Tip share by year, no filter: Partitioned by month315.317 of 170.94

Second follow-up: the one-month question for every month

Added after the results and declared before it ran. For every file of the three tables, the lowest and highest source month and pickup date it holds were recorded, which are the values the table format keeps per file for skipping. Then the one-month airport question ran once for each of the 17 months on each table, with a new value in the select list each time, and read files and bytes from the query history. None of the 51 runs came from the cache.

Kept in load order, each month sits in 1 or 2 of the 22 files. From 2011 to 2025 the question opened exactly those; in 2009 and 2010 it opened none, as below. Split by month it opened the 1 file holding the month in the same years. No layout ever opened a file outside the month. In 2009 and 2010 the ordered tables opened nothing: those years record pickup coordinates, not zone ids, so no row could match the zone filter, and no file was opened. In random order every month sits in all 103 files, and the question opened all 103 every time. The declared expectation was that the ordered tables would open exactly the files holding each month: it held from 2011 to 2025, not in 2009 and 2010, where they opened none. The declaration is kept with the study's source, outside this download. So the count that separates order from disorder is how many files hold the month, not whether the question opens more than those.

Over the 17 months, the split table read 234.7 MB in total against 296.0 MB in load order. From 2011 to 2019 it saved less than 1% in every month, because the load-order files each hold one month. The gain sits in 2020 to 2025, where smaller months share files. The random copy read 24.7 times the load-order total.

The pickup dates tell a different story. Stray dates such as 2001 and 2088 widen the date range of the later files, so up to 7 of the 22 load-order files have a date range that overlaps a given month. A question that filtered on pickup date could not skip those files. This one filters on the source month, whose ranges stay tight.

MonthFiles read of files holding the month, load orderFiles read of files holding the month, by monthFiles read of files holding the month, randomMB read, load orderMB read, by monthMB read, random
2009-010 of 20 of 1103 of 1030.00.0242.4
2010-010 of 20 of 1103 of 1030.00.0271.7
2011-012 of 21 of 1103 of 10326.126.1445.9
2012-012 of 21 of 1103 of 10325.024.9452.7
2013-012 of 21 of 1103 of 10328.228.2452.7
2014-012 of 21 of 1103 of 10325.025.0452.7
2015-012 of 21 of 1103 of 10323.423.4452.7
2016-012 of 21 of 1103 of 10320.220.2452.7
2017-011 of 11 of 1103 of 10317.617.6452.7
2018-011 of 11 of 1103 of 10316.716.7452.7
2019-011 of 11 of 1103 of 10315.215.1452.7
2020-011 of 11 of 1103 of 10315.012.0452.7
2021-011 of 11 of 1103 of 10315.82.8452.7
2022-012 of 21 of 1103 of 10327.84.6452.7
2023-011 of 11 of 1103 of 10313.15.6452.7
2024-011 of 11 of 1103 of 10312.95.6452.7
2025-011 of 11 of 1103 of 10314.16.8452.7

Third follow-up: simpler loads than the era map

Added after the results and declared before it ran. It asks whether the era map is needed at all, against the two simpler loads a data engineer would try first, on the same 17 raw files.

Added in turn, types converted. A table was created from the 2025 file with type widening switched on, a Delta setting that lets a column's type grow, such as a 32-bit integer to 64-bit. Each older file was then appended, newest first, as read from the file itself, with schema merging on. The ids of 2011 to 2023 were widened from 32-bit to 64-bit integers. The passenger counts and rate codes that 2019 to 2023 store as decimals were not widened but converted to the table's whole numbers, as the era map also does; follow-up 4 below shows that lost nothing. From 2011 to 2025 it matched the era map: the same rows, every one with a pickup time, and for every 2025 column at least as many values in every file. Names that differ only in case merged into one column. It refused 2009 and 2010: their payment codes are text, such as "CASH", and the table's payment column is a number. Their column names also differ from 2025's, as the load table shows, so they need a map either way. In all it kept 124,642,029 of the 153,598,220 rows.

Wide types, cast back. Every file was read with the 2025 names and every number column as a 64-bit decimal, then cast back. The reader refused all 17 files, 2025 included: it will not read a 64-bit integer column as a decimal. A second variant, declared after that result and before it ran, read integer columns as 64-bit integers and decimal columns as decimals. It loaded 10 files, 2011 to 2018, 2024 and 2025, every row with a pickup time, and the cast back lost no value. It refused 2019 to 2023, which store passenger count and rate code as decimals, and 2009 and 2010, which store payment codes as text.

The declared expectations held for the appended load and for the second wide variant. The first wide variant was expected to load 2011 to 2023 and loaded nothing. By the rule declared before the run, the call narrows: write a column map only for the years whose column names changed, and append the rest with types converted. The declarations are kept with the study's source, outside this download.

Rows loaded with a pickup time, or why the file was refused
File (January)Era mapAdded in turn, types convertedEvery number as decimalWidest kind per column
2009-0114,092,413refused: payment code is textrefused: 64-bit integer read as decimalrefused: text read as integer
2010-0114,863,778refused: payment code is textrefused: 64-bit integer read as decimalrefused: text read as integer
2011-0113,464,99713,464,997refused: 64-bit integer read as decimal13,464,997
2012-0113,058,34813,058,348refused: 64-bit integer read as decimal13,058,348
2013-0114,776,61714,776,617refused: 64-bit integer read as decimal14,776,617
2014-0113,782,51713,782,517refused: 64-bit integer read as decimal13,782,517
2015-0112,741,03512,741,035refused: 64-bit integer read as decimal12,741,035
2016-0110,905,06710,905,067refused: 64-bit integer read as decimal10,905,067
2017-019,710,8209,710,820refused: 64-bit integer read as decimal9,710,820
2018-018,760,6878,760,687refused: 64-bit integer read as decimal8,760,687
2019-017,696,6177,696,617refused: 64-bit integer read as decimalrefused: decimal read as integer
2020-016,405,0086,405,008refused: 64-bit integer read as decimalrefused: decimal read as integer
2021-011,369,7691,369,769refused: 64-bit integer read as decimalrefused: decimal read as integer
2022-012,463,9312,463,931refused: 64-bit integer read as decimalrefused: decimal read as integer
2023-013,066,7663,066,766refused: 64-bit integer read as decimalrefused: decimal read as integer
2024-012,964,6242,964,624refused: 64-bit integer read as decimal2,964,624
2025-013,475,2263,475,226refused: 64-bit integer read as decimal3,475,226
All 17153,598,220124,642,0290103,639,938

Follow-up 4: did the conversion cut anything? Added after the results and declared before it ran. Making the decimal counts whole could cut values, so one query over the five raw files of 2019 to 2023 counted the passenger counts and rate codes with a fractional part: none of the 41,332,760 values had one, as declared. So both the converted load and the era map kept every value.

Predictions, written before any run

What the platform's guidance says

Databricks's page on partitioning says: "Most tables on Databricks with less than 100 TB of data don't need partitioning. Databricks uses Delta Lake for all tables by default and automatically clusters data in unpartitioned tables by ingestion time, so you get partitioning-like performance without manual tuning." This study agrees and adds two measurements: how much the ingestion order is worth on this table, and what a table written out of order costs.

Limits