Skip to content

NYC Taxi — Trip Duration Analysis

NYC Taxi benchmark · all NYC Taxi queries

Trip duration patterns

Representative SQL

Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).

SELECT
FLOOR(EXTRACT(EPOCH FROM (
dropoff_datetime - pickup_datetime
)) / 60 / 5) * 5 AS duration_bucket_min,
COUNT(*) AS trip_count,
AVG(trip_distance) AS avg_distance,
AVG(total_amount) AS avg_fare
FROM trips
WHERE
pickup_datetime >= '2019-10-14'
AND pickup_datetime < '2019-11-13'
AND dropoff_datetime > pickup_datetime
AND EXTRACT(EPOCH FROM (
dropoff_datetime - pickup_datetime
)) BETWEEN 60 AND 7200
GROUP BY
FLOOR(EXTRACT(EPOCH FROM (
dropoff_datetime - pickup_datetime
)) / 60 / 5) * 5
ORDER BY
duration_bucket_min

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import NYCTaxi
bench = NYCTaxi(scale_factor=1.0) # your scale factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['trip-duration-analysis'])

Source

Query text: benchbox/core/nyctaxi/queries.py