-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[ESQL] Greatest and Least can fail with Illegal Data Type on types that resolved correctly #114036
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
Comments
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Hi @not-napoleon Can I take this on?:) |
Hi @not-napoleon @alex-spies , Is this issue still relevant? If it hasn't been picked up by someone else, I would be happy to work on it. |
Hi, are someone currently working on this, I would love to be assigned for this one |
Hi @not-napoleon, I am taking on this issue. |
Hi, @not-napoleon. @BinhMike. |
This commit refactors the Greatest function to use an evaluator map for better code organization. The changes include: - Added EVALUATOR_MAP for evaluator factory mapping - Updated toEvaluator to use map-based lookup - Added NULL type validation - Updated error messages to use getWriteableName() The refactoring improves code readability and maintainability by: - Replacing if-else chains with a map-based lookup - Centralizing evaluator factory creation - Adding consistent NULL type validation - Using getWriteableName() for error messages Relates to elastic#114036
This commit refactors the Least function to use an evaluator map for better code organization. The changes include: - Added EVALUATOR_MAP for evaluator factory mapping - Updated toEvaluator to use map-based lookup - Added NULL type validation - Updated error messages to use getWriteableName() The refactoring improves code readability and maintainability by: - Replacing if-else chains with a map-based lookup - Centralizing evaluator factory creation - Adding consistent NULL type validation - Using getWriteableName() for error messages Relates to elastic#114036
This commit adds test cases for both Greatest and Least functions to verify: - All supported data types (boolean, double, integer, long, keyword, text, version, ip, datetime, date_nanos) - NULL value handling - String comparisons - Numeric comparisons - Boolean operations - Date/time comparisons The tests ensure that: - Both functions handle NULL values correctly - Type validation works as expected - Evaluator selection is correct for each data type - Results are computed correctly for all supported types Relates to elastic#114036
I've created a PR to refactor the Greatest and Least functions to use an evaluator map: #128429 The changes include:
PTAL when you have time. Thanks! |
Related to #113961
resolveType
for Greatest and Least only checks that all the input data types are the same (or null). ThetoEvaluator
function, however, has an explicit list of types it maps to evaluators, and if a type does not match we throw from there. Personally, I recommend a strategy like we used in the binary comparisons, where we have a map from data types to evaluators, and resolve types by checking if they are keys in the map. There are probably other solutions as well. The goal is thatresolveType
should be consistent withtoEvaluator
with regard to type support.The text was updated successfully, but these errors were encountered: