mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ES|QL] Disable support for case insensitive quality operator (#177171)
## Summary Sync with https://github.com/elastic/elasticsearch/pull/105611 Removes the builtin operator from validation and autocomplete. <img width="595" alt="Screenshot 2024-02-19 at 12 04 37" src="72f0ed8c
-5bc3-400d-953b-07a833a7f413"> <img width="540" alt="Screenshot 2024-02-19 at 12 04 25" src="5be38d83
-8838-4dbe-8841-1d2d7222dc33"> Tests are currently skipped as the intention to restore it back later on. ### Checklist - [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:
parent
2e6150ccc4
commit
c1616fe394
7 changed files with 46 additions and 44 deletions
|
@ -237,7 +237,7 @@ string
|
|||
;
|
||||
|
||||
comparisonOperator
|
||||
: EQ | CIEQ | NEQ | LT | LTE | GT | GTE
|
||||
: EQ | NEQ | LT | LTE | GT | GTE
|
||||
;
|
||||
|
||||
explainCommand
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2626,7 +2626,7 @@ export class esql_parser extends Parser {
|
|||
{
|
||||
this.state = 471;
|
||||
_la = this._input.LA(1);
|
||||
if (!(((((_la - 51)) & ~0x1F) === 0 && ((1 << (_la - 51)) & ((1 << (esql_parser.EQ - 51)) | (1 << (esql_parser.CIEQ - 51)) | (1 << (esql_parser.NEQ - 51)) | (1 << (esql_parser.LT - 51)) | (1 << (esql_parser.LTE - 51)) | (1 << (esql_parser.GT - 51)) | (1 << (esql_parser.GTE - 51)))) !== 0))) {
|
||||
if (!(((((_la - 51)) & ~0x1F) === 0 && ((1 << (_la - 51)) & ((1 << (esql_parser.EQ - 51)) | (1 << (esql_parser.NEQ - 51)) | (1 << (esql_parser.LT - 51)) | (1 << (esql_parser.LTE - 51)) | (1 << (esql_parser.GT - 51)) | (1 << (esql_parser.GTE - 51)))) !== 0))) {
|
||||
this._errHandler.recoverInline(this);
|
||||
} else {
|
||||
if (this._input.LA(1) === Token.EOF) {
|
||||
|
@ -2959,30 +2959,30 @@ export class esql_parser extends Parser {
|
|||
"$\x02&\x02(\x02*\x02,\x02.\x020\x022\x024\x026\x028\x02:\x02<\x02>\x02" +
|
||||
"@\x02B\x02D\x02F\x02H\x02J\x02L\x02N\x02P\x02R\x02T\x02V\x02X\x02Z\x02" +
|
||||
"\\\x02^\x02`\x02b\x02d\x02f\x02\x02\v\x03\x02<=\x03\x02>@\x04\x02DDII" +
|
||||
"\x03\x02CD\x04\x02DDkk\x04\x02!!$$\x03\x02\'(\x04\x02&&44\x03\x025;\x02" +
|
||||
"\u021A\x02h\x03\x02\x02\x02\x04k\x03\x02\x02\x02\x06z\x03\x02\x02\x02" +
|
||||
"\b\x89\x03\x02\x02\x02\n\x8B\x03\x02\x02\x02\f\xAA\x03\x02\x02\x02\x0E" +
|
||||
"\xC5\x03\x02\x02\x02\x10\xCC\x03\x02\x02\x02\x12\xD2\x03\x02\x02\x02\x14" +
|
||||
"\xE6\x03\x02\x02\x02\x16\xE8\x03\x02\x02\x02\x18\xF7\x03\x02\x02\x02\x1A" +
|
||||
"\xFA\x03\x02\x02\x02\x1C\u0107\x03\x02\x02\x02\x1E\u0109\x03\x02\x02\x02" +
|
||||
" \u0117\x03\x02\x02\x02\"\u0119\x03\x02\x02\x02$\u0122\x03\x02\x02\x02" +
|
||||
"&\u0126\x03\x02\x02\x02(\u0129\x03\x02\x02\x02*\u0131\x03\x02\x02\x02" +
|
||||
",\u0137\x03\x02\x02\x02.\u0139\x03\x02\x02\x020\u0141\x03\x02\x02\x02" +
|
||||
"2\u0149\x03\x02\x02\x024\u014B\x03\x02\x02\x026\u014D\x03\x02\x02\x02" +
|
||||
"8\u0179\x03\x02\x02\x02:\u017B\x03\x02\x02\x02<\u017E\x03\x02\x02\x02" +
|
||||
">\u0187\x03\x02\x02\x02@\u018F\x03\x02\x02\x02B\u0198\x03\x02\x02\x02" +
|
||||
"D\u01A1\x03\x02\x02\x02F\u01AA\x03\x02\x02\x02H\u01AE\x03\x02\x02\x02" +
|
||||
"J\u01B4\x03\x02\x02\x02L\u01B8\x03\x02\x02\x02N\u01BB\x03\x02\x02\x02" +
|
||||
"P\u01C3\x03\x02\x02\x02R\u01C7\x03\x02\x02\x02T\u01CB\x03\x02\x02\x02" +
|
||||
"V\u01CE\x03\x02\x02\x02X\u01D3\x03\x02\x02\x02Z\u01D7\x03\x02\x02\x02" +
|
||||
"\\\u01D9\x03\x02\x02\x02^\u01DB\x03\x02\x02\x02`\u01DE\x03\x02\x02\x02" +
|
||||
"b\u01E6\x03\x02\x02\x02d\u01E8\x03\x02\x02\x02f\u01FC\x03\x02\x02\x02" +
|
||||
"hi\x05\x04\x03\x02ij\x07\x02\x02\x03j\x03\x03\x02\x02\x02kl\b\x03\x01" +
|
||||
"\x02lm\x05\x06\x04\x02ms\x03\x02\x02\x02no\f\x03\x02\x02op\x07\x1B\x02" +
|
||||
"\x02pr\x05\b\x05\x02qn\x03\x02\x02\x02ru\x03\x02\x02\x02sq\x03\x02\x02" +
|
||||
"\x02st\x03\x02\x02\x02t\x05\x03\x02\x02\x02us\x03\x02\x02\x02v{\x05^0" +
|
||||
"\x02w{\x05\x1E\x10\x02x{\x05\x18\r\x02y{\x05b2\x02zv\x03\x02\x02\x02z" +
|
||||
"w\x03\x02\x02\x02zx\x03\x02\x02\x02zy\x03\x02\x02\x02{\x07\x03\x02\x02" +
|
||||
"\x03\x02CD\x04\x02DDkk\x04\x02!!$$\x03\x02\'(\x04\x02&&44\x04\x02557;" +
|
||||
"\x02\u021A\x02h\x03\x02\x02\x02\x04k\x03\x02\x02\x02\x06z\x03\x02\x02" +
|
||||
"\x02\b\x89\x03\x02\x02\x02\n\x8B\x03\x02\x02\x02\f\xAA\x03\x02\x02\x02" +
|
||||
"\x0E\xC5\x03\x02\x02\x02\x10\xCC\x03\x02\x02\x02\x12\xD2\x03\x02\x02\x02" +
|
||||
"\x14\xE6\x03\x02\x02\x02\x16\xE8\x03\x02\x02\x02\x18\xF7\x03\x02\x02\x02" +
|
||||
"\x1A\xFA\x03\x02\x02\x02\x1C\u0107\x03\x02\x02\x02\x1E\u0109\x03\x02\x02" +
|
||||
"\x02 \u0117\x03\x02\x02\x02\"\u0119\x03\x02\x02\x02$\u0122\x03\x02\x02" +
|
||||
"\x02&\u0126\x03\x02\x02\x02(\u0129\x03\x02\x02\x02*\u0131\x03\x02\x02" +
|
||||
"\x02,\u0137\x03\x02\x02\x02.\u0139\x03\x02\x02\x020\u0141\x03\x02\x02" +
|
||||
"\x022\u0149\x03\x02\x02\x024\u014B\x03\x02\x02\x026\u014D\x03\x02\x02" +
|
||||
"\x028\u0179\x03\x02\x02\x02:\u017B\x03\x02\x02\x02<\u017E\x03\x02\x02" +
|
||||
"\x02>\u0187\x03\x02\x02\x02@\u018F\x03\x02\x02\x02B\u0198\x03\x02\x02" +
|
||||
"\x02D\u01A1\x03\x02\x02\x02F\u01AA\x03\x02\x02\x02H\u01AE\x03\x02\x02" +
|
||||
"\x02J\u01B4\x03\x02\x02\x02L\u01B8\x03\x02\x02\x02N\u01BB\x03\x02\x02" +
|
||||
"\x02P\u01C3\x03\x02\x02\x02R\u01C7\x03\x02\x02\x02T\u01CB\x03\x02\x02" +
|
||||
"\x02V\u01CE\x03\x02\x02\x02X\u01D3\x03\x02\x02\x02Z\u01D7\x03\x02\x02" +
|
||||
"\x02\\\u01D9\x03\x02\x02\x02^\u01DB\x03\x02\x02\x02`\u01DE\x03\x02\x02" +
|
||||
"\x02b\u01E6\x03\x02\x02\x02d\u01E8\x03\x02\x02\x02f\u01FC\x03\x02\x02" +
|
||||
"\x02hi\x05\x04\x03\x02ij\x07\x02\x02\x03j\x03\x03\x02\x02\x02kl\b\x03" +
|
||||
"\x01\x02lm\x05\x06\x04\x02ms\x03\x02\x02\x02no\f\x03\x02\x02op\x07\x1B" +
|
||||
"\x02\x02pr\x05\b\x05\x02qn\x03\x02\x02\x02ru\x03\x02\x02\x02sq\x03\x02" +
|
||||
"\x02\x02st\x03\x02\x02\x02t\x05\x03\x02\x02\x02us\x03\x02\x02\x02v{\x05" +
|
||||
"^0\x02w{\x05\x1E\x10\x02x{\x05\x18\r\x02y{\x05b2\x02zv\x03\x02\x02\x02" +
|
||||
"zw\x03\x02\x02\x02zx\x03\x02\x02\x02zy\x03\x02\x02\x02{\x07\x03\x02\x02" +
|
||||
"\x02|\x8A\x05&\x14\x02}\x8A\x05*\x16\x02~\x8A\x05:\x1E\x02\x7F\x8A\x05" +
|
||||
"@!\x02\x80\x8A\x05<\x1F\x02\x81\x8A\x05(\x15\x02\x82\x8A\x05\n\x06\x02" +
|
||||
"\x83\x8A\x05B\"\x02\x84\x8A\x05D#\x02\x85\x8A\x05H%\x02\x86\x8A\x05J&" +
|
||||
|
@ -5144,7 +5144,6 @@ export class StringContext extends ParserRuleContext {
|
|||
|
||||
export class ComparisonOperatorContext extends ParserRuleContext {
|
||||
public EQ(): TerminalNode | undefined { return this.tryGetToken(esql_parser.EQ, 0); }
|
||||
public CIEQ(): TerminalNode | undefined { return this.tryGetToken(esql_parser.CIEQ, 0); }
|
||||
public NEQ(): TerminalNode | undefined { return this.tryGetToken(esql_parser.NEQ, 0); }
|
||||
public LT(): TerminalNode | undefined { return this.tryGetToken(esql_parser.LT, 0); }
|
||||
public LTE(): TerminalNode | undefined { return this.tryGetToken(esql_parser.LTE, 0); }
|
||||
|
|
|
@ -235,7 +235,6 @@ function getMathOperation(ctx: ArithmeticBinaryContext) {
|
|||
function getComparisonName(ctx: ComparisonOperatorContext) {
|
||||
return (
|
||||
ctx.EQ()?.text ||
|
||||
ctx.CIEQ()?.text ||
|
||||
ctx.NEQ()?.text ||
|
||||
ctx.LT()?.text ||
|
||||
ctx.LTE()?.text ||
|
||||
|
|
|
@ -379,7 +379,8 @@ describe('autocomplete', () => {
|
|||
...getFieldNamesByType('string'),
|
||||
...getFunctionSignaturesByReturnType('where', 'string', { evalMath: true }),
|
||||
]);
|
||||
testSuggestions('from a | where stringField =~ ', [
|
||||
// Skip these tests until the insensitive case equality gets restored back
|
||||
testSuggestions.skip('from a | where stringField =~ ', [
|
||||
...getFieldNamesByType('string'),
|
||||
...getFunctionSignaturesByReturnType('where', 'string', { evalMath: true }),
|
||||
]);
|
||||
|
@ -394,7 +395,7 @@ describe('autocomplete', () => {
|
|||
['boolean']
|
||||
),
|
||||
]);
|
||||
testSuggestions('from a | where stringField =~ stringField ', [
|
||||
testSuggestions.skip('from a | where stringField =~ stringField ', [
|
||||
'|',
|
||||
...getFunctionSignaturesByReturnType(
|
||||
'where',
|
||||
|
@ -829,7 +830,8 @@ describe('autocomplete', () => {
|
|||
'a',
|
||||
...getFunctionSignaturesByReturnType('eval', 'any', { evalMath: true }),
|
||||
]);
|
||||
testSuggestions('from a | eval a=stringField =~ ', [
|
||||
// Skip this test until the insensitive case equality gets restored back
|
||||
testSuggestions.skip('from a | eval a=stringField =~ ', [
|
||||
...getFieldNamesByType('string'),
|
||||
...getFunctionSignaturesByReturnType('eval', 'string', { evalMath: true }),
|
||||
]);
|
||||
|
|
|
@ -207,13 +207,14 @@ export const builtinFunctions: FunctionDefinition[] = [
|
|||
},
|
||||
].map((op): FunctionDefinition => createComparisonDefinition(op)),
|
||||
...[
|
||||
// Skip the insensitive case equality until it gets restored back
|
||||
// new special comparison operator for strings only
|
||||
{
|
||||
name: '=~',
|
||||
description: i18n.translate('monaco.esql.definition.equalToCaseInsensitiveDoc', {
|
||||
defaultMessage: 'Case insensitive equality',
|
||||
}),
|
||||
},
|
||||
// {
|
||||
// name: '=~',
|
||||
// description: i18n.translate('monaco.esql.definition.equalToCaseInsensitiveDoc', {
|
||||
// defaultMessage: 'Case insensitive equality',
|
||||
// }),
|
||||
// },
|
||||
{
|
||||
name: 'like',
|
||||
description: i18n.translate('monaco.esql.definition.likeDoc', {
|
||||
|
|
|
@ -979,27 +979,28 @@ describe('validation logic', () => {
|
|||
]);
|
||||
}
|
||||
|
||||
testErrorsAndWarnings(`from a_index | where numberField =~ 0`, [
|
||||
// Skip these tests until the insensitive case equality gets restored back
|
||||
testErrorsAndWarnings.skip(`from a_index | where numberField =~ 0`, [
|
||||
'Argument of [=~] must be [string], found value [numberField] type [number]',
|
||||
'Argument of [=~] must be [string], found value [0] type [number]',
|
||||
]);
|
||||
testErrorsAndWarnings(`from a_index | where NOT numberField =~ 0`, [
|
||||
testErrorsAndWarnings.skip(`from a_index | where NOT numberField =~ 0`, [
|
||||
'Argument of [=~] must be [string], found value [numberField] type [number]',
|
||||
'Argument of [=~] must be [string], found value [0] type [number]',
|
||||
]);
|
||||
testErrorsAndWarnings(`from a_index | where (numberField =~ 0)`, [
|
||||
testErrorsAndWarnings.skip(`from a_index | where (numberField =~ 0)`, [
|
||||
'Argument of [=~] must be [string], found value [numberField] type [number]',
|
||||
'Argument of [=~] must be [string], found value [0] type [number]',
|
||||
]);
|
||||
testErrorsAndWarnings(`from a_index | where (NOT (numberField =~ 0))`, [
|
||||
testErrorsAndWarnings.skip(`from a_index | where (NOT (numberField =~ 0))`, [
|
||||
'Argument of [=~] must be [string], found value [numberField] type [number]',
|
||||
'Argument of [=~] must be [string], found value [0] type [number]',
|
||||
]);
|
||||
testErrorsAndWarnings(`from a_index | where 1 =~ 0`, [
|
||||
testErrorsAndWarnings.skip(`from a_index | where 1 =~ 0`, [
|
||||
'Argument of [=~] must be [string], found value [1] type [number]',
|
||||
'Argument of [=~] must be [string], found value [0] type [number]',
|
||||
]);
|
||||
testErrorsAndWarnings(`from a_index | eval stringField =~ 0`, [
|
||||
testErrorsAndWarnings.skip(`from a_index | eval stringField =~ 0`, [
|
||||
`Argument of [=~] must be [string], found value [0] type [number]`,
|
||||
]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue