From 4e2c656771ac126b3d9bfd95409263063ef3e772 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:30:44 +1000 Subject: [PATCH] [8.x] [ES|QL] Update function metadata (#194371) (#194377) # Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Update function metadata (#194371)](https://github.com/elastic/kibana/pull/194371) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../generated/aggregation_functions.ts | 42 ++++++++++++++++++- .../definitions/generated/scalar_functions.ts | 18 +++++++- .../sections/generated/scalar_functions.tsx | 32 +++++++++++++- 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts index 210eec36811de..28b4cd4f66443 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts @@ -1434,7 +1434,7 @@ const topDefinition: FunctionDefinition = { params: [ { name: 'field', - type: 'long', + type: 'keyword', optional: false, }, { @@ -1451,8 +1451,48 @@ const topDefinition: FunctionDefinition = { acceptedValues: ['asc', 'desc'], }, ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'field', + type: 'long', + optional: false, + }, + { + name: 'limit', + type: 'integer', + optional: false, + }, + { + name: 'order', + type: 'keyword', + optional: false, + }, + ], returnType: 'long', }, + { + params: [ + { + name: 'field', + type: 'text', + optional: false, + }, + { + name: 'limit', + type: 'integer', + optional: false, + }, + { + name: 'order', + type: 'keyword', + optional: false, + }, + ], + returnType: 'text', + }, ], supportedCommands: ['stats', 'inlinestats', 'metrics'], supportedOptions: undefined, diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts index 3f5718b5417ba..b8d2b9857caf2 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts @@ -1384,7 +1384,7 @@ const dateFormatDefinition: FunctionDefinition = { supportedOptions: ['by'], validate: undefined, examples: [ - 'FROM employees\n| KEEP first_name, last_name, hire_date\n| EVAL hired = DATE_FORMAT("YYYY-MM-dd", hire_date)', + 'FROM employees\n| KEEP first_name, last_name, hire_date\n| EVAL hired = DATE_FORMAT("yyyy-MM-dd", hire_date)', ], }; @@ -7367,6 +7367,21 @@ const toCartesianshapeDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const toDateNanosDefinition: FunctionDefinition = { + type: 'eval', + name: 'to_date_nanos', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_date_nanos', { + defaultMessage: 'Converts an input to a nanosecond-resolution date value (aka date_nanos).', + }), + alias: undefined, + signatures: [], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const toDateperiodDefinition: FunctionDefinition = { type: 'eval', @@ -8699,6 +8714,7 @@ export const scalarFunctionDefinitions = [ toBooleanDefinition, toCartesianpointDefinition, toCartesianshapeDefinition, + toDateNanosDefinition, toDateperiodDefinition, toDatetimeDefinition, toDegreesDefinition, diff --git a/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx b/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx index 7f736000f0365..7cda59ef0db1c 100644 --- a/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx +++ b/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx @@ -568,7 +568,7 @@ export const functions = { \`\`\` FROM employees | KEEP first_name, last_name, hire_date - | EVAL hired = DATE_FORMAT("YYYY-MM-dd", hire_date) + | EVAL hired = DATE_FORMAT("yyyy-MM-dd", hire_date) \`\`\` `, description: @@ -2681,6 +2681,36 @@ export const functions = { | MV_EXPAND wkt | EVAL geom = TO_CARTESIANSHAPE(wkt) \`\`\` + `, + description: + 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', + ignoreTag: true, + } + )} + /> + ), + }, + // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.to_date_nanos', { + defaultMessage: 'TO_DATE_NANOS', + }), + description: ( + + + ### TO_DATE_NANOS + Converts an input to a nanosecond-resolution date value (aka date_nanos). + + Note: The range for date nanos is 1970-01-01T00:00:00.000000000Z to 2262-04-11T23:47:16.854775807Z. Additionally, integers cannot be converted into date nanos, as the range of integer nanoseconds only covers about 2 seconds after epoch. `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',