Repository navigation
Fix binning udf resolution / Add type coercion support for binning UDFs - #4742
Conversation
1adc46f to
2c662ed
Compare
|
@ahkcs CI is failing. I retried but still failed. Could you double check? |
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
3ae31ab to
a93dcf8
Compare
Unit tests passed after rebase |
Signed-off-by: Kai Huang <[email protected]>
c2d3dd0 to
d0ddb19
Compare
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
| Example 20: Type coercion with string fields | ||
| ============================================== | ||
|
|
||
| The ``bin`` command automatically converts string fields containing valid numeric values to numeric types, enabling binning operations on keyword/text fields. Only strings that represent valid numbers (e.g., "25", "30.5", "100") are supported. Non-numeric strings will cause an error. |
There was a problem hiding this comment.
Updated to remove comments
| bin <field> [span=<interval>] [minspan=<interval>] [bins=<count>] [aligntime=(earliest | latest | <time-specifier>)] [start=<value>] [end=<value>] | ||
|
|
||
| * field: mandatory. The numeric field to bin. | ||
| * field: mandatory. The field to bin. Accepts numeric fields, time-based fields, or string fields containing valid numeric values (e.g., "25", "30.5"). String fields with numeric values are automatically coerced to numeric type. Non-numeric strings will result in an error. |
There was a problem hiding this comment.
I suggest remove this section.
Type conversion is a generic feature applied across all commands and functions, so it does not need to be explicitly mentioned in each one.
Additionally, enabling binning operations should target string-type fields, not keyword or text fields specifically.
There was a problem hiding this comment.
Updated to remove this section
| throw new IllegalArgumentException( | ||
| "Cannot apply binning: field contains non-numeric string values. " | ||
| + "Only numeric types or string types with valid numeric values are supported."); |
There was a problem hiding this comment.
It should return a null value. For example, if only one document contains an invalid field, the entire query should not fail.
There was a problem hiding this comment.
I think it makes sense, I have updated to remove the validation logic. I kept the validation logic in BinnableField to only verify if it's supported type(Reject truly unsupported types (e.g., BOOLEAN, ARRAY, MAP))
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
…Fs (#4742) * Fix binning udf resolution Signed-off-by: Kai Huang <[email protected]> * spotless fix Signed-off-by: Kai Huang <[email protected]> * update tes Signed-off-by: Kai Huang <[email protected]> * add comments Signed-off-by: Kai Huang <[email protected]> * removal Signed-off-by: Kai Huang <[email protected]> * update yaml test Signed-off-by: Kai Huang <[email protected]> * rerun Signed-off-by: Kai Huang <[email protected]> * update support for type coercion Signed-off-by: Kai Huang <[email protected]> * update doc Signed-off-by: Kai Huang <[email protected]> * enhance error handling and doc Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * Fix tests Signed-off-by: Kai Huang <[email protected]> --------- Signed-off-by: Kai Huang <[email protected]> (cherry picked from commit 20f2234) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…Fs (opensearch-project#4742) * Fix binning udf resolution Signed-off-by: Kai Huang <[email protected]> * spotless fix Signed-off-by: Kai Huang <[email protected]> * update tes Signed-off-by: Kai Huang <[email protected]> * add comments Signed-off-by: Kai Huang <[email protected]> * removal Signed-off-by: Kai Huang <[email protected]> * update yaml test Signed-off-by: Kai Huang <[email protected]> * rerun Signed-off-by: Kai Huang <[email protected]> * update support for type coercion Signed-off-by: Kai Huang <[email protected]> * update doc Signed-off-by: Kai Huang <[email protected]> * enhance error handling and doc Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * fixes Signed-off-by: Kai Huang <[email protected]> * Fix tests Signed-off-by: Kai Huang <[email protected]> --------- Signed-off-by: Kai Huang <[email protected]>
Description
Fixes #4740 - Binning UDFs are now resolved through
PPLFuncImpTable.resolve()instead of being instantiated directly viamakeCall().Implemented automatic type coercion to allow string fields with numeric values to work seamlessly with all binning operations (bins, span, minspan, range).
Related Issues
PPLFuncImpTable#4740Type coercion support for binning UDFs #4356