mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ES|QL] Update function metadata (#189857)
This PR updates the function definitions and inline docs based on the latest metadata from Elasticsearch. --------- Co-authored-by: Quynh Nguyen <quynh.nguyen@elastic.co>
This commit is contained in:
parent
a9d954e55e
commit
a3e9c0a52f
5 changed files with 3308 additions and 4 deletions
|
@ -61,7 +61,7 @@ const validateLogFunctions = `(fnDef: ESQLFunction) => {
|
|||
// do not really care here about the base and field
|
||||
// just need to check both values are not negative
|
||||
for (const arg of fnDef.args) {
|
||||
if (isLiteralItem(arg) && arg.value < 0) {
|
||||
if (isLiteralItem(arg) && Number(arg.value) < 0) {
|
||||
messages.push({
|
||||
type: 'warning' as const,
|
||||
code: 'logOfNegativeValue',
|
||||
|
@ -213,12 +213,14 @@ const functionEnrichments: Record<string, RecursivePartial<FunctionDefinition>>
|
|||
],
|
||||
},
|
||||
mv_sort: {
|
||||
signatures: new Array(6).fill({
|
||||
signatures: new Array(9).fill({
|
||||
params: [{}, { literalOptions: ['asc', 'desc'] }],
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
const convertDateTime = (s: string) => (s === 'datetime' ? 'date' : s);
|
||||
|
||||
/**
|
||||
* Builds a function definition object from a row of the "meta functions" table
|
||||
* @param {Array<any>} value — the row of the "meta functions" table, corresponding to a single function definition
|
||||
|
@ -239,10 +241,10 @@ function getFunctionDefinition(ESFunctionDefinition: Record<string, any>): Funct
|
|||
...signature,
|
||||
params: signature.params.map((param: any) => ({
|
||||
...param,
|
||||
type: param.type,
|
||||
type: convertDateTime(param.type),
|
||||
description: undefined,
|
||||
})),
|
||||
returnType: signature.returnType,
|
||||
returnType: convertDateTime(signature.returnType),
|
||||
variadic: undefined, // we don't support variadic property
|
||||
minParams: signature.variadic
|
||||
? signature.params.filter((param: any) => !param.optional).length
|
||||
|
|
|
@ -1559,6 +1559,36 @@ const endsWithDefinition: FunctionDefinition = {
|
|||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
name: 'str',
|
||||
type: 'keyword',
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
name: 'suffix',
|
||||
type: 'text',
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
name: 'str',
|
||||
type: 'text',
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
name: 'suffix',
|
||||
type: 'keyword',
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
|
@ -4115,6 +4145,43 @@ const mvMinDefinition: FunctionDefinition = {
|
|||
],
|
||||
};
|
||||
|
||||
// Do not edit this manually... generated by scripts/generate_function_definitions.ts
|
||||
const mvPseriesWeightedSumDefinition: FunctionDefinition = {
|
||||
type: 'eval',
|
||||
name: 'mv_pseries_weighted_sum',
|
||||
description: i18n.translate(
|
||||
'kbn-esql-validation-autocomplete.esql.definitions.mv_pseries_weighted_sum',
|
||||
{
|
||||
defaultMessage:
|
||||
'Converts a multivalued expression into a single-valued column by multiplying every element on the input list by its corresponding term in P-Series and computing the sum.',
|
||||
}
|
||||
),
|
||||
alias: undefined,
|
||||
signatures: [
|
||||
{
|
||||
params: [
|
||||
{
|
||||
name: 'number',
|
||||
type: 'double',
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
name: 'p',
|
||||
type: 'double',
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
returnType: 'double',
|
||||
},
|
||||
],
|
||||
supportedCommands: ['stats', 'metrics', 'eval', 'where', 'row', 'sort'],
|
||||
supportedOptions: ['by'],
|
||||
validate: undefined,
|
||||
examples: [
|
||||
'ROW a = [70.0, 45.0, 21.0, 21.0, 21.0]\n| EVAL sum = MV_PSERIES_WEIGHTED_SUM(a, 1.5)\n| KEEP sum',
|
||||
],
|
||||
};
|
||||
|
||||
// Do not edit this manually... generated by scripts/generate_function_definitions.ts
|
||||
const mvSliceDefinition: FunctionDefinition = {
|
||||
type: 'eval',
|
||||
|
@ -6575,6 +6642,36 @@ const startsWithDefinition: FunctionDefinition = {
|
|||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
name: 'str',
|
||||
type: 'keyword',
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
name: 'prefix',
|
||||
type: 'text',
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
name: 'str',
|
||||
type: 'text',
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
name: 'prefix',
|
||||
type: 'keyword',
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
returnType: 'boolean',
|
||||
},
|
||||
{
|
||||
params: [
|
||||
{
|
||||
|
@ -8226,6 +8323,7 @@ export const evalFunctionDefinitions = [
|
|||
mvMaxDefinition,
|
||||
mvMedianDefinition,
|
||||
mvMinDefinition,
|
||||
mvPseriesWeightedSumDefinition,
|
||||
mvSliceDefinition,
|
||||
mvSortDefinition,
|
||||
mvSumDefinition,
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -2176,6 +2176,40 @@ export const functions = {
|
|||
ROW a=[2, 1]
|
||||
| EVAL min_a = MV_MIN(a)
|
||||
\`\`\`
|
||||
`,
|
||||
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(
|
||||
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mv_pseries_weighted_sum',
|
||||
{
|
||||
defaultMessage: 'MV_PSERIES_WEIGHTED_SUM',
|
||||
}
|
||||
),
|
||||
description: (
|
||||
<Markdown
|
||||
markdownContent={i18n.translate(
|
||||
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mv_pseries_weighted_sum.markdown',
|
||||
{
|
||||
defaultMessage: `<!--
|
||||
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
|
||||
-->
|
||||
|
||||
### MV_PSERIES_WEIGHTED_SUM
|
||||
Converts a multivalued expression into a single-valued column by multiplying every element on the input list by its corresponding term in P-Series and computing the sum.
|
||||
|
||||
\`\`\`
|
||||
ROW a = [70.0, 45.0, 21.0, 21.0, 21.0]
|
||||
| EVAL sum = MV_PSERIES_WEIGHTED_SUM(a, 1.5)
|
||||
| KEEP sum
|
||||
\`\`\`
|
||||
`,
|
||||
description:
|
||||
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue