-
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
Check arity consistency when constructing SqlFunctionExpression
s
#33815
Conversation
I believe that the commit fixing the translation of
|
I don't think that creating them inconsistently would be considered valid case. It is a breaking change, but with pretty limited blast radius.
Seems valid to me. |
It is a breaking change. While we already rely on the assumption that arguments and propagates nullability information tables are in sync, those were only being used when processing IS NULL/IS NOT NULL expressions. With this change (and nullability computation work in #33814) more people get affected. However, I agree with @cincuranet that the impact is relatively small. One thing to note, argument propagates nullability is somewhat complicated concept - some users may not fully understand it and as such leave the array empty (and hey, it happened to have worked! ;) ) - Perhaps it's beneficial for the exception message to provide some guidance - as in, if not sure use "false", or (in the future) link to a documentation section, once we have it. |
wrt exception type, I also like InvalidOperationException better, EF tends to favor it for almost all errors we issue. |
b0429e2
to
739bde5
Compare
The Sqlite translation of `random()` was creating an expression in which a `SqlFunction` was defined to have 1 argument, but had an empty `argumentsPropagateNullability` parameter.
I switched the exception type to |
Looks like we have 2 (strongly related :)) failures:
|
ouch, sorry, I did not notice that locally I was not running with |
If its 2-arguments form is being used, the `argumentsPropagateNullability` should have 2 elements as well.
side note: in addition to the arity mismatches there seem to be some inconsistency in the nullability configuration in the codebase. |
Agreed. |
Thanks for the contribution. |
thank you for your patience and for guiding me :) |
It is currently possible to construct
SqlFunctionExpression
s in which the size ofarguments
does not match the size ofargumentsPropagateNullability
.While this is definitely a problem of mis-using the API, it is both easy to trip in it (in fact there is an occurrence of such problem in the repo 😅 ) and easy for EFCore to provide better feedback when this happens.
Discovered while working on #33814