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

Use usize rather than Option<usize> to represent Limit::skipand Limit::offset #3374

Merged
merged 5 commits into from
Sep 7, 2022

Conversation

HaoYang670
Copy link
Contributor

@HaoYang670 HaoYang670 commented Sep 6, 2022

Signed-off-by: remzi [email protected]

Which issue does this PR close?

Closes #3369.

Rationale for this change

skip = None and skip = Some(0) are equivalent, so we don't need both of them and the Optional type here is redundant. We use usize as the type of skip so that skip = None and skip = Some(0) can be simplified to skip = 0

What changes are included in this PR?

Are there any user-facing changes?

Yes.

@HaoYang670
Copy link
Contributor Author

Mark this as draft as I only update the logical plan so far.

@HaoYang670 HaoYang670 marked this pull request as draft September 6, 2022 09:07
@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner labels Sep 6, 2022
Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

This is looking good so far. Nice simplification.

@HaoYang670 HaoYang670 marked this pull request as ready for review September 7, 2022 02:18
@codecov-commenter
Copy link

Codecov Report

Merging #3374 (0187046) into master (d16457a) will decrease coverage by 0.00%.
The diff coverage is 91.07%.

@@            Coverage Diff             @@
##           master    #3374      +/-   ##
==========================================
- Coverage   85.58%   85.58%   -0.01%     
==========================================
  Files         296      296              
  Lines       54175    54158      -17     
==========================================
- Hits        46364    46349      -15     
+ Misses       7811     7809       -2     
Impacted Files Coverage Δ
datafusion/core/src/execution/context.rs 78.94% <ø> (ø)
...afusion/core/src/physical_optimizer/repartition.rs 100.00% <ø> (ø)
datafusion/core/tests/dataframe_functions.rs 100.00% <ø> (ø)
datafusion/core/tests/sql/explain_analyze.rs 83.87% <ø> (ø)
datafusion/expr/src/logical_plan/plan.rs 77.28% <0.00%> (-0.17%) ⬇️
datafusion/proto/src/logical_plan.rs 17.88% <0.00%> (+0.07%) ⬆️
datafusion/sql/src/planner.rs 81.66% <61.53%> (-0.02%) ⬇️
datafusion/core/src/physical_plan/limit.rs 91.18% <84.61%> (-0.19%) ⬇️
datafusion/core/src/dataframe.rs 89.21% <100.00%> (+0.19%) ⬆️
datafusion/core/src/physical_plan/planner.rs 77.44% <100.00%> (ø)
... and 7 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alamb alamb added the api change Changes the API exposed to users of the crate label Sep 7, 2022
@alamb alamb changed the title Use usize to represent Limit::skip Use usize rather than Option<usize> to represent Limit::skipand Limit::offset Sep 7, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks good to me @HaoYang670 -- thanks!

fyi @turbo1912 and @AssHero and @
ming535 who have contributed to this code recently

/// Maximum number of rows to fetch
pub skip: usize,
/// Maximum number of rows to fetch,
/// None means fetching all rows
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@andygrove andygrove merged commit 43e2d91 into apache:master Sep 7, 2022
@ursabot
Copy link

ursabot commented Sep 7, 2022

Benchmark runs are scheduled for baseline = c359018 and contender = 43e2d91. 43e2d91 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

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

Great job.

_ => {}
return Ok(input.as_ref().clone());
} else {
{}
Copy link
Member

Choose a reason for hiding this comment

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

redundant part

@jackwener
Copy link
Member

😂Look like my review is late, new a PR for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use usize to represent Limit::skip
6 participants