blob: 08007843d0bb3e78d84825ecc046f41b94f0c725 [file] [log] [blame]
/*
* Description : Equi joins two datasets, Customers and Orders, based on the customer id.
* Given the 'indexnl' hint we expect the join to be transformed
* into an indexed nested-loop join using Customers' primary index.
* Success : Yes
*/
drop dataverse test if exists;
create dataverse test;
use dataverse test;
create type AddressType as open {
number: int32,
street: string,
city: string
}
create type CustomerType as closed {
cid: int32,
name: string,
cashBack: int32,
age: int32?,
address: AddressType?,
lastorder: {
oid: int32,
total: float
}
}
create type OrderType as open {
oid: int32,
cid: int32,
orderstatus: string,
orderpriority: string,
clerk: string,
total: float,
items: [int32]
}
create dataset Customers(CustomerType) primary key cid;
create dataset Orders(OrderType) primary key oid;
load dataset Customers
using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
(("path"="nc1://data/nontagged/customerData.json"),("format"="adm"));
load dataset Orders
using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
(("path"="nc1://data/nontagged/orderData.json"),("format"="adm"));
write output to nc1:"rttest/index-join_btree-primary-equi-join.adm";
for $c in dataset('Customers')
for $o in dataset('Orders')
where $c.cid /*+ indexnl */ = $o.cid
order by $c.cid, $o.oid
return {"cid":$c.cid, "oid": $o.oid}