[ES|QL] Add support for mv_first, mv_last, to_geoshape, to_cartesianshape (#175518)

## Summary

Add missing functions to ES|QL validation/autocomplete support.


### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Marco Liberati 2024-01-25 18:00:23 +01:00 committed by GitHub
parent 2970f75d73
commit 9c0c22db96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -267,6 +267,19 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
},
],
},
{
name: 'to_cartesianshape',
description: i18n.translate('monaco.esql.definitions.toCartesianshapeDoc', {
defaultMessage: 'Converts an input value to a cartesian_shape value.',
}),
signatures: [
{
params: [{ name: 'field', type: 'any' }],
returnType: 'cartesian_shape',
examples: [`from index | EVAL cartesianshape = to_cartesianshape(field)`],
},
],
},
{
name: 'to_datetime',
alias: ['to_dt'],
@ -321,6 +334,19 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
},
],
},
{
name: 'to_geoshape',
description: i18n.translate('monaco.esql.definitions.toGeoshapeDoc', {
defaultMessage: 'Converts an input value to a geo_shape value.',
}),
signatures: [
{
params: [{ name: 'field', type: 'any' }],
returnType: 'geo_shape',
examples: [`from index | EVAL geoshape = to_geoshape(field)`],
},
],
},
{
name: 'to_integer',
alias: ['to_int'],
@ -849,7 +875,7 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
{
params: [{ name: 'multivalue', type: 'number[]' }],
returnType: 'number',
examples: ['row a = [1, 2, 3] | mv_avg(a)'],
examples: ['row a = [1, 2, 3] | eval mv_avg(a)'],
},
],
},
@ -866,7 +892,7 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
{ name: 'delimeter', type: 'string' },
],
returnType: 'string',
examples: ['row a = ["1", "2", "3"] | mv_concat(a, ", ")'],
examples: ['row a = ["1", "2", "3"] | eval mv_concat(a, ", ")'],
},
],
},
@ -897,6 +923,34 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
},
],
},
{
name: 'mv_first',
description: i18n.translate('monaco.esql.definitions.mvFirstDoc', {
defaultMessage:
'Reduce a multivalued field to a single valued field containing the first value.',
}),
signatures: [
{
params: [{ name: 'multivalue', type: 'any' }],
returnType: 'any',
examples: ['row a = [1, 2, 3] | eval one = mv_first(a)'],
},
],
},
{
name: 'mv_last',
description: i18n.translate('monaco.esql.definitions.mvLastDoc', {
defaultMessage:
'Reduce a multivalued field to a single valued field containing the last value.',
}),
signatures: [
{
params: [{ name: 'multivalue', type: 'any' }],
returnType: 'any',
examples: ['row a = [1, 2, 3] | eval three = mv_last(a)'],
},
],
},
{
name: 'mv_max',
description: i18n.translate('monaco.esql.definitions.mvMaxDoc', {