blob: c5ad063a12c65c2f420e7741b4791854d0bbe275 [file] [log] [blame]
Yingyi Bu391f09e2015-10-29 13:49:39 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19/*
20 * Description : This test case is to verify the fix for issue827
21 * https://code.google.com/p/asterixdb/issues/detail?id=827
22 * Expected Res : SUCCESS
23 * Date : 3rd Dec. 2014
24 */
25
26drop database tpch if exists;
27create database tpch;
28
29use tpch;
30
31
32create type tpch.LineItemType as
33 closed {
34 l_orderkey : int32,
35 l_partkey : int32,
36 l_suppkey : int32,
37 l_linenumber : int32,
38 l_quantity : double,
39 l_extendedprice : double,
40 l_discount : double,
41 l_tax : double,
42 l_returnflag : string,
43 l_linestatus : string,
44 l_shipdate : string,
45 l_commitdate : string,
46 l_receiptdate : string,
47 l_shipinstruct : string,
48 l_shipmode : string,
49 l_comment : string
50}
51
52create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
53
54{'sum_qty_partial':tpch.sum((
55 select element i.l_quantity
56 from LineItem as i
57 where (i.l_shipdate <= '1998-09-02')
58)),'sum_base_price':tpch.sum((
59 select element i.l_extendedprice
60 from LineItem as i
61)),'sum_disc_price':tpch.sum((
62 select element (i.l_extendedprice * (1 - i.l_discount))
63 from LineItem as i
64)),'sum_charge':tpch.sum((
65 select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
66 from LineItem as i
67)),'ave_qty':tpch.avg((
68 select element i.l_quantity
69 from LineItem as i
70 where (i.l_shipdate <= '1998-09-02')
71)),'ave_price':tpch.avg((
72 select element i.l_extendedprice
73 from LineItem as i
74)),'ave_disc':tpch.avg((
75 select element i.l_discount
76 from LineItem as i
77)),'count_order':tpch.count((
78 select element l
79 from LineItem as l
80))};