Skip to content
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

clarify semantics in order_by docstring #518

Merged
merged 1 commit into from
Nov 3, 2024
Merged

clarify semantics in order_by docstring #518

merged 1 commit into from
Nov 3, 2024

Conversation

mattseddon
Copy link
Member

Closes #477

@mattseddon mattseddon self-assigned this Oct 18, 2024
@mattseddon mattseddon requested a review from a team October 18, 2024 01:49
@mattseddon mattseddon marked this pull request as ready for review October 18, 2024 01:49
Copy link

cloudflare-workers-and-pages bot commented Oct 18, 2024

Deploying datachain-documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: db48bfa
Status: ✅  Deploy successful!
Preview URL: https://f99d6d47.datachain-documentation.pages.dev
Branch Preview URL: https://fix-477.datachain-documentation.pages.dev

View logs

@mattseddon mattseddon changed the title Clarify semantics in order_by docstring clarify semantics in order_by docstring Oct 18, 2024
Order is not guaranteed when steps are added after an `order_by` statement.
I.e. when using `from_dataset` an `order_by` statement should be used if
the order of the records in the chain is important.
Using `order_by` directly before `limit` will give expected results.
Copy link
Member

Choose a reason for hiding this comment

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

I assume collect, show, to_parquet - are not considered as steps and will give also a "desired" output?

Copy link
Member Author

Choose a reason for hiding this comment

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

collect - should but not guranteed (explanation in the original ticket #477)
show - yes
to_parquet - should but not guaranteed (uses collect_flatten)

Copy link
Member

Choose a reason for hiding this comment

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

yep, probably needs to be a separate ticket then - e.g. combine things like order_by().collect() into a single statement, wdyt? (can be / should be implemented separately)

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean adding methods like collect_ordered OR adding an explicit order_by param to those methods or patching those functions? Is there a specific use case we're targeting or are we just trying to avoid confusion?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's a basic expectation that if you do order_by().collect() that you are getting a sorted result? collect is a way to iterate on the results I guess.

I mean that collect probably should be implemented similar to show() - something like ``order_by().collect()` should be a single SQL query probably

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.87%. Comparing base (7ba4477) to head (db48bfa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #518   +/-   ##
=======================================
  Coverage   87.87%   87.87%           
=======================================
  Files          96       96           
  Lines        9873     9873           
  Branches     1349     1349           
=======================================
  Hits         8676     8676           
  Misses        857      857           
  Partials      340      340           
Flag Coverage Δ
datachain 87.81% <ø> (ø)

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.

Copy link
Contributor

@dreadatour dreadatour left a comment

Choose a reason for hiding this comment

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

🙏👍

@mattseddon mattseddon merged commit e1d7a25 into main Nov 3, 2024
34 of 36 checks passed
@mattseddon mattseddon deleted the fix-477 branch November 3, 2024 22:42
skshetry pushed a commit that referenced this pull request Nov 14, 2024
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.

Clarify ordering semantics
4 participants