Skip to content

JoinOrder Q20c — Canonical JoinOrder 20c

JoinOrder benchmark · all JoinOrder queries

Canonical JoinOrder SQL query 20c; generated DataFrame translation

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
MIN(n.name) AS cast_member,
MIN(t.title) AS complete_dynamic_hero_movie
FROM complete_cast AS cc, comp_cast_type AS cct1, comp_cast_type AS cct2, char_name AS chn, cast_info AS ci, keyword AS k, kind_type AS kt, movie_keyword AS mk, name AS n, title AS t
WHERE
cct1.kind = 'cast'
AND cct2.kind LIKE '%complete%'
AND chn.name IS NOT NULL
AND (
chn.name LIKE '%man%' OR chn.name LIKE '%Man%'
)
AND k.keyword IN (
'superhero',
'marvel-comics',
'based-on-comic',
'tv-special',
'fight',
'violence',
'magnet',
'web',
'claw',
'laser'
)
AND kt.kind = 'movie'
AND t.production_year > 2000
AND kt.id = t.kind_id
AND t.id = mk.movie_id
AND t.id = ci.movie_id
AND t.id = cc.movie_id
AND mk.movie_id = ci.movie_id
AND mk.movie_id = cc.movie_id
AND ci.movie_id = cc.movie_id
AND chn.id = ci.person_role_id
AND n.id = ci.person_id
AND k.id = mk.keyword_id
AND cct1.id = cc.subject_id
AND cct2.id = cc.status_id

Representative DataFrame

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

def _impl(ctx: DataFrameContext) -> Any:
return _execute_joinorder_expression_query(ctx, query_id)

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

For the DataFrame form:

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

Source

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