http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-45.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-45.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-45.aql new file mode 100644 index 0000000..68fe56c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-45.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is NOT used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +// Negative test - prefix search + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-43.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname = "Julio" and $emp.nested.lname < "Xu" +return $emp
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-46.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-46.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-46.aql new file mode 100644 index 0000000..bd52b20 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-46.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is NOT used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-44.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Michael" and $emp.nested.lname <= "Xu" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-47.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-47.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-47.aql new file mode 100644 index 0000000..d611ab5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-47.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-45.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname > "Craig" and $emp.nested.lname > "Kevin" and $emp.nested.fname < "Mary" and $emp.nested.lname < "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-48.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-48.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-48.aql new file mode 100644 index 0000000..2e95662 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-48.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-46.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Craig" and $emp.nested.lname >= "Kevin" and $emp.nested.fname <= "Mary" and $emp.nested.lname <= "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-49.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-49.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-49.aql new file mode 100644 index 0000000..49ebe6e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-49.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is NOT used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-47.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname <= "Craig" and $emp.nested.lname > "Kevin" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-51.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-51.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-51.aql new file mode 100644 index 0000000..1beb7a1 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-51.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-49.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname > "Craig" and $emp.nested.lname > "Kevin" and $emp.nested.fname <= "Mary" and $emp.nested.lname <= "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-52.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-52.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-52.aql new file mode 100644 index 0000000..a923d50 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-52.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-50.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Craig" and $emp.nested.lname >= "Kevin" and $emp.nested.fname < "Mary" and $emp.nested.lname < "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-53.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-53.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-53.aql new file mode 100644 index 0000000..d688ca0 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-53.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-51.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname:string?,nested.lname:string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Craig" and $emp.nested.lname <= "Kevin" and $emp.nested.fname <= "Mary" and $emp.nested.lname >= "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-54.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-54.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-54.aql new file mode 100644 index 0000000..ec20642 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-54.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-52.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname > "Max" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-55.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-55.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-55.aql new file mode 100644 index 0000000..f06f66b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-55.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-53.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Sofia" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-56.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-56.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-56.aql new file mode 100644 index 0000000..7767eae --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-56.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-54.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname < "Chen" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-57.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-57.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-57.aql new file mode 100644 index 0000000..ad37e48 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-57.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-55.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname <= "Julio" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-58.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-58.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-58.aql new file mode 100644 index 0000000..54d5620 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-58.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the primary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-primary-56.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname > "Neil" and $emp.nested.fname < "Roger" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-59.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-59.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-59.aql new file mode 100644 index 0000000..31de2dc --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-59.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-57.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname >= "Max" and $emp.nested.fname <= "Roger" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-60.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-60.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-60.aql new file mode 100644 index 0000000..90ac78d --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-60.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-58.adm"; + +create type TestTypetmp as open { + id : int32, + lname : string +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname = "Max" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-61.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-61.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-61.aql new file mode 100644 index 0000000..468ff65 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-61.aql @@ -0,0 +1,47 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 13th Aug 2012 + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-59.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?,nested.lname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname > "Craig" and $emp.nested.lname > "Kevin" and $emp.nested.fname <= "Mary" and $emp.nested.lname < "Tomes" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-62.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-62.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-62.aql new file mode 100644 index 0000000..9d4747a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-62.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 11th Nov 2014 + */ + +// Positive test - prefix search + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-62.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?,nested.lname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname = "Julio" and $emp.nested.lname > "Xu" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-63.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-63.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-63.aql new file mode 100644 index 0000000..3d7f09d --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index/btree-secondary-63.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : BTree Index verification test + * : This test is intended to verify that the secondary BTree index is used + * : in the optimized query plan. + * Expected Result : Success + * Date : 11th Nov 2014 + */ + +// Positive test - prefix search + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +write output to asterix_nc1:"rttest/btree-index_btree-secondary-63.adm"; + +create type TestTypetmp as open { + id : int32 +} + +create type TestType as open { + nested : TestTypetmp +} + +create dataset testdst(TestType) primary key nested.id; + +create index sec_Idx on testdst(nested.fname: string?,nested.lname: string?) enforced; + +for $emp in dataset('testdst') +where $emp.nested.fname < "Julio" and $emp.nested.lname = "Xu" +return $emp http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains-panic.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains-panic.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains-panic.aql new file mode 100644 index 0000000..5deef93 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains-panic.aql @@ -0,0 +1,50 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the contains function. + * The index should *not* be applied (see below). + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-contains-panic.adm"; + +// Cannot optimize this query because the string constant is shorter than the gram length. +for $o in dataset('DBLP') +where contains($o.nested.title, "Mu") +order by $o.nested.id +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains.aql new file mode 100644 index 0000000..91dea54 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-contains.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the contains function. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-contains.adm"; + +for $o in dataset('DBLP') +where contains($o.nested.title, "Multimedia") +order by $o.nested.id +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance-check.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance-check.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance-check.aql new file mode 100644 index 0000000..601b5d4 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance-check.aql @@ -0,0 +1,48 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-edit-distance-check.adm"; + +for $o in dataset('DBLP') +where edit-distance-check($o.nested.authors, "Amihay Motro", 1)[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance.aql new file mode 100644 index 0000000..98aca8b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-edit-distance.aql @@ -0,0 +1,48 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance function on strings. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-edit-distance.adm"; + +for $o in dataset('DBLP') +where edit-distance($o.nested.authors, "Amihay Motro") <= 1 +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.aql new file mode 100644 index 0000000..c73d0cf --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.aql @@ -0,0 +1,51 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query with ~= using edit-distance on strings. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm"; + +set simfunction 'edit-distance'; +set simthreshold '1'; + +for $o in dataset('DBLP') +where $o.nested.authors ~= "Amihay Motro" +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.aql new file mode 100644 index 0000000..02740e0 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.aql @@ -0,0 +1,52 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query with ~= using Jaccard on 3-gram tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; +set import-private-functions 'true'; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm"; + +set simfunction 'jaccard'; +set simthreshold '0.8f'; + +for $o in dataset('DBLP') +where gram-tokens($o.nested.title, 3, false) ~= gram-tokens("Transactions for Cooperative Environments", 3, false) +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard-check.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard-check.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard-check.aql new file mode 100644 index 0000000..36a1ecf --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard-check.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard-check function on 3-gram tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; +set import-private-functions 'true'; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-jaccard-check.adm"; + +for $o in dataset('DBLP') +where similarity-jaccard-check(gram-tokens($o.nested.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f)[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard.aql new file mode 100644 index 0000000..5c3ec7e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/ngram-jaccard.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard function on 3-gram tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; +set import-private-functions 'true'; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_ngram-jaccard.adm"; + +for $o in dataset('DBLP') +where similarity-jaccard(gram-tokens($o.nested.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false)) >= 0.5f +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-contains.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-contains.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-contains.aql new file mode 100644 index 0000000..229ee52 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-contains.aql @@ -0,0 +1,50 @@ +/* + * 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. + */ +/* + * Description : Tests whether a keyword index is applied to optimize a selection query using the contains function. + * The index should *not* be applied (see below). + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index keyword_index on DBLP(nested.title: string?) type keyword enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_word-contains.adm"; + +// Contains cannot be answered with a word inverted index. +for $o in dataset('DBLP') +where contains($o.nested.title, "Multimedia") +order by $o.nested.id +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.aql new file mode 100644 index 0000000..3dd9b51 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.aql @@ -0,0 +1,51 @@ +/* + * 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. + */ +/* + * Description : Tests whether a keyword is applied to optimize a selection query with ~= using Jaccard on word tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index keyword_index on DBLP(nested.title: string?) type keyword enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm"; + +set simfunction 'jaccard'; +set simthreshold '0.5f'; + +for $o in dataset('DBLP') +where word-tokens($o.nested.title) ~= word-tokens("Transactions for Cooperative Environments") +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard-check.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard-check.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard-check.aql new file mode 100644 index 0000000..f5d9a78 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard-check.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : Tests whether a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index keyword_index on DBLP(nested.title: string?) type keyword enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_word-jaccard-check.adm"; + +for $o in dataset('DBLP') +where similarity-jaccard-check(word-tokens($o.nested.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)[0] +return $o + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard.aql new file mode 100644 index 0000000..fafbf71 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-basic/word-jaccard.aql @@ -0,0 +1,49 @@ +/* + * 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. + */ +/* + * Description : Tests whether a keyword index is applied to optimize a selection query using the similarity-jaccard function on word tokens. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index keyword_index on DBLP(nested.title: string?) type keyword enforced; + +write output to asterix_nc1:"rttest/inverted-index-basic_word-jaccard.adm"; + +for $o in dataset('DBLP') +where similarity-jaccard(word-tokens($o.nested.title), word-tokens("Transactions for Cooperative Environments")) >= 0.5f +return $o + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.aql new file mode 100644 index 0000000..71381ee --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.aql @@ -0,0 +1,53 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using + * two edit-distance-check function of which only the first can be optimized with an index. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"; + +// Only the first edit-distance-check can be optimized with an index. +for $o in dataset('DBLP') +let $eda := edit-distance-check($o.nested.authors, "Amihay Motro", 3) +let $edb := edit-distance-check($o.nested.authors, "Amihay Motro", 5) +where $eda[0] and $edb[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.aql new file mode 100644 index 0000000..cf14fd7 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.aql @@ -0,0 +1,53 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using + * two edit-distance-check function of which only the second can be optimized with an index. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"; + +// Only the second edit-distance-check can be optimized with an index. +for $o in dataset('DBLP') +let $edb := edit-distance-check($o.nested.authors, "Amihay Motro", 5) +let $eda := edit-distance-check($o.nested.authors, "Amihay Motro", 3) +where $edb[0] and $eda[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.aql new file mode 100644 index 0000000..b54f365 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.aql @@ -0,0 +1,50 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + title: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.authors: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let.adm"; + +for $o in dataset('DBLP') +let $ed := edit-distance-check($o.nested.authors, "Amihay Motro", 1) +where $ed[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.aql new file mode 100644 index 0000000..7fd8079 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.aql @@ -0,0 +1,52 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field. + * Tests that the optimizer rule correctly drills through the substring function. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPNestedType as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested: DBLPNestedType +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm"; + +for $paper in dataset('DBLP') +where edit-distance-check(substring($paper.nested.title, 0, 8), "datbase", 1)[0] +return { + "id" : $paper.nested.id, + "title" : $paper.nested.title +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.aql new file mode 100644 index 0000000..8c70a1c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.aql @@ -0,0 +1,51 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard-check function on 3-gram tokens. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; +set import-private-functions 'true'; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-jaccard-check-let.adm"; + +for $o in dataset('DBLP') +let $jacc := similarity-jaccard-check(gram-tokens($o.nested.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f) +where $jacc[0] +return $o http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.aql new file mode 100644 index 0000000..cfa6247 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.aql @@ -0,0 +1,54 @@ +/* + * 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. + */ +/* + * Description : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard-check function on 3-gram tokens. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; +set import-private-functions 'true'; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index ngram_index on DBLP(nested.title: string?) type ngram(3) enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm"; + +// This test is complex because we have three assigns to drill into. +for $paper in dataset('DBLP') +let $paper_tokens := gram-tokens($paper.nested.title, 3, false) +let $query_tokens := gram-tokens("Transactions for Cooperative Environments", 3, false) +let $jacc := similarity-jaccard-check($paper_tokens, $query_tokens, 0.5f) +where $jacc[0] +return {"Paper": $paper_tokens, "Query": $query_tokens } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/word-jaccard-check-let.aql ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/word-jaccard-check-let.aql b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/word-jaccard-check-let.aql new file mode 100644 index 0000000..82b1cd5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-complex/word-jaccard-check-let.aql @@ -0,0 +1,51 @@ +/* + * 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. + */ +/* + * Description : Tests whether a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens. + * Tests that the optimizer rule correctly drills through the let clauses. + * The index should be applied. + * Success : Yes + */ + +drop dataverse test if exists; +create dataverse test; +use dataverse test; + +create type DBLPTypetmp as open { + id: int32, + dblpid: string, + authors: string, + misc: string +} + +create type DBLPType as closed { + nested : DBLPTypetmp +} + +create dataset DBLP(DBLPType) primary key nested.id; + +create index keyword_index on DBLP(nested.title: string?) type keyword enforced; + +write output to asterix_nc1:"rttest/inverted-index-complex_word-jaccard-check-let.adm"; + +for $o in dataset('DBLP') +let $jacc := similarity-jaccard-check(word-tokens($o.nested.title), word-tokens("Transactions for Cooperative Environments"), 0.5f) +where $jacc[0] +return $o +
