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

Remove offset if its zero #3102

Merged
merged 2 commits into from
Aug 11, 2022
Merged

Remove offset if its zero #3102

merged 2 commits into from
Aug 11, 2022

Conversation

turbo1912
Copy link
Contributor

Which issue does this PR close?

Closes #2584

Rationale for this change

If offset is 0, it should be a no-op and can be optimized out.

Questions to the reviewer?
Current proposed change adds this optimization to an existing slightly related optimizer. Does this require its own optimizer independent from eliminate_limit?

@github-actions github-actions bot added the optimizer Optimizer rules label Aug 11, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #3102 (c2e0d18) into master (85d5363) will increase coverage by 0.01%.
The diff coverage is 94.53%.

❗ Current head c2e0d18 differs from pull request most recent head 67741f8. Consider uploading reports for the commit 67741f8 to get more accurate results

@@            Coverage Diff             @@
##           master    #3102      +/-   ##
==========================================
+ Coverage   85.93%   85.95%   +0.01%     
==========================================
  Files         289      290       +1     
  Lines       52101    52270     +169     
==========================================
+ Hits        44774    44927     +153     
- Misses       7327     7343      +16     
Impacted Files Coverage Δ
...usion/core/src/avro_to_arrow/arrow_array_reader.rs 0.00% <0.00%> (ø)
datafusion/core/src/catalog/information_schema.rs 94.42% <0.00%> (ø)
datafusion/core/src/datasource/listing/mod.rs 55.55% <ø> (ø)
...afusion/core/src/physical_plan/file_format/avro.rs 0.00% <ø> (ø)
datafusion/core/src/physical_plan/hash_utils.rs 40.43% <0.00%> (ø)
datafusion/core/src/physical_plan/repartition.rs 93.26% <ø> (ø)
...tafusion/core/src/physical_plan/sort_merge_join.rs 90.36% <0.00%> (ø)
datafusion/core/tests/sql/aggregates.rs 99.36% <ø> (ø)
datafusion/core/tests/sql/decimal.rs 100.00% <ø> (ø)
datafusion/core/tests/sql/joins.rs 99.33% <ø> (ø)
... and 51 more

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

@andygrove
Copy link
Member

LGTM @turbo1912. Could you update the rustdoc at the top of the file now that this optimizes both limits and offsets? I think it makes sense for these related optimizations to be in the same rule.

@alamb
Copy link
Contributor

alamb commented Aug 11, 2022

Nice -- thanks @turbo1912 !

@alamb alamb merged commit dbfb0e6 into apache:master Aug 11, 2022
@ursabot
Copy link

ursabot commented Aug 11, 2022

Benchmark runs are scheduled for baseline = 9956f80 and contender = dbfb0e6. dbfb0e6 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

gandronchik pushed a commit to cube-js/arrow-datafusion that referenced this pull request Aug 30, 2022
* Remove offset if its zero

* Add rust doc
gandronchik pushed a commit to cube-js/arrow-datafusion that referenced this pull request Aug 31, 2022
* Remove offset if its zero

* Add rust doc
gandronchik pushed a commit to cube-js/arrow-datafusion that referenced this pull request Sep 2, 2022
* Remove offset if its zero

* Add rust doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add optimizer rule to remove OFFSET 0
5 participants