You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #9638, this PR changes the expression system to operate on ValueType instead of ExprType. There should be no side-effects from this change, even though ExprType was missing FLOAT and COMPLEX, because ExprType was typically used to control explicitly supported types and otherwise explode. Input types are currently detected from the type of object when resolving identifiers, so there isn't risk of these unhandled types leaking into the expression system. A method toExpressionType has been added to convert a ValueType into the types which the expression system does understand (float into double, complex into an exception), for the SQL planning layer to use, (this was pushed down from Expressions utility class).
The only strange-ness introduced in this PR is that when implementing expressions we should ignore these unhandled types, but it seems worth it for having a single type system enum to use in all layers, as well as being able to share the utility methods available on ValueType.
This PR has:
been self-reviewed.
added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
Because the expression system doesn't support all of the normal Druid ValueTypes, it might actually be better to keep them separate, since it makes things more type-safe. (We know that if we have an ExprType, then that represents a ValueType that the expression system can handle.)
Because the expression system doesn't support all of the normal Druid ValueTypes, it might actually be better to keep them separate, since it makes things more type-safe. (We know that if we have an ExprType, then that represents a ValueType that the expression system can handle.)
Yeah, I think long term we definitely do want to consolidate these, but maybe I am jumping ahead a bit and we should wait until Expr can handle all ValueType. I will close this PR for now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #9638, this PR changes the expression system to operate on
ValueTypeinstead ofExprType. There should be no side-effects from this change, even thoughExprTypewas missingFLOATandCOMPLEX, becauseExprTypewas typically used to control explicitly supported types and otherwise explode. Input types are currently detected from the type of object when resolving identifiers, so there isn't risk of these unhandled types leaking into the expression system. A methodtoExpressionTypehas been added to convert aValueTypeinto the types which the expression system does understand (float into double, complex into an exception), for the SQL planning layer to use, (this was pushed down fromExpressionsutility class).The only strange-ness introduced in this PR is that when implementing expressions we should ignore these unhandled types, but it seems worth it for having a single type system enum to use in all layers, as well as being able to share the utility methods available on
ValueType.This PR has: