-
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
Query: revisit extensibility of null semantics visitor #20204
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
Comments
From API review to keep in mind
|
smitpatel
added a commit
that referenced
this issue
May 6, 2020
Resolves #20204 For table sources, there is no concept of nullability - `Process(TableExpressionBase)` which works as dispatcher. - `Process(SelectExpression)` as a special case to avoid casting. - No additional methods for individual table sources. For SQL expressions, - `Process(SqlExpression, out bool nullable)` which defaults allowOptimizedExpansion to false. - `Process(SqlExpression, allowOptimizedExpansion, out bool nullable)` which works as dispatcher. - Individual Process* methods to change bahavior of any particular SqlExpression. Notes: - Each individual SQLExpression processes it's children with appropriately set allowOptimizedExpansion flag. It collects nullable flag for all children and return nullable for itself through out parameter. - NonNullableColumns are being used only in 2 places and both usages are different. Rather than crystal balling an API to expose it, we should just keep it private till a provider asks for it then we can discuss with provider writer what information is needed and how would they like it. Making it private does not cause any bug, may just miss an optimization in SQL. - The processor does not derive from ExpressionVisitor anymore. It has ExpressionVisitor like dispatch system but non Visit API. - Since it is not deriving from SqlExpressionVisitor there is no longer abstract method to force implementing for new SqlExpression type. Hence unknown expression type throws exception. Making it pass through could cause incorrect result as we don't visit custom expression's components. - Added DoNotCache method rather than exposing _canCache. - Changed API about returning tuple for caching to an out parameter. TODO: Once API is approved, I will add XML docs.
smitpatel
added
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
and removed
needs-design
labels
May 6, 2020
smitpatel
added a commit
that referenced
this issue
May 7, 2020
Resolves #20204 For table sources, there is no concept of nullability - `Process(TableExpressionBase)` which works as dispatcher. - `Process(SelectExpression)` as a special case to avoid casting. - No additional methods for individual table sources. For SQL expressions, - `Process(SqlExpression, out bool nullable)` which defaults allowOptimizedExpansion to false. - `Process(SqlExpression, allowOptimizedExpansion, out bool nullable)` which works as dispatcher. - Individual Process* methods to change bahavior of any particular SqlExpression. Notes: - Each individual SQLExpression processes it's children with appropriately set allowOptimizedExpansion flag. It collects nullable flag for all children and return nullable for itself through out parameter. - NonNullableColumns are being used only in 2 places and both usages are different. Rather than crystal balling an API to expose it, we should just keep it private till a provider asks for it then we can discuss with provider writer what information is needed and how would they like it. Making it private does not cause any bug, may just miss an optimization in SQL. - The processor does not derive from ExpressionVisitor anymore. It has ExpressionVisitor like dispatch system but non Visit API. - Since it is not deriving from SqlExpressionVisitor there is no longer abstract method to force implementing for new SqlExpression type. Hence unknown expression type throws exception. Making it pass through could cause incorrect result as we don't visit custom expression's components. - Added DoNotCache method rather than exposing _canCache. - Changed API about returning tuple for caching to an out parameter. TODO: Once API is approved, I will add XML docs.
smitpatel
added a commit
that referenced
this issue
May 7, 2020
Resolves #20204 For table sources, there is no concept of nullability - `Visit(TableExpressionBase)` which works as dispatcher. - `Visit(SelectExpression)` as a special case to avoid casting and allow easy overriding. - No additional methods for individual table sources. For SQL expressions, - `Visit(SqlExpression, out bool nullable)` which defaults allowOptimizedExpansion to false. - `Visit(SqlExpression, allowOptimizedExpansion, out bool nullable)` which works as dispatcher. - Individual Visit* methods to change bahavior of any particular SqlExpression. Notes: - Each individual SQLExpression processes it's children with appropriately set allowOptimizedExpansion flag. It collects nullable flag for all children and return nullable for itself through out parameter. - NonNullableColumns are being used only in 2 places and both usages are different. Rather than crystal balling an API to expose it, we should just keep it private till a provider asks for it then we can discuss with provider writer what information is needed and how would they like it. Making it private does not cause any bug, may just miss an optimization in SQL. - Added AddNonNullableColumn API for providers to add aditional column to the list. - The processor does not derive from ExpressionVisitor anymore. It has ExpressionVisitor like dispatch system and API. - Since it is not deriving from SqlExpressionVisitor there is no longer abstract method to force implementing for new SqlExpression type. Hence unknown expression type throws exception. Making it pass through could cause incorrect result as we don't visit custom expression's components. - Added `VisitCustomSqlExpression` method to allow providers to add logic for custom functions without having to deal with non-nullable column reset. - Added DoNotCache method rather than exposing _canCache. - Changed API about returning tuple for caching to an out parameter.
smitpatel
added a commit
that referenced
this issue
May 7, 2020
Resolves #20204 For table sources, there is no concept of nullability - `Visit(TableExpressionBase)` which works as dispatcher. - `Visit(SelectExpression)` as a special case to avoid casting and allow easy overriding. - No additional methods for individual table sources. For SQL expressions, - `Visit(SqlExpression, out bool nullable)` which defaults allowOptimizedExpansion to false. - `Visit(SqlExpression, allowOptimizedExpansion, out bool nullable)` which works as dispatcher. - Individual Visit* methods to change bahavior of any particular SqlExpression. Notes: - Each individual SQLExpression processes it's children with appropriately set allowOptimizedExpansion flag. It collects nullable flag for all children and return nullable for itself through out parameter. - NonNullableColumns are being used only in 2 places and both usages are different. Rather than crystal balling an API to expose it, we should just keep it private till a provider asks for it then we can discuss with provider writer what information is needed and how would they like it. Making it private does not cause any bug, may just miss an optimization in SQL. - Added AddNonNullableColumn API for providers to add aditional column to the list. - The processor does not derive from ExpressionVisitor anymore. It has ExpressionVisitor like dispatch system and API. - Since it is not deriving from SqlExpressionVisitor there is no longer abstract method to force implementing for new SqlExpression type. Hence unknown expression type throws exception. Making it pass through could cause incorrect result as we don't visit custom expression's components. - Added `VisitCustomSqlExpression` method to allow providers to add logic for custom functions without having to deal with non-nullable column reset. - Added DoNotCache method rather than exposing _canCache. - Changed API about returning tuple for caching to an out parameter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Currently null semantics visitor has extensibility point to handle provider specific nodes (via VisitInternal), but we don't have good way to custom handling of existing sql expression nodes (e.g. some specific SqlFunctions in postgresql. We should consider if nullable property should be protected rather than public etc.
The text was updated successfully, but these errors were encountered: