You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- make sure to convert FieldKeyExpression#fieldName (which is internal) to
user-facing name when constructing match candidates.
- also, add tests for deeply nested (and repeated) structures with non-pb-compliant
field names, and an index.
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/metadata/expressions/FieldKeyExpression.java
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/KeyExpressionExpansionVisitor.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -242,7 +242,7 @@ public GraphExpansion visitExpression(@Nonnull final NestingKeyExpression nestin
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/ScalarTranslationVisitor.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -170,9 +170,10 @@ public Value visitExpression(@Nonnull final NestingKeyExpression nestingKeyExpre
Copy file name to clipboardExpand all lines: yaml-tests/src/test/resources/valid-identifiers.metrics.binpb
+47-1Lines changed: 47 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,50 @@
1
-
�
1
+
�'
2
+
�
3
+
all-tests�EXPLAIN select B."level2$array.field.1" from "foo.table$nested.repeated" as t, (select A."level2$array.field.1" from t."level0.field1" as Y, (select "level2$array.field.1" from Y."level1$field.1") as A) as B where id = 1�%
4
+
����]� ��C(+0���8<@�SCAN(<,>) | TFILTER foo__2table__1nested__2repeated | FILTER _.ID EQUALS promote(@c38 AS LONG) | FLATMAP q0 -> { EXPLODE q0.level0.field1 | FLATMAP q1 -> { EXPLODE q1.level1$field.1 AS q2 RETURN q2 } AS q2 RETURN (q2.level2$array.field.1 AS level2$array.field.1) }�#digraph G {
2 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Predicate Filter</td></tr><tr><td align="left">WHERE q2.ID EQUALS promote(@c38 AS LONG)</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2) AS level0.field1)" ];
10
+
3 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Type Filter</td></tr><tr><td align="left">WHERE record IS [foo__2table__1nested__2repeated]</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2) AS level0.field1)" ];
6 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Nested Loop Join</td></tr><tr><td align="left">FLATMAP q6</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS level2$array.field.1, LONG AS level2$field.2)" ];
14
+
7 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Value Computation</td></tr><tr><td align="left">EXPLODE q4.level1$field.1</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS level2$array.field.1, LONG AS level2$field.2)" ];
15
+
8 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Value Computation</td></tr><tr><td align="left">EXPLODE q2.level0.field1</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2)" ];
2 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Predicate Filter</td></tr><tr><td align="left">WHERE q45.ID EQUALS promote(@c12 AS LONG)</td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2 AS level0.field1)" ];
42
+
3 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Covering Index Scan</td></tr><tr><td align="left">range: <-∞, ∞></td></tr></table>> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2 AS level0.field1)" ];
43
+
4 [ label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="8"><tr><td align="left">Index</td></tr><tr><td align="left">foo.table$nested.idx</td></tr></table>> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2 AS level0.field1)" ];
Copy file name to clipboardExpand all lines: yaml-tests/src/test/resources/valid-identifiers.yamsql
+49-24Lines changed: 49 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,17 @@ options:
21
21
supported_version: 4.8.13.0
22
22
---
23
23
schema_template:
24
-
CREATE TYPE AS STRUCT "foo.struct"(S1 bigint, S2 bigint)
24
+
create type as struct "nested.type$level2" ("level2$field.1" bigint, "level2$field.2" bigint)
25
+
create type as struct "nested.type$level1" ("level1$field.1" "nested.type$level2", "level1$field.2" "nested.type$level2")
26
+
create table "foo.table$nested" (id bigint, "level0.field1" "nested.type$level1", primary key(id))
27
+
create index "foo.table$nested.idx" as select "level0.field1"."level1$field.1"."level2$field.1" from "foo.table$nested" order by "level0.field1"."level1$field.1"."level2$field.1"
28
+
29
+
create type as struct "nested.repeated.type$level2" ("level2$array.field.1" bigint, "level2$field.2" bigint)
30
+
create type as struct "nested.repeated.type$level1" ("level1$field.1" "nested.repeated.type$level2" array, "level1$field.2" "nested.type$level2")
31
+
create table "foo.table$nested.repeated" (id bigint, "level0.field1" "nested.repeated.type$level1" array, primary key(id))
32
+
create index "foo.table$nested.repeated.idx" as select B."level2$array.field.1" from "foo.table$nested.repeated" as t, (select A."level2$array.field.1" from t."level0.field1" as Y, (select "level2$array.field.1" from Y."level1$field.1") A) B
33
+
34
+
create type as struct "foo.struct"(S1 bigint, S2 bigint)
create index "foo.tableA.idx" as select "foo.tableA.A1", "foo.tableA.A2", "foo.tableA.A3" FROM "foo.tableA" order by "foo.tableA.A1", "foo.tableA.A2", "foo.tableA.A3"
27
37
create index "foo.tableA.idx2" as select sum("foo.tableA.A1") FROM "foo.tableA" group by "foo.tableA.A2"
- query: select B."level2$array.field.1" from "foo.table$nested.repeated" as t, (select A."level2$array.field.1" from t."level0.field1" as Y, (select "level2$array.field.1" from Y."level1$field.1") as A) as B where id = 1
149
+
- explain: "SCAN(<,>) | TFILTER foo__2table__1nested__2repeated | FILTER _.ID EQUALS promote(@c38 AS LONG) | FLATMAP q0 -> { EXPLODE q0.level0.field1 | FLATMAP q1 -> { EXPLODE q1.level1$field.1 AS q2 RETURN q2 } AS q2 RETURN (q2.level2$array.field.1 AS level2$array.field.1) }"
150
+
- result: [{10}, {30}, {50}]
151
+
- # select from nested table
152
+
- query: select "level0.field1"."level1$field.1"."level2$field.1" from "foo.table$nested" where id = 1
0 commit comments