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

Optimize filter executor in pull-based executor #4421

Merged
merged 2 commits into from
Nov 30, 2022

Conversation

xudong963
Copy link
Member

Which issue does this PR close?

No

Rationale for this change

If Selection operator doesn't produce any rows, we can just pull next RecordBatches from it.

What changes are included in this PR?

Add loop for filter executor.

Are these changes tested?

Covered by existing tests

Are there any user-facing changes?

No

@github-actions github-actions bot added the core Core DataFusion crate label Nov 29, 2022
@xudong963
Copy link
Member Author

I think the more elegant way is to directly Skip current iterator to the next iterator.

For example:

trait A {
    fn execute() -> Result<Stream>;
}


Struct B {
    input: C,
}

Struct C {
    input: D
}

Struct D {
    
}

// All D, B, C have implemented trait A and trait Stream
// Each execute method will call its input's execute method


fn main {
    let b = B::new();
    let data_stream = b.execute();
    while let Some(stream) = data_stream.next().await {
        ...
    }
}

impl Stream for C {
    type Item = ..;

    fn poll_next(
        mut self: std::pin::Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Option<Self::Item>> {
        ...
        if !predicate(value) {
            // Skip current iteration
        }
    }
}

But I don't find a proper way to implement it, Stream crate seems not to provide related API. Any thoughts? @tustvold

@alamb alamb changed the title Optimzie filter executor in pull-based executor Optimize filter executor in pull-based executor Nov 29, 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.

Seems like a reasonable change to me. Thanks @xudong963

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Copy link
Member

@Ted-Jiang Ted-Jiang left a comment

Choose a reason for hiding this comment

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

Nice find! 👍

@xudong963
Copy link
Member Author

Thanks for your review!

@xudong963 xudong963 merged commit 522a2a4 into apache:master Nov 30, 2022
@xudong963 xudong963 deleted the filter_executor branch November 30, 2022 11:38
@ursabot
Copy link

ursabot commented Nov 30, 2022

Benchmark runs are scheduled for baseline = fdc83e8 and contender = 522a2a4. 522a2a4 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants