-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: Iae10a9a8b2f64117fd2272dcc80dc0d2d375ef0f
- Loading branch information
Showing
69 changed files
with
3,040 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
asterixdb/asterix-app/src/test/resources/optimizerts/queries/ch2/ch2_q10.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Test plan for CH2 Q10 | ||
*/ | ||
|
||
drop dataverse test if exists; | ||
create dataverse test; | ||
use test; | ||
|
||
create dataset warehouse(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset district(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset customer(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset history(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset orders(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset neworder(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset supplier(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset item(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset stock(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset nation(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset region(id uuid not unknown) open type primary key `id` autogenerated; | ||
|
||
SELECT c.c_id, c.c_last, SUM(ol.ol_amount) as revenue, c.c_city, c.c_phone, n.n_name | ||
FROM nation n, customer c, orders o, o.o_orderline ol | ||
WHERE c.c_id = o.o_c_id | ||
AND c.c_w_id = o.o_w_id | ||
AND c.c_d_id = o.o_d_id | ||
AND o.o_entry_d >= '2015-10-01 00:00:00.000000' | ||
AND o.o_entry_d < '2016-01-01 00:00:00.000000' | ||
AND n.n_nationkey = string_to_codepoint(c.c_state)[0] | ||
GROUP BY c.c_id, c.c_last, c.c_city, c.c_phone, n.n_name | ||
ORDER BY revenue DESC | ||
LIMIT 20; |
52 changes: 52 additions & 0 deletions
52
asterixdb/asterix-app/src/test/resources/optimizerts/queries/ch2/ch2_q11.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Test plan for CH2 Q11 | ||
*/ | ||
|
||
drop dataverse test if exists; | ||
create dataverse test; | ||
use test; | ||
|
||
create dataset warehouse(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset district(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset customer(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset history(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset orders(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset neworder(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset supplier(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset item(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset stock(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset nation(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset region(id uuid not unknown) open type primary key `id` autogenerated; | ||
|
||
SELECT s.s_i_id, SUM(s.s_order_cnt) as ordercount | ||
FROM nation n, supplier su, stock s | ||
WHERE s.s_w_id * s.s_i_id MOD 10000 = su.su_suppkey | ||
AND su.su_nationkey = n.n_nationkey | ||
AND n.n_name = 'Germany' | ||
GROUP BY s.s_i_id | ||
HAVING SUM(s.s_order_cnt) > | ||
(SELECT VALUE SUM(s1.s_order_cnt) * 0.00005 | ||
FROM nation n1, supplier su1, stock s1 | ||
WHERE s1.s_w_id * s1.s_i_id MOD 10000 = su1.su_suppkey | ||
AND su1.su_nationkey = n1.n_nationkey | ||
AND n1.n_name = 'Germany')[0] | ||
ORDER BY ordercount DESC; |
49 changes: 49 additions & 0 deletions
49
asterixdb/asterix-app/src/test/resources/optimizerts/queries/ch2/ch2_q12.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Test plan for CH2 Q12 | ||
*/ | ||
|
||
drop dataverse test if exists; | ||
create dataverse test; | ||
use test; | ||
|
||
create dataset warehouse(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset district(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset customer(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset history(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset orders(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset neworder(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset supplier(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset item(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset stock(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset nation(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset region(id uuid not unknown) open type primary key `id` autogenerated; | ||
|
||
SELECT o.o_ol_cnt, | ||
SUM (case WHEN o.o_carrier_id = 1 or o.o_carrier_id = 2 | ||
THEN 1 ELSE 0 END) AS high_line_COUNT, | ||
SUM (case WHEN o.o_carrier_id <> 1 AND o.o_carrier_id <> 2 | ||
THEN 1 ELSE 0 END) AS low_line_COUNT | ||
FROM orders o, o.o_orderline ol | ||
WHERE o.o_entry_d <= ol.ol_delivery_d | ||
AND ol.ol_delivery_d >= '2016-01-01 00:00:00.000000' AND ol.ol_delivery_d < '2017-01-01 00:00:00.000000' | ||
GROUP BY o.o_ol_cnt | ||
ORDER BY o.o_ol_cnt; |
49 changes: 49 additions & 0 deletions
49
asterixdb/asterix-app/src/test/resources/optimizerts/queries/ch2/ch2_q13.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Test plan for CH2 Q13 | ||
*/ | ||
|
||
drop dataverse test if exists; | ||
create dataverse test; | ||
use test; | ||
|
||
create dataset warehouse(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset district(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset customer(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset history(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset orders(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset neworder(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset supplier(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset item(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset stock(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset nation(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset region(id uuid not unknown) open type primary key `id` autogenerated; | ||
|
||
SELECT c_orders.c_count, COUNT(*) as custdist | ||
FROM (SELECT c.c_id, COUNT(o.o_id) as c_count | ||
FROM customer c LEFT OUTER JOIN orders o ON ( | ||
c.c_w_id = o.o_w_id | ||
AND c.c_d_id = o.o_d_id | ||
AND c.c_id = o.o_c_id | ||
AND o.o_carrier_id > 8) | ||
GROUP BY c.c_id) as c_orders | ||
GROUP BY c_orders.c_count | ||
ORDER BY custdist DESC, c_orders.c_count DESC; |
44 changes: 44 additions & 0 deletions
44
asterixdb/asterix-app/src/test/resources/optimizerts/queries/ch2/ch2_q14.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Test plan for CH2 Q14 | ||
*/ | ||
|
||
drop dataverse test if exists; | ||
create dataverse test; | ||
use test; | ||
|
||
create dataset warehouse(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset district(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset customer(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset history(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset orders(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset neworder(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset supplier(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset item(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset stock(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset nation(id uuid not unknown) open type primary key `id` autogenerated; | ||
create dataset region(id uuid not unknown) open type primary key `id` autogenerated; | ||
|
||
SELECT 100.00 * SUM(CASE WHEN i.i_data LIKE 'pr%' | ||
THEN ol.ol_amount ELSE 0 END) / (1+SUM(ol.ol_amount)) AS promo_revenue | ||
FROM item i, orders o, o.o_orderline ol | ||
WHERE ol.ol_i_id = i.i_id | ||
AND ol.ol_delivery_d >= '2017-09-01 00:00:00.000000' AND ol.ol_delivery_d < '2017-10-01 00:00:00.000000'; |
Oops, something went wrong.