-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Feature/translate json functions #29306 #30010
base: main
Are you sure you want to change the base?
Feature/translate json functions #29306 #30010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR - it's a good start, see comments below.
Note that there are some other JSON functions supported by SQL Server (ISJSON, JSON_ARRAY, JSON_OBJECT...). Ideally we'd have translations for all of them (and the relevant SQLite ones as well); of course you don't have to do that in this PR, but if you feel like working on those that would be great.
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Query/Internal/SqliteJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Query/Internal/SqliteJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Query/Internal/SqliteJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some changes now. And think I got them all covered. But little bit uncertain about the propagation of null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelmandell sorry, it's taking long for me to get around to this, here are some comments. Please rebase this PR on the latest main and check out any test failures after that.
src/EFCore.SqlServer/Query/Internal/SqlServerJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Query/Internal/SqlServerJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Query/Internal/SqlServerJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Query/Internal/SqlServerJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Query/Internal/SqlServerJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Sqlite.Core/Query/Internal/SqliteJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore.TestModels.JsonQuery; | ||
public class JsonEntityBasicString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to add this rather than simply using JsonEntityBasic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonEntityBasic has mappings of the columns to classes, and this works only for strings If I understand it correctly.
test/EFCore.Sqlite.FunctionalTests/Query/JsonFunctionSqliteTest.cs
Outdated
Show resolved
Hide resolved
json_value in differents rdbms: mysql: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=591207ceddca6fe4f11a3ad8589e7c5b |
@roji I know I was late to the party and missed to tag you in to this before feature freeze for 8.0... Do you have any advice or comments on how I can move forward with this one to perhaps get it ready for 9.0? I can as well look into the other requests for json functions if possible. |
@joelmandell sure thing - I'd also definitely like us to get this in for 9.0. Here's my advice... Give us around a month, maybe a bit more to deal with the 8.0 release and the subsequent patching and other work - and then ping me here again. Assuming it's a good time to iterate on it, you can then rebase this PR on the latest main, and then we can get this to completed state and merge. |
/// </summary> | ||
public SqlExpression? Translate( | ||
SqlExpression? instance, | ||
MethodInfo method, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must resolve conflict
Ping @roji. I do not know if it is to early to continue on this one now? :) |
ee39973
to
354a9df
Compare
@joelmandell I'm looking at this PR again (sorry for all the breaks and pauses). Since there was previously some problematic merge commit which messed up the entire history, I've squashed everything cleanly rebased on top of the latest main. In the interest of finally getting moving quickly and finally getting this merge, I'll do whatever fixup is still necessary and push commits on this PR. |
@roji Sounds good. Thx |
Fixes #29306