[ ] Remove underscored _ in not_like and not_rlike nodes.
[ ] Or, even better add not: true/false flag to regexp nodes.
When IN or regex LIKE or RLIKE operators are prefixed by NOT modifier, we should keep the original operator name and add the "not" flag to the AST node, instead for changing the operator name.
Currently LIKE and NOT LIKE operators produce two different operator names:
{type: 'function', name: 'like'} // column LIKE "abc"
{type: 'function', name: 'not_like'} // column NOT LIKE "abc"
Instead we could use the same operator name but attach a not flag:
{type: 'function', name: 'like'} // column LIKE "abc"
{type: 'function', name: 'like', not: true} // column NOT LIKE "abc"
This way, when pretty printing ES|QL query from AST, we could just print the name property:
return `${node.not ? 'NOT ' : ''}${node.name}`
Now we have to loop through all possible cases:
switch (node.name) {
case 'like': return 'LIKE';
case 'not_like': return 'NOT LIKE';
case 'rlike': return 'RLIKE';
case 'not_rlike': return 'NOT RLIKE';
}
The same holds for the IN and NOT IN binary operators.
_
innot_like
andnot_rlike
nodes.not: true/false
flag to regexp nodes.When
IN
or regexLIKE
orRLIKE
operators are prefixed byNOT
modifier, we should keep the original operator name and add the "not" flag to the AST node, instead for changing the operator name.Currently
LIKE
andNOT LIKE
operators produce two different operator names:Instead we could use the same operator name but attach a
not
flag:This way, when pretty printing ES|QL query from AST, we could just print the
name
property:Now we have to loop through all possible cases:
The same holds for the
IN
andNOT IN
binary operators.