Files
greptimedb/tests/cases/standalone/common/select/matches.result
Ruihang Xia 23bb9d92cb feat: handle parentheses with unary ops (#4290)
* feat: handle parentheses with unary ops

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* clean up

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add comment

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add sqlness test

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* check tokens before convert to RPN

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add test cases to sqlness

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix clippy

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: dennis zhuang <killme2008@gmail.com>
2024-07-09 04:08:36 +00:00

260 lines
10 KiB
Plaintext

create table fox (
ts timestamp time index,
fox string,
);
Affected Rows: 0
insert into fox values
(1, 'The quick brown fox jumps over the lazy dog'),
(2, 'The fox jumps over the lazy dog'),
(3, 'The quick brown jumps over the lazy dog'),
(4, 'The quick brown fox over the lazy dog'),
(5, 'The quick brown fox jumps the lazy dog'),
(6, 'The quick brown fox jumps over dog'),
(7, 'The quick brown fox jumps over the dog');
Affected Rows: 7
select fox from fox where matches(fox, '"fox jumps"') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, '"quick brown"') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, '"fox jumps"') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'fox OR lazy') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'fox AND lazy') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
+---------------------------------------------+
select fox from fox where matches(fox, '-over -lazy') order by ts;
++
++
select fox from fox where matches(fox, '-over AND -lazy') order by ts;
++
++
select fox from fox where matches(fox, 'fox AND jumps OR over') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'fox OR brown AND quick') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, '(fox OR brown) AND quick') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'brown AND quick OR fox') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'brown AND (quick OR fox)') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'brown AND quick AND fox OR jumps AND over AND lazy') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'quick brown fox +jumps') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'fox +jumps -over') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps the lazy dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'fox AND +jumps AND -over') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps the lazy dog |
+---------------------------------------------+
select fox from fox where matches(fox, '(+fox +jumps) over') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, '+(fox jumps) AND over') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'over -(fox jumps)') order by ts;
++
++
select fox from fox where matches(fox, 'over -(fox AND jumps)') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
+---------------------------------------------+
select fox from fox where matches(fox, 'over AND -(-(fox OR jumps))') order by ts;
+---------------------------------------------+
| fox |
+---------------------------------------------+
| The quick brown fox jumps over the lazy dog |
| The fox jumps over the lazy dog |
| The quick brown jumps over the lazy dog |
| The quick brown fox over the lazy dog |
| The quick brown fox jumps over dog |
| The quick brown fox jumps over the dog |
+---------------------------------------------+
drop table fox;
Affected Rows: 0