ESQL: Add TO_UPPER and TO_LOWER functions#104309
ESQL: Add TO_UPPER and TO_LOWER functions#104309luigidellaquila merged 6 commits intoelastic:mainfrom
Conversation
|
Documentation preview: |
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
|
Hi @luigidellaquila, I've created a changelog YAML for you. |
bpintea
left a comment
There was a problem hiding this comment.
LGTM, but I think some tests with non-ascii chars would be welcome.
| public ExpressionEvaluator.Factory toEvaluator(Function<Expression, ExpressionEvaluator.Factory> toEvaluator) { | ||
| var fieldEvaluator = toEvaluator.apply(field); | ||
| return new ToLowerEvaluator.Factory(source(), fieldEvaluator, ((EsqlConfiguration) configuration()).locale()); | ||
| // return dvrCtx -> new ToLowerEvaluator(source(), fieldEvaluator.get(dvrCtx), ((EsqlConfiguration) configuration()).locale(), |
There was a problem hiding this comment.
Yes, it's a leftover. Fixing
some tests with non-ascii chars would be welcome.
Adding some
…to esql/to_upper_lower
costin
left a comment
There was a problem hiding this comment.
Left some minor comments - otherwise LGTM
| import static org.elasticsearch.xpack.ql.expression.TypeResolutions.ParamOrdinal.DEFAULT; | ||
| import static org.elasticsearch.xpack.ql.expression.TypeResolutions.isString; | ||
|
|
||
| public class ToLower extends ConfigurationFunction implements EvaluatorMapper { |
There was a problem hiding this comment.
Since this is a unary expression, add a replaceChild() method plus field() method to both classes.
| List<Expression> fields = toLower.children(); | ||
| assert fields.size() == 1; | ||
| out.writeExpression(fields.get(0)); |
There was a problem hiding this comment.
Use toLower/toUpper.field() here instead and drop the assert.
|
|
||
| @Override | ||
| protected Expression build(Source source, List<Expression> args) { | ||
| return new ToLower(source, args.get(0), EsqlTestUtils.configuration("")); |
|
|
||
| import static org.hamcrest.Matchers.equalTo; | ||
|
|
||
| public class ToLowerTests extends AbstractFunctionTestCase { |
There was a problem hiding this comment.
Add some test with random locale as well.
Adding two new string funcitons
Related to: #103599