blob: bffaf9ce44e73e03d721398a32378aac61319e95 [file] [log] [blame]
alexander.behm3caae9e2012-11-08 04:50:20 +00001/*
Ian Maxon857dc132015-09-25 17:13:19 -07002 * 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/*
alexander.behm3caae9e2012-11-08 04:50:20 +000020 * Description : Equi joins two datasets, DBLP and CSX, based on their title.
Taewoo Kimd185e8ea2016-02-02 21:17:00 -080021 * DBLP has a secondary btree index on title, and given the 'indexnl' hint
alexander.behm3caae9e2012-11-08 04:50:20 +000022 * we expect the join to be transformed into an indexed nested-loop join.
Taewoo Kimd185e8ea2016-02-02 21:17:00 -080023 * We expect the additional predicates to be put into a select above the
alexander.behm3caae9e2012-11-08 04:50:20 +000024 * primary index search.
25 * Success : Yes
26 */
27
28drop dataverse test if exists;
29create dataverse test;
30use dataverse test;
31
32create type DBLPType as closed {
Taewoo Kimd185e8ea2016-02-02 21:17:00 -080033 id: int32,
alexander.behm3caae9e2012-11-08 04:50:20 +000034 dblpid: string,
35 title: string,
36 authors: string,
37 misc: string
38}
39
40create type CSXType as closed {
Taewoo Kimd185e8ea2016-02-02 21:17:00 -080041 id: int32,
alexander.behm3caae9e2012-11-08 04:50:20 +000042 csxid: string,
43 title: string,
44 authors: string,
45 misc: string
46}
47
ramangrover29669d8f62013-02-11 06:03:32 +000048create dataset DBLP(DBLPType) primary key id;
alexander.behm3caae9e2012-11-08 04:50:20 +000049
ramangrover29669d8f62013-02-11 06:03:32 +000050create dataset CSX(CSXType) primary key id;
alexander.behm3caae9e2012-11-08 04:50:20 +000051
alexander.behm3caae9e2012-11-08 04:50:20 +000052create index title_index on DBLP(title);
53
Ian Maxonf7b64532015-12-09 17:28:18 -080054write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
alexander.behm3caae9e2012-11-08 04:50:20 +000055
alexander.behm3caae9e2012-11-08 04:50:20 +000056for $b in dataset('CSX')
Taewoo Kimd185e8ea2016-02-02 21:17:00 -080057for $a in dataset('DBLP')
alexander.behm3caae9e2012-11-08 04:50:20 +000058where $a.title /*+ indexnl */ = $b.title and $a.authors < $b.authors and $a.misc > $b.misc
59return {"arec": $a, "brec": $b}