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

Query: Allow store types and type facets to be set explicitly (EF.StoreType) #4978

Open
smitpatel opened this issue Apr 4, 2016 · 17 comments

Comments

@smitpatel
Copy link
Contributor

#4937 introduced logic to infer Unicode-ness for literals when comparing to column. It works well for simple cases when one side of comparison is ColumnExpression. Though there are complex cases in which we are not inferring the information correctly atm. For e.g.

  1. If one side of binary expression is subquery selecting one element of a column then the other side should have same facets as the column being projected in subquery.
  2. Operators like concat which return string type values should pass uniform information towards parent because the siblings of concat should have same unicode-ness as concat. (See test Non_unicode_string_literals_is_used_for_non_unicode_column_with_concat)

For cases like above, we can improve logic to propagate information. If it is too hard to do then we should add functions like AsUnicode & AsNonUnicode.

@smitpatel
Copy link
Contributor Author

Also cases of SqlFunction like CharIndex (comes from String.Contains method) the argument should have same type mapping. Though That could be different for individual functions.

@ajcvickers ajcvickers changed the title Query: Infer unicode-ness for literals in complex cases Query: Allow type facets to be set explicitly and/or improve inference in complex cases Jun 19, 2017
@ajcvickers
Copy link
Member

ajcvickers commented Jun 19, 2017

Note: when designing/implementing this, consider the case for parameters passed to FromSql, etc. See #8895
Added comment to that issue.

@ajcvickers ajcvickers changed the title Query: Allow type facets to be set explicitly and/or improve inference in complex cases Query: Allow store types and type facets to be set explicitly and/or improve inference in complex cases May 7, 2018
@ajcvickers
Copy link
Member

See also comments in #11921

@ajcvickers
Copy link
Member

See also comments in the thread here: #6717 (comment)

@roji
Copy link
Member

roji commented Aug 2, 2018

Another issue which shows the need for a way to explicitly specify a store type: npgsql/efcore.pg#561.

@smuthuvels
Copy link

smuthuvels commented Aug 16, 2018

I am using EF Core 2.0.3 and I am getting the same issue for Contains search. Do you have any fix for that?

@smitpatel
Copy link
Contributor Author

blocked on #13192

@bricelam
Copy link
Contributor

I added a mechanism for query translators to provide explicit type mappings for function arguments and results in PR #13648. This allows us to fix individual cases.

@bricelam bricelam removed their assignment Oct 17, 2018
@ajcvickers ajcvickers modified the milestones: 3.0.0, Backlog Jan 28, 2019
@smitpatel smitpatel removed the blocked label Jun 6, 2019
@smitpatel smitpatel removed this from the Backlog milestone Jun 6, 2019
@ajcvickers ajcvickers added this to the Backlog milestone Jun 6, 2019
@ajcvickers ajcvickers removed their assignment Jun 6, 2019
@smitpatel smitpatel changed the title Query: Allow store types and type facets to be set explicitly and/or improve inference in complex cases Query: Allow store types and type facets to be set explicitly Nov 13, 2019
@roji
Copy link
Member

roji commented Dec 2, 2019

Another possible need for this: setting facets in order to allow something to participate in a set operation (currently set operations over types with differing facets isn't supported, #19129).

@roji
Copy link
Member

roji commented Nov 5, 2024

Note that this issue has been a bit ambiguous; we can use this issue to track explicitly forcing a type mapping on an arbitrary node, whereas #35045 is about adding an actual CAST() node into SQL.

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

7 participants