-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ES|QL] Add automated script to sync operators and add support for MATCH operators #205565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
f8e9e16
ccb590e
0918b0a
6a7cdde
41f7ea3
4f1e647
ebf0211
4f6c9e9
de6225e
6a8113b
44749aa
860878e
6b5c866
28388a6
1610c0a
847457d
acc0e79
0f2776e
93d1853
3073872
599994b
8bec12f
261a7ac
b70a626
c4b47fd
6a00df6
4e2bcd9
27d36cd
e144c1a
951f39a
a6fd992
73dd937
f4b4229
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| import { i18n } from '@kbn/i18n'; | ||
| import { ESQL_NUMBER_TYPES, isNumericType } from '../shared/esql_types'; | ||
| import type { FunctionDefinition, FunctionParameterType, FunctionReturnType } from './types'; | ||
|
|
||
| import { operatorsFunctionDefinitions } from './generated/operators'; | ||
| type MathFunctionSignature = [FunctionParameterType, FunctionParameterType, FunctionReturnType]; | ||
|
|
||
| function createMathDefinition( | ||
|
|
@@ -384,7 +384,7 @@ export const comparisonFunctions: FunctionDefinition[] = [ | |
| }, | ||
| ].map((op): FunctionDefinition => createComparisonDefinition(op)); | ||
|
|
||
| const likeFunctions: FunctionDefinition[] = [ | ||
| const notLikeFunctions: FunctionDefinition[] = [ | ||
|
||
| // Skip the insensitive case equality until it gets restored back | ||
| // new special comparison operator for strings only | ||
| // { | ||
|
|
@@ -393,24 +393,12 @@ const likeFunctions: FunctionDefinition[] = [ | |
| // defaultMessage: 'Case insensitive equality', | ||
| // }), | ||
| // }, | ||
| { | ||
| name: 'like', | ||
| description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.likeDoc', { | ||
| defaultMessage: 'Filter data based on string patterns', | ||
| }), | ||
| }, | ||
| { name: 'not_like', description: '' }, | ||
| { | ||
| name: 'rlike', | ||
| description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.rlikeDoc', { | ||
| defaultMessage: 'Filter data based on string regular expressions', | ||
| }), | ||
| }, | ||
| { name: 'not_rlike', description: '' }, | ||
| ].map(({ name, description }) => { | ||
| const def: FunctionDefinition = { | ||
| type: 'builtin' as const, | ||
| ignoreAsSuggestion: /not/.test(name), | ||
| ignoreAsSuggestion: true, | ||
| name, | ||
| description, | ||
| supportedCommands: ['eval', 'where', 'row', 'sort'], | ||
|
|
@@ -450,14 +438,7 @@ const likeFunctions: FunctionDefinition[] = [ | |
| return def; | ||
| }); | ||
|
|
||
| const inFunctions: FunctionDefinition[] = [ | ||
| { | ||
| name: 'in', | ||
| description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.inDoc', { | ||
| defaultMessage: | ||
| 'Tests if the value an expression takes is contained in a list of other expressions', | ||
| }), | ||
| }, | ||
| const notInFunctions: FunctionDefinition[] = [ | ||
| { name: 'not_in', description: '' }, | ||
| ].map<FunctionDefinition>(({ name, description }) => ({ | ||
| // set all arrays to type "any" for now | ||
|
|
@@ -470,7 +451,7 @@ const inFunctions: FunctionDefinition[] = [ | |
| // | ||
| // we need to revisit with more robust validation | ||
| type: 'builtin', | ||
| ignoreAsSuggestion: /not/.test(name), | ||
| ignoreAsSuggestion: true, | ||
| name, | ||
| description, | ||
| supportedCommands: ['eval', 'where', 'row', 'sort'], | ||
|
|
@@ -645,10 +626,9 @@ const otherDefinitions: FunctionDefinition[] = [ | |
| ]; | ||
|
|
||
| export const builtinFunctions: FunctionDefinition[] = [ | ||
| ...mathFunctions, | ||
| ...comparisonFunctions, | ||
| ...likeFunctions, | ||
| ...inFunctions, | ||
| ...operatorsFunctionDefinitions, | ||
| ...notInFunctions, | ||
| ...notLikeFunctions, | ||
| ...logicalOperators, | ||
| ...nullFunctions, | ||
| ...otherDefinitions, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't we mapped in the script above as left? Why do we need them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! This was a left over. I removed it here
9f938ef(#205565)