SubhamSinghal commented on code in PR #25839:
URL: https://github.com/apache/datafusion/pull/25839#discussion_r4261141650
##########
benchmarks/sql_benchmarks/pwmj/pwmj.benchmark.template:
##########
@@ -0,0 +1,51 @@
+# Shared template for the `pwmj` suite: `PiecewiseMergeJoin`'s classic joins
+# (INNER / LEFT / RIGHT / FULL) over a single range predicate,
+# `lhs.key < rhs.key`.
+#
+# Parameters set by each qNN.benchmark:
+# QPAD zero-padded query id
+# JOIN SQL join keyword (INNER, LEFT, RIGHT, FULL)
+# JOIN_KIND plan `join_type` (Inner, Left, Right, Full)
+# RIGHT_ROWS streamed row count
+# RIGHT_KEY streamed key expression over `value` and its scramble `h`
+# EXPECTED_ROWS rows the join returns, asserted before measuring
+#
+# `lhs` (buffered) holds the keys 1..=100000; a streamed key `b` matches
exactly
+# the buffered keys 1..b, so each subgroup is a different match regime (see
+# init/load.sql). There is no nested-loop arm: at these sizes it is 2 * 10^11
+# predicate evaluations.
+
+load sql_benchmarks/pwmj/init/load.sql
+
+init sql_benchmarks/pwmj/init/settings.sql
+
+name Q${QPAD}
+group pwmj
+
+# PWMJ is off by default. Without the flag every query plans as a nested-loop
+# join and the suite measures a different operator than its name claims.
+assert I
+SELECT value = 'true' FROM information_schema.df_settings WHERE name =
'datafusion.optimizer.enable_piecewise_merge_join';
+----
+true
+
+# The row count follows from the keys alone, so a wrong join result fails here
+# rather than showing up as a plausible timing.
+assert I
+SELECT count(*) FROM lhs ${JOIN} JOIN rhs ON lhs.key < rhs.key;
+----
+${EXPECTED_ROWS}
+
+# Pin the operator and the join type: the flag only permits PWMJ, and a planner
+# that swapped the inputs would measure the mirrored join. `expect_plan`
matches
+# the plan's `Debug` output, so the fields are checked one at a time.
+expect_plan PiecewiseMergeJoinExec
Review Comment:
Addressed in 2ddd204dd18501062abfa855c76aa487ad004e28
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]