diff --git a/yaml-tests/src/test/resources/like.metrics.binpb b/yaml-tests/src/test/resources/like.metrics.binpb new file mode 100644 index 0000000000..bf6b9899c6 --- /dev/null +++ b/yaml-tests/src/test/resources/like.metrics.binpb @@ -0,0 +1,127 @@ + +6 + unnamed-3)EXPLAIN select * from C WHERE C2 LIKE '%' + K ב(0̊Z8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +7 + unnamed-3*EXPLAIN select * from C WHERE C2 LIKE 'a%' +&K (0ɺ8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +8 + unnamed-3+EXPLAIN select * from C WHERE C2 LIKE 'ap%' + K (0J8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +9 + unnamed-3,EXPLAIN select * from C WHERE C2 LIKE 'a%l%' +ҽ K (0G8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +8 + unnamed-3+EXPLAIN select * from C WHERE C2 LIKE 'ca%' +K (0e8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +: + unnamed-3-EXPLAIN select * from C WHERE C2 LIKE 'ca_al' +&K (0₮8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +: + unnamed-3-EXPLAIN select * from C WHERE C2 LIKE 'ca%al' +K (068&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +; + unnamed-3.EXPLAIN select * from C WHERE C2 LIKE 'ca_al%' +&K Ջ(0䬲8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +; + unnamed-3.EXPLAIN select * from C WHERE C2 LIKE 'ca%al%' + K ·(0H8&@YCOVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(INT AS C1, )" ]; + 2 [ label=<
Predicate Filter
WHERE q37.C2 LIKE @c8 ESCAPE 'null'
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 4 [ label=<
Index
C2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS C1, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/like.metrics.yaml b/yaml-tests/src/test/resources/like.metrics.yaml new file mode 100644 index 0000000000..2520e40898 --- /dev/null +++ b/yaml-tests/src/test/resources/like.metrics.yaml @@ -0,0 +1,100 @@ +unnamed-3: +- query: EXPLAIN select * from C WHERE C2 LIKE '%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 23 + transform_count: 75 + transform_time_ms: 8 + transform_yield_count: 29 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'a%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 81 + transform_count: 75 + transform_time_ms: 36 + transform_yield_count: 29 + insert_time_ms: 3 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ap%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 27 + transform_count: 75 + transform_time_ms: 9 + transform_yield_count: 29 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'a%l%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 27 + transform_count: 75 + transform_time_ms: 9 + transform_yield_count: 29 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ca%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 31 + transform_count: 75 + transform_time_ms: 11 + transform_yield_count: 29 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ca_al' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 81 + transform_count: 75 + transform_time_ms: 36 + transform_yield_count: 29 + insert_time_ms: 2 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ca%al' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 15 + transform_count: 75 + transform_time_ms: 6 + transform_yield_count: 29 + insert_time_ms: 0 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ca_al%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 81 + transform_count: 75 + transform_time_ms: 46 + transform_yield_count: 29 + insert_time_ms: 2 + insert_new_count: 38 + insert_reused_count: 5 +- query: EXPLAIN select * from C WHERE C2 LIKE 'ca%al%' + explain: 'COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 + ESCAPE ''null'' | FETCH' + task_count: 338 + task_total_time_ms: 27 + transform_count: 75 + transform_time_ms: 9 + transform_yield_count: 29 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 5 diff --git a/yaml-tests/src/test/resources/like.yamsql b/yaml-tests/src/test/resources/like.yamsql index 1f010bf606..70f8434f03 100644 --- a/yaml-tests/src/test/resources/like.yamsql +++ b/yaml-tests/src/test/resources/like.yamsql @@ -21,6 +21,9 @@ schema_template: create table A(a1 string, primary key(a1)) create table B(b1 integer, b2 string, primary key(b1)) + create table C(c1 integer, c2 string, primary key(c1)) + + create index c2 as select c2 from c order by c2 --- setup: steps: @@ -46,6 +49,27 @@ setup: (3, 'A'), (4, 'Z'), (5, 'B'); + - query: insert into C values + ( 1, 'alphabet'), + ( 2, 'anticipation'), + ( 3, 'aplomb'), + ( 4, 'apple'), + ( 5, 'appliance'), + ( 6, 'application'), + ( 7, 'awry'), + ( 8, 'banal'), + ( 9, 'banana'), + (10, 'bench'), + (11, 'bento'), + (12, 'c'), + (13, 'cabal'), + (14, 'camel'), + (15, 'canal'), + (16, 'capital'), + (17, 'catch-all'), + (18, 'cavalry'), + (19, 'cb') + ; --- test_block: # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) @@ -128,6 +152,181 @@ test_block: {'ありがとう'}, {'مدرسة'}, {'\\||%'}] + - + - query: select * from C WHERE C2 LIKE '%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 1, C2: alphabet}, + { C1: 2, C2: anticipation}, + { C1: 3, C2: aplomb}, + { C1: 4, C2: apple}, + { C1: 5, C2: appliance}, + { C1: 6, C2: application}, + { C1: 7, C2: awry}, + { C1: 8, C2: banal}, + { C1: 9, C2: banana}, + { C1: 10, C2: bench}, + { C1: 11, C2: bento}, + { C1: 12, C2: c}, + { C1: 13, C2: cabal}, + { C1: 14, C2: camel}, + { C1: 15, C2: canal}, + { C1: 16, C2: capital}, + { C1: 17, C2: catch-all}, + { C1: 18, C2: cavalry}, + { C1: 19, C2: cb}, + ] + - + - query: select * from C WHERE C2 LIKE 'a%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 1, C2: alphabet}, + { C1: 2, C2: anticipation}, + { C1: 3, C2: aplomb}, + { C1: 4, C2: apple}, + { C1: 5, C2: appliance}, + { C1: 6, C2: application}, + { C1: 7, C2: awry}, + ] + - + - query: select * from C WHERE C2 LIKE 'ap%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 3, C2: aplomb}, + { C1: 4, C2: apple}, + { C1: 5, C2: appliance}, + { C1: 6, C2: application}, + ] + - + - query: select * from C WHERE C2 LIKE 'a%l%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 1, C2: alphabet}, + { C1: 3, C2: aplomb}, + { C1: 4, C2: apple}, + { C1: 5, C2: appliance}, + { C1: 6, C2: application}, + ] + - + - query: select * from C WHERE C2 LIKE 'app%' + - result: [ + { C1: 4, C2: apple}, + { C1: 5, C2: appliance}, + { C1: 6, C2: application}, + ] + - + - query: select * from C WHERE C2 LIKE 'b%' + - result: [ + { C1: 8, C2: banal}, + { C1: 9, C2: banana}, + { C1: 10, C2: bench}, + { C1: 11, C2: bento}, + ] + - + - query: select * from C WHERE C2 LIKE 'ba%' + - result: [ + { C1: 8, C2: banal}, + { C1: 9, C2: banana}, + ] + - + - query: select * from C WHERE C2 LIKE 'ban%' + - result: [ + { C1: 8, C2: banal}, + { C1: 9, C2: banana}, + ] + - + - query: select * from C WHERE C2 LIKE 'bana%' + - result: [ + { C1: 8, C2: banal}, + { C1: 9, C2: banana}, + ] + - + - query: select * from C WHERE C2 LIKE 'banal%' + - result: [ + { C1: 8, C2: banal}, + ] + - + - query: select * from C WHERE C2 LIKE 'be%' + - result: [ + { C1: 10, C2: bench}, + { C1: 11, C2: bento}, + ] + - + - query: select * from C WHERE C2 LIKE 'ben%' + - result: [ + { C1: 10, C2: bench}, + { C1: 11, C2: bento}, + ] + - + - query: select * from C WHERE C2 LIKE 'bent%' + - result: [ + { C1: 11, C2: bento}, + ] + - + - query: select * from C WHERE C2 LIKE 'c%' + - result: [ + { C1: 12, C2: c}, + { C1: 13, C2: cabal}, + { C1: 14, C2: camel}, + { C1: 15, C2: canal}, + { C1: 16, C2: capital}, + { C1: 17, C2: catch-all}, + { C1: 18, C2: cavalry}, + { C1: 19, C2: cb}, + ] + - + - query: select * from C WHERE C2 LIKE 'ca%' + # In theory, this could be executed optimally with prefix string scan with the prefix "ca" + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 13, C2: cabal}, + { C1: 14, C2: camel}, + { C1: 15, C2: canal}, + { C1: 16, C2: capital}, + { C1: 17, C2: catch-all}, + { C1: 18, C2: cavalry}, + ] + - + - query: select * from C WHERE C2 LIKE 'ca_al' + # In theory, this could be optimized with prefix string scan with the prefix "ca" followed by compensation + # to handle filtering out based on the tail + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 13, C2: cabal}, + { C1: 15, C2: canal}, + ] + - + - query: select * from C WHERE C2 LIKE 'ca%al' + # In theory, this could be optimized with prefix string scan with the prefix "ca" followed by compensation + # to handle matching the tail + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 13, C2: cabal}, + { C1: 15, C2: canal}, + { C1: 16, C2: capital}, + ] + - + - query: select * from C WHERE C2 LIKE 'ca_al%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 13, C2: cabal}, + { C1: 15, C2: canal}, + { C1: 18, C2: cavalry}, + ] + - + - query: select * from C WHERE C2 LIKE 'ca%al%' + - explain: "COVERING(C2 <,> -> [C1: KEY[2], C2: KEY[0]]) | FILTER _.C2 LIKE @c8 ESCAPE 'null' | FETCH" + - result: [ + { C1: 13, C2: cabal}, + { C1: 15, C2: canal}, + { C1: 16, C2: capital}, + { C1: 17, C2: catch-all}, + { C1: 18, C2: cavalry}, + ] + - + - query: select * from C WHERE C2 LIKE 'd%' + - result: [ + ] --- # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) test_block: