Skip to content

perf(runtime): skip EnsureRequirements while planning a point lookup - #14807

Merged
lukekim merged 2 commits into
trunkfrom
lukim/point-lookup-skips-ensure-requirements
Oct 7, 2026
Merged

lukekim merged 2 commits into
trunkfrom
lukim/point-lookup-skips-ensure-requirements

Conversation

@lukekim

@lukekim lukekim commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📝 Summary

The primary-key point-lookup fast path (#14433) skips the rules a lookup cannot trigger, by name. DataFusion 55 merged EnforceDistribution and EnforceSorting into one rule, EnsureRequirements (apache/datafusion#21976). Neither listed name matched anything after the upgrade, so the merged rule has run on every lookup since.

Fix. List EnsureRequirements. A new test, every_point_lookup_skippable_rule_is_registered, builds the session with every optional rule on and requires every listed name to belong to a registered rule. A rename can then no longer stop a rule being skipped without anyone noticing. With the old list it fails:

the point-lookup skip list names rules the session does not register, so they are never skipped: ["EnforceDistribution", "EnforceSorting"]

Skipping it cannot change a lookup's plan for the same reason skipping the two old rules could not: the accepted shape has no distribution or ordering requirement while LIMIT stays excluded. lean_planning_leaves_point_lookup_plans_unchanged still passes. In the engine run below, all 200 lookups returned identical rows from both binaries.

Point lookups. 200 distinct primary keys × 10 reps against TPC-H SF1 orders (Cayenne, primary_key: o_orderkey), 2,000 lookups per binary over HTTP, interleaved. All 200 keys returned identical rows from both binaries.

p50 p90 p99
before 0.753 ms 0.875 ms 1.153 ms
after 0.715 ms (−5.0%) 0.830 ms 1.041 ms

An A/A run of the same harness gives p50 0.999× and p99 1.083×, so the p50 gain is beyond its noise and the p99 one is within it. Removing EnsureRequirements from the whole session on DataFusion 55 gave the same p50 gain (0.849 → 0.805 ms), with all 200 plans identical.

Performance. Measured with one binary carrying this change and the two other planner fixes from the same audit (#14805 and #14806), against the same commit without them. None of the three changes a TPC-H or TPC-DS plan at the default settings. All 21 TPC-H and 95 TPC-DS SF1 physical plans (Cayenne, file mode) are identical between the two binaries, and every result matches.

Interleaved runs on one machine:

  • TPC-H, 10 reps per query: p50 after/before between 0.94 and 1.03. An A/A run of the same harness spans 1.01 to 1.15.
  • TPC-DS, 5 reps: between 0.90 and 1.17.

The queries whose single worst sample moved were re-run with 30 reps. Their p50 and p90 match:

Query p50 before → after p90 before → after
TPC-H q3 16.6 → 16.8 ms 18.0 → 17.5 ms
TPC-H q7 18.1 → 17.5 19.8 → 19.6
TPC-H q9 50.3 → 50.2 52.0 → 52.6
TPC-H q18 102.1 → 102.0 104.3 → 105.1
TPC-DS q21 8.9 → 9.0 10.7 → 11.0
TPC-DS q99 15.1 → 14.4 16.0 → 15.2

The point-lookup fast path skips the rules a primary-key lookup cannot
trigger, by name. DataFusion 55 merged EnforceDistribution and EnforceSorting
into EnsureRequirements (apache/datafusion#21976), so neither listed name
matched any rule and the merged rule ran on every lookup. List it instead,
and add a test that every name on the list belongs to a rule the built
session registers, so a renamed rule cannot silently stop being skipped.
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ Pull with Spice Passed

Passing checks:

  • ✅ Title meets minimum length requirement (10 characters)
  • ✅ No banned labels detected
  • ✅ Has a label from required category kind/
  • ✅ Has a label from required category area/
  • ✅ Has at least one assignee: lukekim

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The rule update matches DataFusion 55 and is protected against future registration-name drift.

Review effort: Balanced
Findings: None

What changed in this PR

Updates the point-lookup fast path for DataFusion 55’s merged physical optimizer rule.

Changes:

  • Replaces obsolete rule names with EnsureRequirements.
  • Adds regression coverage ensuring skipped rules are registered.
File Description
crates/​runtime/​src/​datafusion/​point_lookup.rs Updates the physical-rule skip list and documentation.
crates/​runtime/​src/​datafusion/​builder.rs Adds registration validation for skippable rules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lukekim lukekim self-assigned this Oct 6, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused rule-name update matches DataFusion 55 and includes appropriate regression coverage.

Review effort: Balanced
Findings: None

@lukekim
lukekim added this pull request to the merge queue Oct 7, 2026
@sgrebnov sgrebnov added this to the v2.4.0 milestone Oct 7, 2026
Merged via the queue into trunk with commit b4cbcc5 Oct 7, 2026
@lukekim
lukekim deleted the lukim/point-lookup-skips-ensure-requirements branch October 7, 2026 20:01
peasee pushed a commit that referenced this pull request Oct 8, 2026
…14807)

* perf(runtime): skip EnsureRequirements while planning a point lookup

The point-lookup fast path skips the rules a primary-key lookup cannot
trigger, by name. DataFusion 55 merged EnforceDistribution and EnforceSorting
into EnsureRequirements (apache/datafusion#21976), so neither listed name
matched any rule and the merged rule ran on every lookup. List it instead,
and add a test that every name on the list belongs to a rule the built
session registers, so a renamed rule cannot silently stop being skipped.

* style: backtick DataFusion in doc comment (clippy doc_markdown)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants