blob: 923187ce494da9538b8b28d3bad5f9ab745b736a [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.
21 * DBLP has a secondary btree index on title, and given the 'indexnl' hint
22 * we expect the join to be transformed into an indexed nested-loop join.
23 * We expect the additional predicates to be put into a select above the
24 * 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 {
33 id: int32,
34 dblpid: string,
35 title: string,
36 authors: string,
37 misc: string
38}
39
40create type CSXType as closed {
41 id: int32,
42 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
54write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
55
56for $a in dataset('DBLP')
57for $b in dataset('CSX')
58where $a.title /*+ indexnl */ = $b.title and $a.authors < $b.authors and $a.misc > $b.misc
59return {"arec": $a, "brec": $b}