| /* |
| * Description : Tests whether a keyword index is applied to optimize a selection query using the edit-distance-check function on lists. |
| * The index should *not* be applied (see below). |
| * Success : Yes |
| */ |
| |
| drop dataverse test if exists; |
| create dataverse test; |
| use dataverse test; |
| |
| create type AddressType as closed { |
| number: int32, |
| street: string, |
| city: string |
| } |
| |
| create type CustomerType as closed { |
| cid: int32, |
| name: string, |
| age: int32?, |
| address: AddressType?, |
| interests: [string], |
| children: [ { name: string, age: int32? } ] |
| } |
| |
| create dataset Customers(CustomerType) partitioned by key cid; |
| |
| load dataset Customers |
| using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| (("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm")); |
| |
| create index interests_index on Customers(interests) type keyword; |
| |
| write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-check-panic.adm"; |
| |
| // Index should not be applied because all list elements can be modified by 3 edit operations. |
| for $c in dataset('Customers') |
| where edit-distance-check($c.interests, ["computers", "wine", "walking"], 3)[0] |
| order by $c.cid |
| return $c |