Skip to content

H2ODB — Top Pickup Locations

H2ODB benchmark · all H2ODB queries

Top 10 pickup locations by trip count with WHERE IS NOT NULL

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
pickup_location_id,
COUNT(*) AS trip_count
FROM trips
WHERE
pickup_location_id IS NOT NULL
GROUP BY
pickup_location_id
ORDER BY
trip_count DESC,
pickup_location_id
LIMIT 10

Representative DataFrame

Expression family (Polars, PySpark, DataFusion), default parameters.

def q10_expression_impl(ctx: DataFrameContext) -> Any:
trips = ctx.get_table("trips")
col = ctx.col
return (
trips.filter(col("pickup_location_id").is_not_null())
.group_by("pickup_location_id")
.agg(col("pickup_location_id").count().alias("trip_count"))
.sort(["trip_count", "pickup_location_id"], descending=[True, False])
.limit(10)
)

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 H2ODB
bench = H2ODB(scale_factor=0.01) # your scale factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['Q10'])

For the DataFrame form:

from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('h2odb', 'Q10', family="expression").source) # or family="pandas"

Source

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