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
SQL: Fix issue with common type resolution #46565
Conversation
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for <float> + <double> the common type which is set as the return type of the + operation is double. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: elastic#46551
Pinging @elastic/es-search |
@elasticmachine run elasticsearch-ci/2 |
@@ -50,6 +51,12 @@ public static DataType commonType(DataType left, DataType right) { | |||
if (DataTypes.isNull(right)) { | |||
return left; | |||
} | |||
if (left.isString() && right.isString()) { | |||
if (left == TEXT) { |
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.
Why TEXT
and not KEYWORD
?
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.
Thought that TEXT is "larger" as double > float, and TEXT is better to be exposed in case the function is used somewhere that we need to check for exact/inexact.
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.
LGTM but left one comment.
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.
LGTM
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: #46551 (cherry picked from commit 291017d)
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: #46551 (cherry picked from commit 291017d)
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: #46551 (cherry picked from commit 291017d)
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: #46551 (cherry picked from commit 291017d)
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: elastic#46551
Many scalar functions try to find out the common type between their arguments in order to set it as their return time, e.g.: for `float + double` the common type which is set as the return type of the + operation is `double`. Previously, for data types TEXT and KEYWORD (string data types) there was no common data type found and null was returned causing NPEs when the function was trying to resolve the return data type. Fixes: elastic#46551
Many scalar functions try to find out the common type between their
arguments in order to set it as their return time, e.g.:
for + the common type which is set as the return type
of the + operation is double.
Previously, for data types TEXT and KEYWORD (string data types) there
was no common data type found and null was returned causing NPEs when
the function was trying to resolve the return data type.
Fixes: #46551