Skip to content

fix(cubesql): Fix SortPushDown pushing sort through joins #9464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcheshkov
Copy link
Member

@mcheshkov mcheshkov commented Apr 14, 2025

Check List

  • Tests have been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Description of Changes Made (if issue reference is not provided)

LogicalPlan::Join and CrossJoin do not preserve the ordering semantically
When planned as HashJoin it will output batches in same order as they are coming from right stream
But both Join and CrossJoin will have same partitioning as right input (even when repartition_joins disabled), and these partitions can be collected in arbitrary order by CoalescePartitions

Side note: Substrait says that for both Join and Cross Product

Orderedness is empty post operation

See https://substrait.io/relations/logical_relations/#join-operation

LogicalPlan::Join and CrossJoin do not preserve the ordering semantically
When planned as HashJoin it will output batches in same order as they are coming from right stream
But both Join and CrossJoin will have same partitioning as right input (even when repartition_joins disabled), and these partitions can be collected in arbitrary order by CoalescePartitions

Also, Substrait says that for both Join and Cross Product
> Orderedness is empty post operation
See https://substrait.io/relations/logical_relations/#join-operation
@mcheshkov mcheshkov changed the title fix(cubesql): Fix SortPushDown pushing sort over joins fix(cubesql): Fix SortPushDown pushing sort through joins Apr 14, 2025
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.54%. Comparing base (91e3af6) to head (b9303ee).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9464      +/-   ##
==========================================
- Coverage   83.89%   76.54%   -7.36%     
==========================================
  Files         229      400     +171     
  Lines       83544   104866   +21322     
  Branches        0     3723    +3723     
==========================================
+ Hits        70087    80265   +10178     
- Misses      13457    24169   +10712     
- Partials        0      432     +432     
Flag Coverage Δ
cube-backend 48.04% <ø> (?)
cubesql 83.86% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcheshkov mcheshkov marked this pull request as ready for review April 14, 2025 14:30
@mcheshkov mcheshkov requested a review from a team as a code owner April 14, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant