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 Streams that yield Join-operations #43

Open
julgus opened this issue Aug 11, 2020 · 1 comment
Open

Optimize Streams that yield Join-operations #43

julgus opened this issue Aug 11, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@julgus
Copy link
Member

julgus commented Aug 11, 2020

As JPAstreamer makes it easy to stream any database table there are many operations which can be added that results in a non-optimized stream. That is for example the case when accessing fields that depend on other tables. See for example:

        long count = jpaStreamer.stream(Film.class)
                .filter(f -> f.getActors()
                        .stream()
                        .filter(Actor$.lastName.startsWith("A"))
                        .count() > 0)
                .count();

Here, the predicate on the fourth row (actors last names starts with A) should optimally be included as a where-clause in the original Join. As of now, we have to materialize every actor even though we are only interested in a subset of them.

It would be good to find a way to optimize similar queries.

@julgus julgus added the enhancement New feature or request label Aug 11, 2020
@minborg
Copy link
Contributor

minborg commented Sep 4, 2020

We could potentially add predicate builders like:

Film$.actor.where().lastName.startsWith("A")

or

Film$.actor.flatMap().lastName.startsWith("A")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants