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

Manual join on aggregates are not supported #38

Closed
Shaddix opened this Issue Jun 30, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@Shaddix
Contributor

Shaddix commented Jun 30, 2017

Let's say I want to display the list of Blogs and for each blog I want to display the Post which has maximum of likes (in reality, quite often the last post is displayed, i.e. having Max Date).

So, I want a query like that:

var query = db.Posts.GroupBy(x => x.BlogId).Select(x => new
                {
                    BlogId = x.Key,
                    MaxLikes = x.Max(z => z.LikeCount)
                });

                var query1 = db.Posts.
                    Join(
                        query,
                        (p, b) => p.BlogId == b.BlogId && p.LikeCount == b.MaxLikes,
                        (p, b) => new { PId = p.PostId, b.BlogId },
                        DbJoinType.LeftInner);

fix is in the works

@Shaddix

This comment has been minimized.

Show comment
Hide comment
@Shaddix

Shaddix Jun 30, 2017

Contributor

@ethanli83 could you please help me with this one?
I added a couple of tests to
https://github.com/Shaddix/EFSqlTranslator/blob/ManualJoinOnAggregation/EFSqlTranslator.Tests/TranslatorTests/ManualJoinTranslationTests.cs

and fixed an exception happening when join on aggregate.
I even make these new test pass by commenting lines 45-47 in JoinTranslator.cs, but that's obviously wrong (and it makes the other Manual join test fail).

Could you please help me with this issue?

Contributor

Shaddix commented Jun 30, 2017

@ethanli83 could you please help me with this one?
I added a couple of tests to
https://github.com/Shaddix/EFSqlTranslator/blob/ManualJoinOnAggregation/EFSqlTranslator.Tests/TranslatorTests/ManualJoinTranslationTests.cs

and fixed an exception happening when join on aggregate.
I even make these new test pass by commenting lines 45-47 in JoinTranslator.cs, but that's obviously wrong (and it makes the other Manual join test fail).

Could you please help me with this issue?

@ethanli83

This comment has been minimized.

Show comment
Hide comment
@ethanli83

ethanli83 Jun 30, 2017

Owner

Of course @Shaddix, I will have a look at it.

Owner

ethanli83 commented Jun 30, 2017

Of course @Shaddix, I will have a look at it.

ethanli83 added a commit that referenced this issue Jun 30, 2017

#38 Manual join on aggregates are not supported
 - make sure columns are created using correct ref
@ethanli83

This comment has been minimized.

Show comment
Hide comment
@ethanli83

ethanli83 Jun 30, 2017

Owner

hi @Shaddix,

I have fixed the issue and pushed out a new version 1.2.9. It also contains your pull requests.

Owner

ethanli83 commented Jun 30, 2017

hi @Shaddix,

I have fixed the issue and pushed out a new version 1.2.9. It also contains your pull requests.

@ethanli83 ethanli83 closed this Jun 30, 2017

@Shaddix

This comment has been minimized.

Show comment
Hide comment
@Shaddix

Shaddix Jun 30, 2017

Contributor

thanks a lot!

Contributor

Shaddix commented Jun 30, 2017

thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment