>From Ritik Raj <[email protected]>:

Ritik Raj has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20014 )


Change subject: [NO ISSUE][COMP] Restricting pushdown for array functions
......................................................................

[NO ISSUE][COMP] Restricting pushdown for array functions

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
Since array comparison is not supported for
filter-pushdown, hence restricting the functions
returning list as ResultTypeComputer.

Ext-ref: MB-67479
Change-Id: Ib3a4aa0715cf3b2fc0a1882d8b5114e88d0004f3
---
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.004.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.005.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.003.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.005.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.002.update.sqlpp
M 
asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/PushdownUtil.java
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.006.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.001.ddl.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.004.adm
M 
asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.006.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.003.query.sqlpp
13 files changed, 189 insertions(+), 0 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/14/20014/1

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.001.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.001.ddl.sqlpp
new file mode 100644
index 0000000..d327ee4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.001.ddl.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+DROP DATAVERSE test IF EXISTS;
+CREATE DATAVERSE test;
+
+USE test;
+
+CREATE COLLECTION ColumnDataset PRIMARY KEY (id: String)
+WITH {
+    "storage-format": {
+        "format": "column"
+     }
+};
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.002.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.002.update.sqlpp
new file mode 100644
index 0000000..7cfe67b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.002.update.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+INSERT INTO ColumnDataset ({
+     "id": "1",
+     "homo_array_field": [1, 2, 3],
+     "hetero_array_field": [1, "a", true]
+});
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.003.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.003.query.sqlpp
new file mode 100644
index 0000000..5fc3361
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.003.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+SELECT * FROM ColumnDataset
+WHERE homo_array_field = [1, 2, 3];
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.004.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.004.query.sqlpp
new file mode 100644
index 0000000..918de5e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.004.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+SELECT * FROM ColumnDataset
+WHERE hetero_array_field = [1, "a", true];
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.005.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.005.query.sqlpp
new file mode 100644
index 0000000..33834dc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.005.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+SET `import-private-functions` `true`;
+
+SELECT * FROM ColumnDataset
+WHERE hetero_array_field = `ordered-list-constructor`(1, "a", true);
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.006.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.006.query.sqlpp
new file mode 100644
index 0000000..6e2c9e2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/filter/return-array/return-array.006.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+SELECT * FROM ColumnDataset
+WHERE hetero_array_field = to_array([1, "a", true]);
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.003.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.003.adm
new file mode 100644
index 0000000..b7f7326
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.003.adm
@@ -0,0 +1 @@
+{ "ColumnDataset": { "id": "1", "homo_array_field": [ 1, 2, 3 ], 
"hetero_array_field": [ 1, "a", true ] } }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.004.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.004.adm
new file mode 100644
index 0000000..b7f7326
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.004.adm
@@ -0,0 +1 @@
+{ "ColumnDataset": { "id": "1", "homo_array_field": [ 1, 2, 3 ], 
"hetero_array_field": [ 1, "a", true ] } }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.005.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.005.adm
new file mode 100644
index 0000000..b7f7326
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.005.adm
@@ -0,0 +1 @@
+{ "ColumnDataset": { "id": "1", "homo_array_field": [ 1, 2, 3 ], 
"hetero_array_field": [ 1, "a", true ] } }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.006.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.006.adm
new file mode 100644
index 0000000..b7f7326
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/filter/return-array/return-array.006.adm
@@ -0,0 +1 @@
+{ "ColumnDataset": { "id": "1", "homo_array_field": [ 1, 2, 3 ], 
"hetero_array_field": [ 1, "a", true ] } }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
index c1cb43c..9f5cea8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
@@ -16624,6 +16624,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="column">
+      <compilation-unit name="filter/return-array">
+        <output-dir compare="Text">filter/return-array</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="column">
       <compilation-unit name="delete/001">
         <output-dir compare="Text">delete/001</output-dir>
       </compilation-unit>
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
index 5da5cea..4a54ce9 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
@@ -105,6 +105,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="column">
+      <compilation-unit name="filter/return-array">
+        <output-dir compare="Text">filter/return-array</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="column">
       <compilation-unit name="io/flush/ASTERIXDB-3597">
         <output-dir compare="Text">io/flush/ASTERIXDB-3597</output-dir>
       </compilation-unit>
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/PushdownUtil.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/PushdownUtil.java
index 316b559..896ce24 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/PushdownUtil.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/PushdownUtil.java
@@ -29,6 +29,8 @@
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.typecomputer.impl.ListConstructorTypeComputer;
+import org.apache.asterix.om.typecomputer.impl.OrderedListOfAnyTypeComputer;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.AUnionType;
@@ -184,6 +186,10 @@
     public static boolean isArrayOrAggregateFunction(FunctionIdentifier fid) {
         String functionName = fid.getName();
         return functionName.startsWith("array") || 
functionName.startsWith("strict") || functionName.startsWith("sql")
+                || BuiltinFunctions.getBuiltinFunctionInfo(fid)
+                        .getResultTypeComputer() instanceof 
OrderedListOfAnyTypeComputer
+                || BuiltinFunctions.getBuiltinFunctionInfo(fid)
+                        .getResultTypeComputer() instanceof 
ListConstructorTypeComputer
                 || BuiltinFunctions.GET_ITEM.equals(fid) || 
BuiltinFunctions.isBuiltinScalarAggregateFunction(fid)
                 || BuiltinFunctions.isBuiltinAggregateFunction(fid);
     }

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20014
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: ionic
Gerrit-Change-Id: Ib3a4aa0715cf3b2fc0a1882d8b5114e88d0004f3
Gerrit-Change-Number: 20014
Gerrit-PatchSet: 1
Gerrit-Owner: Ritik Raj <[email protected]>
Gerrit-MessageType: newchange

Reply via email to