blob: 2ed73fb17efbe02797f5c875905cc3d621f78859 [file] [log] [blame]
/*
* 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.
*/
DROP DATAVERSE test IF EXISTS;
CREATE DATAVERSE test;
USE test;
CREATE TYPE OpenType AS {
uid: uuid
};
CREATE DATASET region(OpenType)
PRIMARY KEY uid AUTOGENERATED;
CREATE DATASET nation(OpenType)
PRIMARY KEY uid AUTOGENERATED;
CREATE DATASET customer(OpenType)
PRIMARY KEY uid AUTOGENERATED;
CREATE DATASET orders(OpenType)
PRIMARY KEY uid AUTOGENERATED;
CREATE DATASET lineitem(OpenType)
PRIMARY KEY uid AUTOGENERATED;
CREATE DATASET supplier(OpenType)
PRIMARY KEY uid AUTOGENERATED;
SELECT VALUE COUNT(*)
FROM region r, nation n, customer c, orders o, lineitem l, supplier s
WHERE c.c_custkey = o.o_custkey
AND l.l_orderkey = o.o_orderkey
AND l.l_suppkey = s.s_suppkey
AND s.s_nationkey = n.n_nationkey
AND c.c_nationkey = n.n_nationkey
-- this predicate should be eliminated as it is implicitly
-- inferred by the two predicates above
AND c.c_nationkey = s.s_nationkey
AND n.n_regionkey = r.r_regionkey
AND r.r_name = 'EUROPE'
AND o.o_orderdate >= '1993-01-01'
AND o.o_orderdate < '1993-04-01';