[ES|QL] Tuples followup cleanup (#224650)

## Summary

Minor followup cleanup after
https://github.com/elastic/kibana/pull/224530


### 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:
Vadim Kibana 2025-06-23 16:44:12 +02:00 committed by GitHub
parent b33c211b5b
commit cb918fcfb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 13 additions and 8 deletions

View file

@ -123,9 +123,9 @@ export const binaryExpressionGroup = (node: ESQLAstNode): BinaryExpressionGroup
case '>=':
return BinaryExpressionGroup.comparison;
case 'like':
case 'not_like':
case 'not like':
case 'rlike':
case 'not_rlike':
case 'not rlike':
return BinaryExpressionGroup.regex;
}
}

View file

@ -109,10 +109,14 @@ describe('list expressions', () => {
describe('tuple list', () => {
test('can print comments around the tuple', () => {
assertPrint('FROM a | WHERE b IN /* 1 */ /* 2 */ (1, 2, 3) /* 3 */');
assertPrint('FROM a | WHERE b NOT IN /* 1 */ /* 2 */ (1, 2, 3) /* 3 */');
});
test('can print comments inside the tuple', () => {
assertPrint('FROM a | WHERE b IN (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */)');
assertPrint(
'FROM a | WHERE b NOT IN (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */)'
);
assertPrint(
'FROM a | WHERE b IN /* 0 */ (/* 1 */ 1 /* 2 */, /* 3 */ 2 /* 4 */, /* 5 */ 3 /* 6 */) /* 7 */'
);

View file

@ -691,10 +691,12 @@ describe('single line query', () => {
describe('tuple lists', () => {
test('empty list', () => {
expect(reprint('FROM a | WHERE b IN ()').text).toBe('FROM a | WHERE b IN ()');
expect(reprint('FROM a | WHERE b NOT IN ()').text).toBe('FROM a | WHERE b NOT IN ()');
});
test('one element list', () => {
expect(reprint('FROM a | WHERE b IN (1)').text).toBe('FROM a | WHERE b IN (1)');
expect(reprint('FROM a | WHERE b NOT IN (1)').text).toBe('FROM a | WHERE b NOT IN (1)');
});
test('three element list', () => {

View file

@ -447,7 +447,7 @@ ROW
describe('list tuple expressions', () => {
test('numeric list literal, surrounded from three sides', () => {
assertReprint(`FROM a | WHERE b IN ()`);
assertReprint(`FROM a | WHERE b IN (/* 1 */ 123456789 /* 2 */)`);
assertReprint(`FROM a | WHERE b NOT IN (/* 1 */ 123456789 /* 2 */)`);
assertReprint(`FROM a
| WHERE
b IN

View file

@ -1038,13 +1038,13 @@ FROM a
test('breaks lists with long items', () => {
const query =
'FROM a | WHERE b in ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")';
'FROM a | WHERE b not in ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")';
const text = reprint(query).text;
expect('\n' + text).toBe(`
FROM a
| WHERE
b IN
b NOT IN
(
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",

View file

@ -230,11 +230,11 @@ export type BinaryExpressionOperator =
export type BinaryExpressionArithmeticOperator = '+' | '-' | '*' | '/' | '%';
export type BinaryExpressionAssignmentOperator = '=';
export type BinaryExpressionComparisonOperator = '==' | '=~' | '!=' | '<' | '<=' | '>' | '>=';
export type BinaryExpressionRegexOperator = 'like' | 'not_like' | 'rlike' | 'not_rlike';
export type BinaryExpressionRegexOperator = 'like' | 'not like' | 'rlike' | 'not rlike';
export type BinaryExpressionRenameOperator = 'as';
export type BinaryExpressionWhereOperator = 'where';
export type BinaryExpressionMatchOperator = ':';
export type BinaryExpressionIn = 'in' | 'not_in';
export type BinaryExpressionIn = 'in' | 'not in';
// from https://github.com/elastic/elasticsearch/blob/122e7288200ee03e9087c98dff6cebbc94e774aa/docs/reference/esql/functions/kibana/inline_cast.json
export type InlineCastingType =

View file

@ -38,7 +38,6 @@ import {
unwrapArrayOneLevel,
isArrayType,
isParametrized,
// isParam,
} from '../shared/helpers';
import { getMessageFromId, errors } from './errors';
import { getMaxMinNumberOfParams, collapseWrongArgumentTypeMessages } from './helpers';