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

Join on OpenJson primitive collections #32407

Closed
erwan-joly opened this issue Nov 24, 2023 · 3 comments
Closed

Join on OpenJson primitive collections #32407

erwan-joly opened this issue Nov 24, 2023 · 3 comments

Comments

@erwan-joly
Copy link

erwan-joly commented Nov 24, 2023

Ask a question

Not sure if this is a bug or a misunderstanding on what @roji meant here #13239 (comment)

After upgrading to dotnet 8 we still can't join primitive collection https://github.com/erwan-joly/EFBugRepro
Is it something currently supported ? My understanding is that dotnet 8 is supposed to bring the support for this ?
#13239 (comment)
#13239 (comment)

My goal here is to get rid of EntityFramework.MemoryJoin https://github.com/neisbut/EntityFramework.MemoryJoin If the issue here is that the list is not IQueryable is there anyway to tell EF that this list is IQueryable so it convert it to openjson ?

Include your code

https://github.com/erwan-joly/EFBugRepro

Include stack traces

System.InvalidOperationException: 'The LINQ expression 'DbSet<TestEntity>()
    .Join(
        inner: __p_0, 
        outerKeySelector: t => (object)t.DateTime, 
        innerKeySelector: e => (object)e.DateTime, 
        resultSelector: (t, e) => new TransparentIdentifier<TestEntity, MyClass>(
            Outer = t, 
            Inner = e
        ))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'

Include provider and version information

EF Core version: 8
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer): Microsoft.EntityFrameworkCore.SqlServer and Npgsql
Target framework: (e.g. .NET 6.0): dotnet 8
Operating system: windows 11
IDE: (e.g. Visual Studio 2022 17.4) Visual studio 2022 Version 17.8.0

@erwan-joly erwan-joly changed the title Join on OpenJson Join on OpenJson primitive collections Nov 24, 2023
@roji
Copy link
Member

roji commented Nov 26, 2023

Duplicate of #31237

@roji roji marked this as a duplicate of #31237 Nov 26, 2023
@roji
Copy link
Member

roji commented Nov 26, 2023

@erwan-joly what you're attempting here is a join over a non-primitive collection:

var list = new MyClass[]
{
    new MyClass(),
    new MyClass()
    {
        MyClassId = 2
    }
};

var result = context.TestEntities.Join(list,
    x => x.DateTime,
    x => x.DateTime,
    (x, y) => new { x, y })
    .ToList();

That's not yet supported - it's tracked by #31237. That's a highly-voted issue, so hopefully this is something we'll be able to deliver for 9.0.

@erwan-joly
Copy link
Author

Thanks then I’ll close as duplicate

@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants