Skip to content

Commit

Permalink
[ES|QL] Update function metadata (elastic#194371)
Browse files Browse the repository at this point in the history
This PR updates the function definitions and inline docs based on the
latest metadata from Elasticsearch.

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
  • Loading branch information
2 people authored and angorayc committed Oct 1, 2024
1 parent dfd2a60 commit 7d0f5b7
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ const topDefinition: FunctionDefinition = {
params: [
{
name: 'field',
type: 'long',
type: 'keyword',
optional: false,
},
{
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,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)',
],
};

Expand Down Expand Up @@ -7443,6 +7443,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',
Expand Down Expand Up @@ -8777,6 +8792,7 @@ export const scalarFunctionDefinitions = [
toBooleanDefinition,
toCartesianpointDefinition,
toCartesianshapeDefinition,
toDateNanosDefinition,
toDateperiodDefinition,
toDatetimeDefinition,
toDegreesDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,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:
Expand Down Expand Up @@ -1190,7 +1190,7 @@ export const functions = {
-->
### MV_AVG
Converts a multivalued field into a single valued field containing the average of all the values.
Converts a multivalued field into a single valued field containing the average of all of the values.
\`\`\`
ROW a=[3, 5, 1, 6]
Expand Down Expand Up @@ -1676,7 +1676,7 @@ export const functions = {
-->
### MV_SUM
Converts a multivalued field into a single valued field containing the sum of all the values.
Converts a multivalued field into a single valued field containing the sum of all of the values.
\`\`\`
ROW a=[3, 5, 6]
Expand Down Expand Up @@ -2743,6 +2743,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: (
<Markdown
openLinksInNewTab
readOnly
enableSoftLineBreaks
markdownContent={i18n.translate(
'languageDocumentation.documentationESQL.to_date_nanos.markdown',
{
defaultMessage: `<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->
### 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)',
Expand Down

0 comments on commit 7d0f5b7

Please sign in to comment.