Skip to content

Commit 59d658d

Browse files
committed
tests added
1 parent f2f76d2 commit 59d658d

14 files changed

Lines changed: 1064 additions & 0 deletions

File tree

connector/query_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ var tests = []test{
141141
group: "payments",
142142
name: "search_after_multiple_sorts",
143143
},
144+
{
145+
group: "flights_nested_flattened",
146+
name: "nested_filtering",
147+
},
148+
{
149+
group: "flights_nested_flattened",
150+
name: "nested_filtering_and",
151+
},
152+
{
153+
group: "flights_nested_flattened",
154+
name: "nested_filtering_range",
155+
},
156+
{
157+
group: "flights_nested_flattened",
158+
name: "nested_filtering_or",
159+
},
144160
}
145161

146162
func TestPrepareElasticsearchQuery(t *testing.T) {
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"indices": {
3+
"flights": {
4+
"mappings": {
5+
"properties": {
6+
"aircraft": {
7+
"type": "keyword"
8+
},
9+
"code": {
10+
"type": "keyword"
11+
},
12+
"passengers": {
13+
"type": "integer"
14+
},
15+
"route": {
16+
"properties": {
17+
"arrival_airport": {
18+
"properties": {
19+
"code": {
20+
"type": "keyword"
21+
},
22+
"location": {
23+
"properties": {
24+
"coordinates": {
25+
"properties": {
26+
"elevation": {
27+
"type": "float"
28+
},
29+
"latitude": {
30+
"type": "float"
31+
},
32+
"longitude": {
33+
"type": "float"
34+
}
35+
}
36+
},
37+
"country": {
38+
"type": "keyword"
39+
},
40+
"state": {
41+
"type": "keyword"
42+
}
43+
}
44+
},
45+
"name": {
46+
"type": "text"
47+
},
48+
"runways": {
49+
"type": "integer"
50+
},
51+
"terminals": {
52+
"type": "integer"
53+
}
54+
}
55+
},
56+
"departure_airport": {
57+
"properties": {
58+
"code": {
59+
"type": "keyword"
60+
},
61+
"location": {
62+
"properties": {
63+
"coordinates": {
64+
"properties": {
65+
"elevation": {
66+
"type": "float"
67+
},
68+
"latitude": {
69+
"type": "float"
70+
},
71+
"longitude": {
72+
"type": "float"
73+
}
74+
}
75+
},
76+
"country": {
77+
"type": "keyword"
78+
},
79+
"state": {
80+
"type": "keyword"
81+
}
82+
}
83+
},
84+
"name": {
85+
"type": "text"
86+
},
87+
"runways": {
88+
"type": "integer"
89+
},
90+
"terminals": {
91+
"type": "integer"
92+
}
93+
}
94+
},
95+
"travel_time": {
96+
"type": "integer"
97+
}
98+
}
99+
}
100+
}
101+
}
102+
}
103+
},
104+
"queries": {}
105+
}
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
"arguments": {},
3+
"collection": "flights",
4+
"collection_relationships": {},
5+
"query": {
6+
"fields": {
7+
"aircraft": {
8+
"column": "aircraft",
9+
"type": "column"
10+
},
11+
"code": {
12+
"column": "code",
13+
"type": "column"
14+
},
15+
"id": {
16+
"column": "_id",
17+
"type": "column"
18+
},
19+
"passengers": {
20+
"column": "passengers",
21+
"type": "column"
22+
},
23+
"route": {
24+
"column": "route",
25+
"fields": {
26+
"fields": {
27+
"fields": {
28+
"arrivalAirport": {
29+
"column": "arrival_airport",
30+
"fields": {
31+
"fields": {
32+
"fields": {
33+
"code": {
34+
"column": "code",
35+
"type": "column"
36+
},
37+
"location": {
38+
"column": "location",
39+
"fields": {
40+
"fields": {
41+
"fields": {
42+
"coordinates": {
43+
"column": "coordinates",
44+
"fields": {
45+
"fields": {
46+
"fields": {
47+
"elevation": {
48+
"column": "elevation",
49+
"type": "column"
50+
},
51+
"latitude": {
52+
"column": "latitude",
53+
"type": "column"
54+
},
55+
"longitude": {
56+
"column": "longitude",
57+
"type": "column"
58+
}
59+
},
60+
"type": "object"
61+
},
62+
"type": "array"
63+
},
64+
"type": "column"
65+
},
66+
"country": {
67+
"column": "country",
68+
"type": "column"
69+
},
70+
"state": {
71+
"column": "state",
72+
"type": "column"
73+
}
74+
},
75+
"type": "object"
76+
},
77+
"type": "array"
78+
},
79+
"type": "column"
80+
},
81+
"name": {
82+
"column": "name",
83+
"type": "column"
84+
},
85+
"runways": {
86+
"column": "runways",
87+
"type": "column"
88+
},
89+
"terminals": {
90+
"column": "terminals",
91+
"type": "column"
92+
}
93+
},
94+
"type": "object"
95+
},
96+
"type": "array"
97+
},
98+
"type": "column"
99+
},
100+
"departureAirport": {
101+
"column": "departure_airport",
102+
"fields": {
103+
"fields": {
104+
"fields": {
105+
"code": {
106+
"column": "code",
107+
"type": "column"
108+
},
109+
"location": {
110+
"column": "location",
111+
"fields": {
112+
"fields": {
113+
"fields": {
114+
"coordinates": {
115+
"column": "coordinates",
116+
"fields": {
117+
"fields": {
118+
"fields": {
119+
"elevation": {
120+
"column": "elevation",
121+
"type": "column"
122+
},
123+
"latitude": {
124+
"column": "latitude",
125+
"type": "column"
126+
},
127+
"longitude": {
128+
"column": "longitude",
129+
"type": "column"
130+
}
131+
},
132+
"type": "object"
133+
},
134+
"type": "array"
135+
},
136+
"type": "column"
137+
},
138+
"country": {
139+
"column": "country",
140+
"type": "column"
141+
},
142+
"state": {
143+
"column": "state",
144+
"type": "column"
145+
}
146+
},
147+
"type": "object"
148+
},
149+
"type": "array"
150+
},
151+
"type": "column"
152+
},
153+
"name": {
154+
"column": "name",
155+
"type": "column"
156+
},
157+
"runways": {
158+
"column": "runways",
159+
"type": "column"
160+
},
161+
"terminals": {
162+
"column": "terminals",
163+
"type": "column"
164+
}
165+
},
166+
"type": "object"
167+
},
168+
"type": "array"
169+
},
170+
"type": "column"
171+
},
172+
"travelTime": {
173+
"column": "travel_time",
174+
"type": "column"
175+
}
176+
},
177+
"type": "object"
178+
},
179+
"type": "array"
180+
},
181+
"type": "column"
182+
}
183+
},
184+
"predicate": {
185+
"in_collection": {
186+
"column_name": "route",
187+
"type": "nested_collection"
188+
},
189+
"predicate": {
190+
"in_collection": {
191+
"column_name": "departure_airport",
192+
"type": "nested_collection"
193+
},
194+
"predicate": {
195+
"in_collection": {
196+
"column_name": "location",
197+
"type": "nested_collection"
198+
},
199+
"predicate": {
200+
"column": {
201+
"type": "column",
202+
"name": "state"
203+
},
204+
"operator": "prefix",
205+
"type": "binary_comparison_operator",
206+
"value": {
207+
"type": "scalar",
208+
"value": "T"
209+
}
210+
},
211+
"type": "exists"
212+
},
213+
"type": "exists"
214+
},
215+
"type": "exists"
216+
}
217+
}
218+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
query MyQuery {
2+
flights(
3+
args: {}
4+
where: {
5+
route: { departureAirport: { location: { state: { prefix: "T" } } } }
6+
}
7+
) {
8+
route {
9+
arrivalAirport {
10+
location {
11+
coordinates {
12+
elevation
13+
longitude
14+
latitude
15+
}
16+
country
17+
state
18+
}
19+
code
20+
name
21+
runways
22+
terminals
23+
}
24+
departureAirport {
25+
location {
26+
coordinates {
27+
latitude
28+
longitude
29+
elevation
30+
}
31+
country
32+
state
33+
}
34+
code
35+
terminals
36+
runways
37+
name
38+
}
39+
travelTime
40+
}
41+
code
42+
aircraft
43+
id
44+
passengers
45+
}
46+
}

0 commit comments

Comments
 (0)