Skip to content

Commit 065bfae

Browse files
[8.19] [ES|QL] Tuples followup cleanup (#224650) (#224888)
# Backport This will backport the following commits from `main` to `8.19`: - [[ES|QL] Tuples followup cleanup (#224650)](#224650) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Vadim Kibana","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-06-23T14:44:12Z","message":"[ES|QL] Tuples followup cleanup (#224650)\n\n## Summary\n\nMinor followup cleanup after\nhttps://github.com//pull/224530\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"cb918fcfb9bad3e519724deea62ef48ee4a2d8df","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL] Tuples followup cleanup","number":224650,"url":"https://github.com/elastic/kibana/pull/224650","mergeCommit":{"message":"[ES|QL] Tuples followup cleanup (#224650)\n\n## Summary\n\nMinor followup cleanup after\nhttps://github.com//pull/224530\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"cb918fcfb9bad3e519724deea62ef48ee4a2d8df"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224650","number":224650,"mergeCommit":{"message":"[ES|QL] Tuples followup cleanup (#224650)\n\n## Summary\n\nMinor followup cleanup after\nhttps://github.com//pull/224530\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"cb918fcfb9bad3e519724deea62ef48ee4a2d8df"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Vadim Kibana <[email protected]>
1 parent ba0bf6b commit 065bfae

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

src/platform/packages/shared/kbn-esql-ast/src/ast/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ export const binaryExpressionGroup = (node: ESQLAstNode): BinaryExpressionGroup
123123
case '>=':
124124
return BinaryExpressionGroup.comparison;
125125
case 'like':
126-
case 'not_like':
126+
case 'not like':
127127
case 'rlike':
128-
case 'not_rlike':
128+
case 'not rlike':
129129
return BinaryExpressionGroup.regex;
130130
}
131131
}

src/platform/packages/shared/kbn-esql-ast/src/pretty_print/__tests__/basic_pretty_printer.comments.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@ describe('list expressions', () => {
109109
describe('tuple list', () => {
110110
test('can print comments around the tuple', () => {
111111
assertPrint('FROM a | WHERE b IN /* 1 */ /* 2 */ (1, 2, 3) /* 3 */');
112+
assertPrint('FROM a | WHERE b NOT IN /* 1 */ /* 2 */ (1, 2, 3) /* 3 */');
112113
});
113114

114115
test('can print comments inside the tuple', () => {
115116
assertPrint('FROM a | WHERE b IN (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */)');
117+
assertPrint(
118+
'FROM a | WHERE b NOT IN (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */)'
119+
);
116120
assertPrint(
117121
'FROM a | WHERE b IN /* 0 */ (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */) /* 7 */'
118122
);

src/platform/packages/shared/kbn-esql-ast/src/pretty_print/__tests__/basic_pretty_printer.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,12 @@ describe('single line query', () => {
691691
describe('tuple lists', () => {
692692
test('empty list', () => {
693693
expect(reprint('FROM a | WHERE b IN ()').text).toBe('FROM a | WHERE b IN ()');
694+
expect(reprint('FROM a | WHERE b NOT IN ()').text).toBe('FROM a | WHERE b NOT IN ()');
694695
});
695696

696697
test('one element list', () => {
697698
expect(reprint('FROM a | WHERE b IN (1)').text).toBe('FROM a | WHERE b IN (1)');
699+
expect(reprint('FROM a | WHERE b NOT IN (1)').text).toBe('FROM a | WHERE b NOT IN (1)');
698700
});
699701

700702
test('three element list', () => {

src/platform/packages/shared/kbn-esql-ast/src/pretty_print/__tests__/wrapping_pretty_printer.comments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ ROW
447447
describe('list tuple expressions', () => {
448448
test('numeric list literal, surrounded from three sides', () => {
449449
assertReprint(`FROM a | WHERE b IN ()`);
450-
assertReprint(`FROM a | WHERE b IN (/* 1 */ 123456789 /* 2 */)`);
450+
assertReprint(`FROM a | WHERE b NOT IN (/* 1 */ 123456789 /* 2 */)`);
451451
assertReprint(`FROM a
452452
| WHERE
453453
b IN

src/platform/packages/shared/kbn-esql-ast/src/pretty_print/__tests__/wrapping_pretty_printer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,13 +1038,13 @@ FROM a
10381038

10391039
test('breaks lists with long items', () => {
10401040
const query =
1041-
'FROM a | WHERE b in ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")';
1041+
'FROM a | WHERE b not in ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")';
10421042
const text = reprint(query).text;
10431043

10441044
expect('\n' + text).toBe(`
10451045
FROM a
10461046
| WHERE
1047-
b IN
1047+
b NOT IN
10481048
(
10491049
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
10501050
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",

src/platform/packages/shared/kbn-esql-ast/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ export type BinaryExpressionOperator =
230230
export type BinaryExpressionArithmeticOperator = '+' | '-' | '*' | '/' | '%';
231231
export type BinaryExpressionAssignmentOperator = '=';
232232
export type BinaryExpressionComparisonOperator = '==' | '=~' | '!=' | '<' | '<=' | '>' | '>=';
233-
export type BinaryExpressionRegexOperator = 'like' | 'not_like' | 'rlike' | 'not_rlike';
233+
export type BinaryExpressionRegexOperator = 'like' | 'not like' | 'rlike' | 'not rlike';
234234
export type BinaryExpressionRenameOperator = 'as';
235235
export type BinaryExpressionWhereOperator = 'where';
236236
export type BinaryExpressionMatchOperator = ':';
237-
export type BinaryExpressionIn = 'in' | 'not_in';
237+
export type BinaryExpressionIn = 'in' | 'not in';
238238

239239
// from https://github.com/elastic/elasticsearch/blob/122e7288200ee03e9087c98dff6cebbc94e774aa/docs/reference/esql/functions/kibana/inline_cast.json
240240
export type InlineCastingType =

src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/function_validation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import {
3838
unwrapArrayOneLevel,
3939
isArrayType,
4040
isParametrized,
41-
// isParam,
4241
} from '../shared/helpers';
4342
import { getMessageFromId, errors } from './errors';
4443
import { getMaxMinNumberOfParams, collapseWrongArgumentTypeMessages } from './helpers';

0 commit comments

Comments
 (0)