Ali Alsuliman has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/3222
Change subject: [ASTERIXDB-2516][RT] add support for record deep comparison ...................................................................... [ASTERIXDB-2516][RT] add support for record deep comparison - user model changes: no - storage format changes: no - interface changes: no Details: Add support for record deep comparison. - modified LogicalComplexBinaryComparator to allow record comparison - added test cases for record comparison - modified PointableAllocator to allow freeing record visitable pointables Change-Id: I3e8bfbb014b86295749e980d123b0d3edf079beb --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.001.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.002.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.003.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.004.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.005.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.006.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.007.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.008.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.009.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.010.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.011.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.012.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.013.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.adm D asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.003.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.004.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.005.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.006.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.007.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.008.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.009.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.010.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.011.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.012.adm M asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/LogicalComplexBinaryComparator.java M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/PointableAllocator.java M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/container/IObjectPool.java 40 files changed, 644 insertions(+), 197 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/22/3222/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.001.ddl.sqlpp new file mode 100644 index 0000000..39f0991 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.001.ddl.sqlpp @@ -0,0 +1,29 @@ +/* + * 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 type openType as {id:int}; +create type recType as {name:string, age:int, colors:[string]}; +create type closedType as closed {id:int, subRec:recType?}; + +create dataset openDs(openType) primary key id; +create dataset closedDs(closedType) primary key id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.002.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.002.update.sqlpp new file mode 100644 index 0000000..1ba7ad6 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.002.update.sqlpp @@ -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. + */ + +use test; + +insert into closedDs([ +{"id":1, "subRec": {"name": "john", "age": 28, "colors": ["green", "black", "orange"]} }, +{"id":2, "subRec": {"name": "david", "age": 100, "colors": ["white", "blue"]} }, +{"id":3, "subRec": {"name": "jones", "age": 105, "colors": ["purple", "blue"]} }, +{"id":4, "subRec": null}, +{"id":5, "subRec": {"name": "mat", "age": 10, "colors": ["yellow", "blue"]} }, +{"id":6, "subRec": {"name": "jones", "age": 45, "colors": ["purple", "blue"]} }, +{"id":7, "subRec": {"name": "jones", "age": 105, "colors": ["purple", "blue"]} }, +{"id":8, "subRec": null}, +{"id":9, "subRec": {"name": "mat", "age": 10, "colors": ["blue", "yellow"]} } +]); + +insert into openDs([ +{"id":1, "subRec": {"name": "john", "age": 28, "colors": ["green", "black", "orange"]} }, +{"id":2, "subRec": {"name": "david", "age": 100, "colors": ["white", "blue"]} }, +{"id":3, "subRec": {"name": "jones", "age": 105, "colors": ["purple", "blue"]} }, +{"id":4, "subRec": null}, +{"id":5, "subRec": {"name": "mat", "age": 10, "colors": ["yellow", "blue"]} }, +{"id":6, "subRec": {"name": "jones", "age": 45, "colors": ["purple", "blue"]} }, +{"id":7, "subRec": {"name": "jones", "age": 105, "colors": ["purple", "blue"]} }, +{"id":8}, +{"id":9, "subRec": {"name": "mat", "age": 10, "colors": ["blue", "yellow"]} }, +{"id":10}, +{"id":11, "subRec": {"name": null, "age": 28, "colors": ["green", "black", "orange"]} }, +{"id":12, "subRec": {"name": "david", "age": "100", "colors": ["white", "blue"]} }, +{"id":13, "subRec": {"name": "jones", "age": 105, "colors": ["purple", 3, "green"]} }, +{"id":14, "subRec": null}, +{"id":15, "subRec": {"age": 28, "colors": ["green", "black", "orange"]} }, +{"id":16, "subRec": {"name": "john", "age": 28, "colors": [missing, "black", "orange"]} }, +{"id":17, "subRec": {"name": "jones", "age": 45, "colors": ["purple", "blue"], "nested": {"x": 2, "y": "str"}} }, +{"id":18, "subRec": {"name": "john", "age": 28, "colors": ["green", null, "orange"]} }, +{"id":19, "subRec": {"name": "mat", "age": 10, "colors": ["yellow", "blue"], "extraF": 33} } +]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.003.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.003.query.sqlpp new file mode 100644 index 0000000..49cb459 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.003.query.sqlpp @@ -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. + */ + +// basic =,!= comparisons + +use test; + +{ +"t1": {"c": "{'name': 'john', 'id': 231} = {'name': 'john', 'id': 231}", "r": {'name': 'john', 'id': 231} = {'name': 'john', 'id': 231}}, +"t2": {"c": "{'name': 'john', 'id': 231} != {'name': 'john', 'id': 231}", "r": {'name': 'john', 'id': 231} != {'name': 'john', 'id': 231}}, +"t3": {"c": "{'name': 'david', 'id': 34.2} = {'id': 34.2, 'name': 'david'}", "r": {'name': 'david', 'id': 34.2} = {'id': 34.2, 'name': 'david'}}, +"t4": {"c": "{'name': 'david', 'id': 34.2} != {'id': 34.2, 'name': 'david'}", "r": {'name': 'david', 'id': 34.2} != {'id': 34.2, 'name': 'david'}}, +"t5": {"c": "{'name': 'henry', 'id': 111} = {'name': 'henry'}", "r": {'name': 'henry', 'id': 111} = {'name': 'henry'}}, +"t6": {"c": "{'a': 1, 'b': 2} = {'c': 3, 'd': 4}", "r": {'a': 1, 'b': 2} = {'c': 3, 'd': 4}}, +"t7": {"c": "{'aa': 11, 'bb': 22} = {'bb': 22, 'cc': 33}", "r": {'aa': 11, 'bb': 22} = {'bb': 22, 'cc': 33}}, +"t8": {"c": "{'aa': 33, 'bb': missing} != {'aa': 33}", "r": {'aa': 33, 'bb': missing} != {'aa': 33}}, +"t9": {"c": "{'bb': missing, 'a_a': 9} = {'a_a': 9}", "r": {'bb': missing, 'a_a': 9} = {'a_a': 9}}, +"t10": {"c": "{'kk': missing, 'aa': 22, 'jj': 'foo'} = {'jj': 'foo', 'dd': missing, 'aa': 22}", "r": {'kk': missing, 'aa': 22, 'jj': 'foo'} = {'jj': 'foo', 'dd': missing, 'aa': 22}}, +"t11": { + "c": "{'dept_ids': [3,1,5], 'manager': {'name': 'mike', 'id': 987}, 'salary': 32.2, 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}]} = {'salary': 32.2, 'dept_ids': [3,1,5], 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}], 'manager': {'name': 'mike', 'id': 987}}", + "r": {'dept_ids': [3,1,5], 'manager': {'name': 'mike', 'id': 987}, 'salary': 32.2, 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}]} = {'salary': 32.2, 'dept_ids': [3,1,5], 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}], 'manager': {'name': 'mike', 'id': 987}} + }, +"t12": {"c": "{'f1': [5,6,1], 'f2': [9,2,8]} != {'f1': [5,6,1], 'f2': [8,9,2]}", "r": {'f1': [5,6,1], 'f2': [9,2,8]} != {'f1': [5,6,1], 'f2': [8,9,2]}}, +"t13": {"c": "{'f1': 44, 'f2': 99} = {'f2': 44, 'f1': 99}", "r": {'f1': 44, 'f2': 99} = {'f2': 44, 'f1': 99}}, +"t14": {"c": "{'f1': 33, 'F2': 77} = {'f1': 33, 'f2': 77}", "r": {'f1': 33, 'F2': 77} = {'f1': 33, 'f2': 77}}, +"t15": {"c": "{'f1': 12, 'f2': 34, 'F2': 56} = {'f1': 12, 'F2': 56, 'f2': 34}", "r": {'f1': 12, 'f2': 34, 'F2': 56} = {'f1': 12, 'F2': 56, 'f2': 34}}, +"t16": {"c": "{} = {}", "r": {} = {}}, +"t17": {"c": "{'a': missing, 'c': missing} = {'b': missing}", "r": {'a': missing, 'c': missing} = {'b': missing}}, +"t18": {"c": "{'a': 22, 'b': 'john'} != {}", "r": {'a': 22, 'b': 'john'} != {}}, +"t19": {"c": "{} != {'a': 22, 'b': 'john'}", "r": {} != {'a': 22, 'b': 'john'}}, +"t20": {"c": "{'yy': float('5'), 'zz': tinyint('8')} = {'yy': 5, 'zz': double('8')}", "r": {'yy': float('5'), 'zz': tinyint('8')} = {'yy': 5, 'zz': double('8')}} +}; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.004.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.004.query.sqlpp new file mode 100644 index 0000000..dad85ee --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.004.query.sqlpp @@ -0,0 +1,34 @@ +/* + * 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. + */ + +// nesting, undefined and incompatible + +use test; + +{ +"t1": +{ +"c": "{'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'label': 'foo', 'a': 3}], {'a1': 7, 'z1': 2}, 'str'], 'f2': 3, 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}} } = {'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'a': 3, 'label': 'foo'}], {'a1': 7, 'z1': 2}, 'str'], 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}},'f2': 3 }", +"r": {'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'label': 'foo', 'a': 3}], {'a1': 7, 'z1': 2}, 'str'], 'f2': 3, 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}} } = {'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'a': 3, 'label': 'foo'}], {'a1': 7, 'z1': 2}, 'str'], 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}},'f2': 3 } +}, +"t2": { "c": "{'a': 2, 'b': 4} < {'a': 88, 'b': 99}", "r":{'a': 2, 'b': 4} < {'a': 88, 'b': 99} }, +"t3": { "c": "[99, {'id': 33, 'a': 'z'}] < [1, {'id': 44, 'a': 'x'}]", "r": [99, {'id': 33, 'a': 'z'}] < [1, {'id': 44, 'a': 'x'}] }, +"t4": { "c": "{'a': 3, 'j': 6} = {'m': 2, 'a': 'str'}", "r": {'a': 3, 'j': 6} = {'m': 2, 'a': 'str'} }, +"t5": { "c": "{'list': [1,2,4], 'f': 4} != {'f': 3, 'list': [1,'str']}", "r": {'list': [1,2,4], 'f': 4} != {'f': 3, 'list': [1,'str']} } +}; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.005.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.005.query.sqlpp new file mode 100644 index 0000000..5d489fd --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.005.query.sqlpp @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// nulls, missings + +use test; +{ +"t1": { "c": "{'a': 2, 'b': null} = {'a': 2, 'b': 3}", "r": {'a': 2, 'b': null} = {'a': 2, 'b': 3} }, +"t2": { "c": "{'a': 2, 'b': missing} = {'a': 2, 'b': 3}", "r": {'a': 2, 'b': missing} = {'a': 2, 'b': 3} }, +"t3": { "c": "{'list': [1, null], 'f': 3} = {'f': 3, 'list': [1, 2]}", "r": {'list': [1, null], 'f': 3} = {'f': 3, 'list': [1, 2]}}, +"t4": { "c": "{'list': [1, missing], 'f': 3} = {'f': 3, 'list': [1, 2]}", "r": {'list': [1, missing], 'f': 3} = {'f': 3, 'list': [1, 2]}}, +"t5": { "c": "{'a': 4, 'b': null} = {'a': 2, 'b': 3}", "r": {'a': 4, 'b': null} = {'a': 2, 'b': 3} } +}; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.006.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.006.query.sqlpp new file mode 100644 index 0000000..503f956 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.006.query.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; + +from closedDs t +where t.subRec = {"name": "jones", "age": 105, "colors": ["purple", "blue"]} OR +is_null(t.subRec = {"name": "jones", "age": 105, "colors": ["purple", "blue"]}) +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.007.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.007.query.sqlpp new file mode 100644 index 0000000..8357352 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.007.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; + +from closedDs t +where t.subRec != {"name": "david", "age": 100, "colors": ["white", "blue"]} +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.008.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.008.query.sqlpp new file mode 100644 index 0000000..a6f6160 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.008.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; + +from openDs t +where is_missing(t.SUB_REC = {"name": "david", "age": 100, "colors": ["white", "blue"]}) +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.009.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.009.query.sqlpp new file mode 100644 index 0000000..45c261b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.009.query.sqlpp @@ -0,0 +1,27 @@ +/* + * 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; + +from openDs t +where t.subRec = {"name": "john", "age": 28, "colors": ["green", "black", "orange"]} OR +is_null(t.subRec = {"name": "john", "age": 28, "colors": ["green", "black", "orange"]}) OR +is_missing(t.subRec = {"name": "john", "age": 28, "colors": ["green", "black", "orange"]}) +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.010.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.010.query.sqlpp new file mode 100644 index 0000000..706d157 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.010.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; + +from openDs t +where t.subRec = {"name": "jones", "age": 45, "colors": ["purple", "blue"], "nested": {"x": 2, "y": "str"}} +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.011.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.011.query.sqlpp new file mode 100644 index 0000000..c50a262 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.011.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; + +from openDs t +where t.subRec = {"age": 28, "colors": ["green", "black", "orange"]} +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.012.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.012.query.sqlpp new file mode 100644 index 0000000..fa2cb10 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.012.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; + +from openDs t +where is_null(t.subRec = {"age": 28, "colors": "lime"}) +select value t +order by t.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.013.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.013.ddl.sqlpp new file mode 100644 index 0000000..ff41019 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/records/records.013.ddl.sqlpp @@ -0,0 +1,20 @@ +/* + * 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; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.adm new file mode 100644 index 0000000..0af3a80 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[tinyint('1'),tinyint('2')] = [tinyint('1'),tinyint('2')]", "r": true }, "t2": { "c": "['a','b','c'] = ['a','b','c']", "r": true }, "t3": { "c": "['A','b','c'] = ['a','b','c']", "r": false }, "t4": { "c": "['a','b','c'] < ['a','b','d']", "r": true }, "t5": { "c": "['blue', 'black', 'orange'] < ['purple', 'green']", "r": true }, "t6": { "c": "['blue', 'black', 'orange'] > ['purple', 'green']", "r": false }, "t7": { "c": "['blue', 'black', 'orange'] >= ['blue', 'black', 'orange']", "r": true }, "t8": { "c": "[true] > [false]", "r": true }, "t9": { "c": "[true, false, true] = [true, false, true]", "r": true }, "t10": { "c": "[true, false, false] >= [true, true]", "r": false }, "t11": { "c": "[point('23.22,30.50'), point('-13.22,30.50')] = [point('23.22,30.50'), point('-13.22,30.50')]", "r": true }, "t12": { "c": "[point('23.22,30.50'), point('-13.22,30.50')] <= [point('23.22,30.50'), point('-13.22,30.50')]", "r": null }, "t13": { "c": "[line('10.1234,11.1e-1 +10.2E-2,-1 1.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')] != [line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')]", "r": false }, "t14": { "c": "[line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')] > [line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')]", "r": null }, "t15": { "c": "[rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')] = [rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')]", "r": true }, "t16": { "c": "[rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')] < [rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')]", "r": null }, "t17": { "c": "[circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')] = [circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')]", "r": true }, "t18": { "c": "[circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,- 1.00e-10 +10.5E-2')] <= [circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')]", "r": null }, "t19": { "c": "[polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')] != [polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')]", "r": false }, "t20": { "c": "[polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')] >= [polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')]", "r": null } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.regexjson deleted file mode 100644 index 801b66a..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.004.regexjson +++ /dev/null @@ -1,22 +0,0 @@ -{ -"t1": { "c": "[tinyint('1'),tinyint('2')] = [tinyint('1'),tinyint('2')]", "r": true }, -"t2": { "c": "['a','b','c'] = ['a','b','c']", "r": true }, -"t3": { "c": "['A','b','c'] = ['a','b','c']", "r": false }, -"t4": { "c": "['a','b','c'] < ['a','b','d']", "r": true }, -"t5": { "c": "['blue', 'black', 'orange'] < ['purple', 'green']", "r": true }, -"t6": { "c": "['blue', 'black', 'orange'] > ['purple', 'green']", "r": false }, -"t7": { "c": "['blue', 'black', 'orange'] >= ['blue', 'black', 'orange']", "r": true }, -"t8": { "c": "[true] > [false]", "r": true }, -"t9": { "c": "[true, false, true] = [true, false, true]", "r": true }, -"t10": { "c": "[true, false, false] >= [true, true]", "r": false }, -"t11": { "c": "[point('23.22,30.50'), point('-13.22,30.50')] = [point('23.22,30.50'), point('-13.22,30.50')]", "r": true }, -"t12": { "c": "[point('23.22,30.50'), point('-13.22,30.50')] <= [point('23.22,30.50'), point('-13.22,30.50')]", "r": null }, -"t13": { "c": "[line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')] != [line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')]", "r": false }, -"t14": { "c": "[line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')] > [line('10.1234,11.1e-1 +10.2E-2,-11.22'), line('0.1234,-1.00e-10 +10.5E-2,-01.02')]", "r": null }, -"t15": { "c": "[rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')] = [rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')]", "r": true }, -"t16": { "c": "[rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')] < [rectangle('5.1,11.8 87.6,15.6548'), rectangle('0.1234,-1.00e-10 5.5487,0.48765')]", "r": null }, -"t17": { "c": "[circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')] = [circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')]", "r": true }, -"t18": { "c": "[circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')] <= [circle('10.1234,11.1e-1 +10.2E-2'), circle('0.1234,-1.00e-10 +10.5E-2')]", "r": null }, -"t19": { "c": "[polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')] != [polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')]", "r": false }, -"t20": { "c": "[polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')] >= [polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'), polygon('9.9,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81')]", "r": null } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.adm new file mode 100644 index 0000000..808c41e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')] = [point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')]", "r": true }, "t2": { "c": "[point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')] > [point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')]", "r": null }, "t3": { "c": "[duration('P100Y12MT12M'), duration('-PT20.943S')] = [duration('P100Y12MT12M'), duration('-PT20.943S')]", "r": true }, "t4": { "c": "[duration('P100Y12MT12M'), duration('-PT20.943S')] <= [duration('P100Y12MT12M'), duration('-PT20.943S')]", "r": null }, "t5": { "c": "[year_month_duration('P100Y'), year_month_duration('P200Y')] = [year_month_duration('P100Y'), year_month_duration('P200Y')]", "r": true }, "t6": { "c": "[year_month_duration('P100Y'), year_month_duration('P200Y')] < [year_month_duration('P150Y'), year_month_duration('P200Y')]", "r": true }, "t7": { "c": "[day_time_duration('PT30M'), day_time_duration('PT10M')] = [day_time_duration('PT30M'), day_time_duration('PT10M')]", "r": true }, "t8": { "c": "[day_time_duration('PT40M'), day_time_duration('PT10M')] > [day_time_duration('PT30M'), day_time_duration('PT10M')]", "r": true }, "t9": { "c": "[interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))] = [interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))]", "r": true }, "t10": { "c": "[interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))] < [interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))]", "r": null }, "t11": { "c": "[date('2013-01-01'), date('2014-01-01')] < [date('2016-01-01'), date('2014-01-01')]", "r": true }, "t12": { "c": "[time('12:12:12.039Z'), time('10:12:12.039Z')] > [time('11:12:12.039Z'), time('10:12:12.039Z')]", "r": true }, "t13": { "c": "[datetime('2013-01-01T12:12:12.039Z'), datetime('-19700101T000000000-0800')] = [datetime('2013-01-01T12:12:12.039Z'), datetime('-1970 0101T000000000-0800')]", "r": true } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.regexjson deleted file mode 100644 index d0b75ac..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.005.regexjson +++ /dev/null @@ -1,15 +0,0 @@ -{ -"t1": { "c": "[point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')] = [point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')]", "r": true }, -"t2": { "c": "[point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')] > [point3d('44.0,13.0,41.0'), point3d('11.0,22.55,77.98')]", "r": null }, -"t3": { "c": "[duration('P100Y12MT12M'), duration('-PT20.943S')] = [duration('P100Y12MT12M'), duration('-PT20.943S')]", "r": true }, -"t4": { "c": "[duration('P100Y12MT12M'), duration('-PT20.943S')] <= [duration('P100Y12MT12M'), duration('-PT20.943S')]", "r": null }, -"t5": { "c": "[year_month_duration('P100Y'), year_month_duration('P200Y')] = [year_month_duration('P100Y'), year_month_duration('P200Y')]", "r": true }, -"t6": { "c": "[year_month_duration('P100Y'), year_month_duration('P200Y')] < [year_month_duration('P150Y'), year_month_duration('P200Y')]", "r": true }, -"t7": { "c": "[day_time_duration('PT30M'), day_time_duration('PT10M')] = [day_time_duration('PT30M'), day_time_duration('PT10M')]", "r": true }, -"t8": { "c": "[day_time_duration('PT40M'), day_time_duration('PT10M')] > [day_time_duration('PT30M'), day_time_duration('PT10M')]", "r": true }, -"t9": { "c": "[interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))] = [interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))]", "r": true }, -"t10": { "c": "[interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))] < [interval(date('2013-01-01'), date('20130505')), interval(date('2012-01-01'), date('20130505'))]", "r": null }, -"t11": { "c": "[date('2013-01-01'), date('2014-01-01')] < [date('2016-01-01'), date('2014-01-01')]", "r": true }, -"t12": { "c": "[time('12:12:12.039Z'), time('10:12:12.039Z')] > [time('11:12:12.039Z'), time('10:12:12.039Z')]", "r": true }, -"t13": { "c": "[datetime('2013-01-01T12:12:12.039Z'), datetime('-19700101T000000000-0800')] = [datetime('2013-01-01T12:12:12.039Z'), datetime('-19700101T000000000-0800')]", "r": true } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.adm new file mode 100644 index 0000000..aa0f3d5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[smallint('23'), 2] = [23, float('2')]", "r": true }, "t2": { "c": "['green', 2, date('2013-01-01'), 'blue'] = ['green', double('2'), date('2013-01-01'), 'blue']", "r": true }, "t3": { "c": "[1,point('23.22,30.50'), 3] < [1,point('23.22,30.50'),4]", "r": null }, "t4": { "c": "['black', int('4'), float('3.3')] > ['black', bigint('4')]", "r": true }, "t5": { "c": "['joe',3] > [7,'james']", "r": null }, "t6": { "c": "[] = []", "r": true }, "t7": { "c": "[] != []", "r": false }, "t8": { "c": "[] > []", "r": false }, "t9": { "c": "[] < []", "r": false }, "t10": { "c": "[] < [1,3]", "r": true }, "t11": { "c": "[] > [1,3]", "r": false }, "t12": { "c": "[8] = 8", "r": null }, "t13": { "c": "[1,point('23.22,30.50'), 3] = [1,point('23.22,30.50'),3]", "r": true }, "t14": { "c": "[true, 'steve', 12.0] != [1, 'mat']", "r": null } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.regexjson deleted file mode 100644 index 670679d..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.006.regexjson +++ /dev/null @@ -1,16 +0,0 @@ -{ -"t1": { "c": "[smallint('23'), 2] = [23, float('2')]", "r": true }, -"t2": { "c": "['green', 2, date('2013-01-01'), 'blue'] = ['green', double('2'), date('2013-01-01'), 'blue']", "r": true }, -"t3": { "c": "[1,point('23.22,30.50'), 3] < [1,point('23.22,30.50'),4]", "r": null }, -"t4": { "c": "['black', int('4'), float('3.3')] > ['black', bigint('4')]", "r": true }, -"t5": { "c": "['joe',3] > [7,'james']", "r": null }, -"t6": { "c": "[] = []", "r": true }, -"t7": { "c": "[] != []", "r": false }, -"t8": { "c": "[] > []", "r": false }, -"t9": { "c": "[] < []", "r": false }, -"t10": { "c": "[] < [1,3]", "r": true }, -"t11": { "c": "[] > [1,3]", "r": false }, -"t12": { "c": "[8] = 8", "r": null }, -"t13": { "c": "[1,point('23.22,30.50'), 3] = [1,point('23.22,30.50'),3]", "r": true }, -"t14": { "c": "[true, 'steve', 12.0] != [1, 'mat']", "r": null } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.adm new file mode 100644 index 0000000..d386253 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[[1.0,4], [5,9,11,14]] = [[1.0,4], [5,9,11,14]]", "r": true }, "t2": { "c": "[[5,2,7], ['green','black'], [date('2013-01-01')]] = [[5,2,7], ['green','black'], [date('2013-01-01')]]", "r": true }, "t3": { "c": "[['white','yellow','brown'], 6] != [['white','yellow','brown'], double('6')]", "r": false }, "t4": { "c": "[['white','yellow','brown'], 6] != [double('6'), ['white','yellow','brown']]", "r": null }, "t5": { "c": "[ [[1,2,3], 'gold', ['sql++', 5]], [tinyint('4'), tinyint('5')], smallint('2')] > [ [[1,2,3], 'gold', ['sql++', 5]], [bigint('4'), int('5')], double('0.2')]", "r": true }, "t6": { "c": "[[[1,2], 99], 77] <= [[['flute',2], 99], 77]", "r": null }, "t7": { "c": "[[[1,2], 99], 77] <= [[[missing,2], 99], 77]" }, "t8": { "c": "[5, [8,1], [[0, 4], 'b']] > [5, [8,1], [[0, 4], 'a', 'c']]", "r": true }, "t9": { "c": "[[1, null], 9] = [[1, 2], 9]", "r": null }, "t10": { "c": "[[1, null], 9] = [[1, 2], 99]", "r": false }, "t11": { "c": "[[1, null], 9] < [[1, 2], 9 ]", "r": null }, "t12": { "c": "[[1, null], 9] < [[1, 2], 99]", "r": null }, "t13": { "c": "[[1, null], 9] > [[1, 2], 9]", "r": null }, "t14": { "c": "[[1, null], 9] > [[1, 2], 99]", "r": null }, "t15": { "c": "[1,2] = {{1,2}}", "r": null }, "t16": { "c": "{'id':99, 'name':'sam'} != [99, 'sam']", "r": null }, "t17": { "c": "[[1, 'string'], 9] = [[1, 2], 9]", "r": null }, "t18": { "c": "[[1, 'string'], 9] = [[1, 2], 99]", "r": null }, "t19": { "c": "[[1, 'string'], 9] < [[1, 2], 9]", "r": null }, "t20": { "c": "[[1, 'string'], 9] < [[1, 2], 99]", "r": null }, "t21": { "c": "[[1, 'string'], 9] > [[1, 2], 9]", "r": null }, "t22": { "c": "[[1, 'string'], 9] > [[1, 2], 99]", "r": null } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.regexjson deleted file mode 100644 index 07a679b..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.007.regexjson +++ /dev/null @@ -1,24 +0,0 @@ -{ -"t1": { "c": "[[1.0,4], [5,9,11,14]] = [[1.0,4], [5,9,11,14]]", "r": true }, -"t2": { "c": "[[5,2,7], ['green','black'], [date('2013-01-01')]] = [[5,2,7], ['green','black'], [date('2013-01-01')]]", "r": true }, -"t3": { "c": "[['white','yellow','brown'], 6] != [['white','yellow','brown'], double('6')]", "r": false }, -"t4": { "c": "[['white','yellow','brown'], 6] != [double('6'), ['white','yellow','brown']]", "r": null }, -"t5": { "c": "[ [[1,2,3], 'gold', ['sql++', 5]], [tinyint('4'), tinyint('5')], smallint('2')] > [ [[1,2,3], 'gold', ['sql++', 5]], [bigint('4'), int('5')], double('0.2')]", "r": true }, -"t6": { "c": "[[[1,2], 99], 77] <= [[['flute',2], 99], 77]", "r": null }, -"t7": { "c": "[[[1,2], 99], 77] <= [[[missing,2], 99], 77]" }, -"t8": { "c": "[5, [8,1], [[0, 4], 'b']] > [5, [8,1], [[0, 4], 'a', 'c']]", "r": true }, -"t9": { "c": "[[1, null], 9] = [[1, 2], 9]", "r": null }, -"t10": { "c": "[[1, null], 9] = [[1, 2], 99]", "r": false }, -"t11": { "c": "[[1, null], 9] < [[1, 2], 9]", "r": null }, -"t12": { "c": "[[1, null], 9] < [[1, 2], 99]", "r": null }, -"t13": { "c": "[[1, null], 9] > [[1, 2], 9]", "r": null }, -"t14": { "c": "[[1, null], 9] > [[1, 2], 99]", "r": null }, -"t15": { "c": "[1,2] = {{1,2}}", "r": null }, -"t16": { "c": "{'id':99, 'name':'sam'} != [99, 'sam']", "r": null }, -"t17": { "c": "[[1, 'string'], 9] = [[1, 2], 9]", "r": null }, -"t18": { "c": "[[1, 'string'], 9] = [[1, 2], 99]", "r": null }, -"t19": { "c": "[[1, 'string'], 9] < [[1, 2], 9]", "r": null }, -"t20": { "c": "[[1, 'string'], 9] < [[1, 2], 99]", "r": null }, -"t21": { "c": "[[1, 'string'], 9] > [[1, 2], 9]", "r": null }, -"t22": { "c": "[[1, 'string'], 9] > [[1, 2], 99]", "r": null } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.adm new file mode 100644 index 0000000..7b82038 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[0,1] = [double('0'), float('1')]", "r": true }, "t2": { "c": "[-0, -1] = [float('-0'), -1]", "r": false }, "t3": { "c": "[double('INF')] > [0]", "r": true }, "t4": { "c": "[double('-INF')] < [0]", "r": true }, "t5": { "c": "[double('INF')] > [-0]", "r": true }, "t6": { "c": "[double('-INF')] < [-0]", "r": true }, "t7": { "c": "[double('INF')] > [double('-0')]", "r": true }, "t8": { "c": "[double('-INF')] < [double('-0')]", "r": true }, "t9": { "c": "[double('NaN')] > [0]", "r": true }, "t10": { "c": "[double('NaN')] < [0]", "r": false }, "t11": { "c": "[double('NaN')] > [-0]", "r": true }, "t12": { "c": "[double('NaN')] < [-0]", "r": false }, "t13": { "c": "[double('NaN')] > [double('-0')]", "r": true }, "t14": { "c": "[double('NaN')] < [double('-0')]", "r": false }, "t15": { "c": "[double('-INF')] < [double('INF')]", "r": true }, "t16": { "c": "[double('INF')] > [double('NaN')]", "r": false }, "t17": { "c": "[double('-INF')] < [double('NaN')]", "r": true } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.regexjson deleted file mode 100644 index 5de56c3..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.020.regexjson +++ /dev/null @@ -1,19 +0,0 @@ -{ -"t1": { "c": "[0,1] = [double('0'), float('1')]", "r": true }, -"t2": { "c": "[-0, -1] = [float('-0'), -1]", "r": false }, -"t3": { "c": "[double('INF')] > [0]", "r": true }, -"t4": { "c": "[double('-INF')] < [0]", "r": true }, -"t5": { "c": "[double('INF')] > [-0]", "r": true }, -"t6": { "c": "[double('-INF')] < [-0]", "r": true }, -"t7": { "c": "[double('INF')] > [double('-0')]", "r": true }, -"t8": { "c": "[double('-INF')] < [double('-0')]", "r": true }, -"t9": { "c": "[double('NaN')] > [0]", "r": true }, -"t10": { "c": "[double('NaN')] < [0]", "r": false }, -"t11": { "c": "[double('NaN')] > [-0]", "r": true }, -"t12": { "c": "[double('NaN')] < [-0]", "r": false }, -"t13": { "c": "[double('NaN')] > [double('-0')]", "r": true }, -"t14": { "c": "[double('NaN')] < [double('-0')]", "r": false }, -"t15": { "c": "[double('-INF')] < [double('INF')]", "r": true }, -"t16": { "c": "[double('INF')] > [double('NaN')]", "r": false }, -"t17": { "c": "[double('-INF')] < [double('NaN')]", "r": true } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.adm new file mode 100644 index 0000000..55b9648 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[9,2] = null", "r": null }, "t2": { "c": "[9,2] = missing" }, "t3": { "c": "[9,2] > null", "r": null }, "t4": { "c": "[9,2] > missing" }, "t5": { "c": "['red', null] < ['red', null]", "r": null }, "t6": { "c": "[missing,2] < [null,3]" }, "t7": { "c": "[1,2] < [1,2,missing]", "r": true }, "t8": { "c": "[1,2] < [1,2,null]", "r": true }, "t9": { "c": "[null,5] >= [null,5]", "r": null }, "t10": { "c": "[null,8] < [4, 9]", "r": null }, "t11": { "c": "[1,2,missing] != [1,2,missing]" }, "t12": { "c": "[null,1] = [1,1,3]", "r": false }, "t13": { "c": "[null,1] != [1,1,3]", "r": true }, "t14": { "c": "[null,1] > [1,1,3]", "r": null }, "t15": { "c": "[null, null, null] = [null, null, null]", "r": null }, "t16": { "c": "[missing, missing] = [missing, missing]" }, "t17": { "c": "[99, null, 3] = [1, 2, 3]", "r": false }, "t18": { "c": "[1, null, 3] = [1, 2, 3]", "r": null }, "t19": { "c": "[1, missing, 3] = [1, 2, 3]" }, "t20": { "c": "[1, null, missing, 4] = [1, 2, 3, 4]" }, "t2 1": { "c": "[1, null, missing, null, 5] = [1, 2, 3, 4, 5]" }, "t22": { "c": "[1, missing, null, missing, 5] = [1, 2, 3, 4, 5]" }, "t23": { "c": "[1, null, 3] = [1, 2, 99]", "r": false }, "t24": { "c": "[1, missing, 3] = [1, 2, 99]", "r": false }, "t25": { "c": "[1, null, missing, 4] = [1, 2, 3, 99]", "r": false }, "t26": { "c": "[1, null, missing, null, 5] = [1, 2, 3, 4, 99]", "r": false }, "t27": { "c": "[1, missing, null, missing, 5] = [1, 2, 3, 4, 99]", "r": false }, "t28": { "c": "[1, null, 3] != [1, 2, 3]", "r": null }, "t29": { "c": "[1, missing, 3] != [1, 2, 3]" }, "t30": { "c": "[1, null, missing, 4] != [1, 2, 3, 4]" }, "t31": { "c": "[1, null, 3] != [1, 2, 99]", "r": true }, "t32": { "c": "[1, missing, 3] != [1, 2, 99]", "r": true }, "t33": { "c": "[1, null, missing, 4] != [1, 2, 3, 99]", "r": true }, "t34": { "c": "[1, null, 3] < [1, 2, 3]", "r": null }, "t35": { "c": "[1, missing, 3] < [1, 2, 3]" }, "t36": { "c": "[1, null, missing, 4] < [1, 2, 3, 4]" }, "t37": { "c": "[1 , missing, null, 4] < [1, 2, 3, 4]" }, "t38": { "c": "[1, null, 3] < [1, 2, 99]", "r": null }, "t39": { "c": "[1, missing, 3] < [1, 2, 99]" }, "t40": { "c": "[1, null, 99] < [1, 2, 3]", "r": null }, "t41": { "c": "[1, missing, 99] < [1, 2, 3]" }, "t42": { "c": "[99, null, 3] < [1, 2, 3]", "r": false }, "t43": { "c": "[-99, null, 3] < [1, 2, 3]", "r": true }, "t44": { "c": "[99, null, 3] >= [1, 2, 3]", "r": true }, "t45": { "c": "[-99, null, 3] >= [1, 2, 3]", "r": false } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.regexjson deleted file mode 100644 index 98ff30e..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.021.regexjson +++ /dev/null @@ -1,47 +0,0 @@ -{ -"t1": { "c": "[9,2] = null", "r": null }, -"t2": { "c": "[9,2] = missing" }, -"t3": { "c": "[9,2] > null", "r": null }, -"t4": { "c": "[9,2] > missing" }, -"t5": { "c": "['red', null] < ['red', null]", "r": null }, -"t6": { "c": "[missing,2] < [null,3]" }, -"t7": { "c": "[1,2] < [1,2,missing]", "r": true }, -"t8": { "c": "[1,2] < [1,2,null]", "r": true }, -"t9": { "c": "[null,5] >= [null,5]", "r": null }, -"t10": { "c": "[null,8] < [4, 9]", "r": null }, -"t11": { "c": "[1,2,missing] != [1,2,missing]" }, -"t12": { "c": "[null,1] = [1,1,3]", "r": false }, -"t13": { "c": "[null,1] != [1,1,3]", "r": true }, -"t14": { "c": "[null,1] > [1,1,3]", "r": null }, -"t15": { "c": "[null, null, null] = [null, null, null]", "r": null }, -"t16": { "c": "[missing, missing] = [missing, missing]" }, -"t17": { "c": "[99, null, 3] = [1, 2, 3]", "r": false }, -"t18": { "c": "[1, null, 3] = [1, 2, 3]", "r": null }, -"t19": { "c": "[1, missing, 3] = [1, 2, 3]" }, -"t20": { "c": "[1, null, missing, 4] = [1, 2, 3, 4]" }, -"t21": { "c": "[1, null, missing, null, 5] = [1, 2, 3, 4, 5]" }, -"t22": { "c": "[1, missing, null, missing, 5] = [1, 2, 3, 4, 5]" }, -"t23": { "c": "[1, null, 3] = [1, 2, 99]", "r": false }, -"t24": { "c": "[1, missing, 3] = [1, 2, 99]", "r": false }, -"t25": { "c": "[1, null, missing, 4] = [1, 2, 3, 99]", "r": false }, -"t26": { "c": "[1, null, missing, null, 5] = [1, 2, 3, 4, 99]", "r": false }, -"t27": { "c": "[1, missing, null, missing, 5] = [1, 2, 3, 4, 99]", "r": false }, -"t28": { "c": "[1, null, 3] != [1, 2, 3]", "r": null }, -"t29": { "c": "[1, missing, 3] != [1, 2, 3]" }, -"t30": { "c": "[1, null, missing, 4] != [1, 2, 3, 4]" }, -"t31": { "c": "[1, null, 3] != [1, 2, 99]", "r": true }, -"t32": { "c": "[1, missing, 3] != [1, 2, 99]", "r": true }, -"t33": { "c": "[1, null, missing, 4] != [1, 2, 3, 99]", "r": true }, -"t34": { "c": "[1, null, 3] < [1, 2, 3]", "r": null }, -"t35": { "c": "[1, missing, 3] < [1, 2, 3]" }, -"t36": { "c": "[1, null, missing, 4] < [1, 2, 3, 4]" }, -"t37": { "c": "[1, missing, null, 4] < [1, 2, 3, 4]" }, -"t38": { "c": "[1, null, 3] < [1, 2, 99]", "r": null }, -"t39": { "c": "[1, missing, 3] < [1, 2, 99]" }, -"t40": { "c": "[1, null, 99] < [1, 2, 3]", "r": null }, -"t41": { "c": "[1, missing, 99] < [1, 2, 3]" }, -"t42": { "c": "[99, null, 3] < [1, 2, 3]", "r": false }, -"t43": { "c": "[-99, null, 3] < [1, 2, 3]", "r": true }, -"t44": { "c": "[99, null, 3] >= [1, 2, 3]", "r": true }, -"t45": { "c": "[-99, null, 3] >= [1, 2, 3]", "r": false } -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.adm new file mode 100644 index 0000000..9fc20b1 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.adm @@ -0,0 +1 @@ +{ "t1": { "c": "[1, 'string'] != [2, 9]", "r": null }, "t2": { "c": "[1, 'string'] > [2, 9]", "r": null }, "t3": { "c": "[9, {'id': 2}] < [1, {'id': 3}]", "r": null }, "t4": { "c": "[1, 2] = ['string', 2, 3, 4]", "r": null }, "t5": { "c": "[null, 2, 3, 4, 5] = [1, 2]", "r": false }, "t6": { "c": "[1, null, 3] = [1, 2, 'string']", "r": null }, "t7": { "c": "[1, null] = [2, 5]", "r": false }, "t8": { "c": "[1, null, 3, 7] = [1, 2, 9, 5]", "r": false }, "t9": { "c": "[null, 'string'] < [1, 2]", "r": null }, "t10": { "c": "[missing, 'string'] < [1, 2]", "r": null }, "t12": { "c": "[null, {'id':3}] < [2, {'id': 4}]", "r": null }, "t13": { "c": "[null, {'id':3}, 8] < [2, {'id': 4}, 9]", "r": null }, "t14": { "c": "[88, [7, 1], [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, "t15": { "c": "[88, null, [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, "t16": { "c": "[88, missing, [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, "t17": { "c": "[null, 88, [['strin g', 44]]] > [3, 8, [[5, 4]]]", "r": null }, "t18": { "c": "[null, missing, 88, [['string', 44]]] > [3, 5, 8, [[5, 4]]]", "r": null }, "t19": { "c": "[88, [7, 1], [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, "t20": { "c": "[88, null, [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, "t21": { "c": "[88, missing, [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, "t22": { "c": "[null, 88, [[-1, -44]]] > [3, 8, [[5, 4]]]", "r": null }, "t23": { "c": "[null, missing, 88, [[-1, -44]]] > [3, 5, 8, [[5, 4]]]" }, "t24": { "c": "[missing, null, 88, [[-1, -44]]] > [3, 5, 8, [[5, 4]]]" }, "t25": { "c": "[1, null, 9, missing] < [1, 2, 3, 4]", "r": null }, "t26": { "c": "[1, null, 3, missing] < [1, 2, 3, 4]" }, "t27": { "c": "[1, null, missing, 4] < [1, 2, 3, 4]" }, "t28": { "c": "[1, null, missing, 9] < [1, 2, 3, 4]" }, "t29": { "c": "[1, null, 9, missing] = [1, 2, 3, 4]", "r": false }, "t30": { "c": "[1, null, 3, missing] = [1, 2, 3, 4]" }, "t31": { "c": "[1, null, missing, 4] = [1, 2, 3, 4]" }, "t32": { "c": "[1, null, missing, 9] = [1, 2, 3, 4]", "r": false } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.regexjson deleted file mode 100644 index 3e158ee..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/arrays/arrays.022.regexjson +++ /dev/null @@ -1,33 +0,0 @@ -{ -"t1": { "c": "[1, 'string'] != [2, 9]", "r": null }, -"t2": { "c": "[1, 'string'] > [2, 9]", "r": null }, -"t3": { "c": "[9, {'id': 2}] < [1, {'id': 3}]", "r": null }, -"t4": { "c": "[1, 2] = ['string', 2, 3, 4]", "r": null }, -"t5": { "c": "[null, 2, 3, 4, 5] = [1, 2]", "r": false }, -"t6": { "c": "[1, null, 3] = [1, 2, 'string']", "r": null }, -"t7": { "c": "[1, null] = [2, 5]", "r": false }, -"t8": { "c": "[1, null, 3, 7] = [1, 2, 9, 5]", "r": false }, -"t9": { "c": "[null, 'string'] < [1, 2]", "r": null }, -"t10": { "c": "[missing, 'string'] < [1, 2]", "r": null }, -"t12": { "c": "[null, {'id':3}] < [2, {'id': 4}]", "r": null }, -"t13": { "c": "[null, {'id':3}, 8] < [2, {'id': 4}, 9]", "r": null }, -"t14": { "c": "[88, [7, 1], [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, -"t15": { "c": "[88, null, [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, -"t16": { "c": "[88, missing, [['string', 44]]] > [3, [-2, -3], [[5, 4]]]", "r": null }, -"t17": { "c": "[null, 88, [['string', 44]]] > [3, 8, [[5, 4]]]", "r": null }, -"t18": { "c": "[null, missing, 88, [['string', 44]]] > [3, 5, 8, [[5, 4]]]", "r": null }, -"t19": { "c": "[88, [7, 1], [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, -"t20": { "c": "[88, null, [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, -"t21": { "c": "[88, missing, [[-1, -44]]] > [3, [-2, -3], [[5, 4]]]", "r": true }, -"t22": { "c": "[null, 88, [[-1, -44]]] > [3, 8, [[5, 4]]]", "r": null }, -"t23": { "c": "[null, missing, 88, [[-1, -44]]] > [3, 5, 8, [[5, 4]]]" }, -"t24": { "c": "[missing, null, 88, [[-1, -44]]] > [3, 5, 8, [[5, 4]]]" }, -"t25": {"c": "[1, null, 9, missing] < [1, 2, 3, 4]", "r": null }, -"t26": {"c": "[1, null, 3, missing] < [1, 2, 3, 4]"}, -"t27": {"c": "[1, null, missing, 4] < [1, 2, 3, 4]"}, -"t28": {"c": "[1, null, missing, 9] < [1, 2, 3, 4]"}, -"t29": {"c": "[1, null, 9, missing] = [1, 2, 3, 4]", "r": false}, -"t30": {"c": "[1, null, 3, missing] = [1, 2, 3, 4]"}, -"t31": {"c": "[1, null, missing, 4] = [1, 2, 3, 4]"}, -"t32": {"c": "[1, null, missing, 9] = [1, 2, 3, 4]", "r": false} -} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.003.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.003.adm new file mode 100644 index 0000000..f09ce32 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.003.adm @@ -0,0 +1 @@ +{ "t1": { "c": "{'name': 'john', 'id': 231} = {'name': 'john', 'id': 231}", "r": true }, "t2": { "c": "{'name': 'john', 'id': 231} != {'name': 'john', 'id': 231}", "r": false }, "t3": { "c": "{'name': 'david', 'id': 34.2} = {'id': 34.2, 'name': 'david'}", "r": true }, "t4": { "c": "{'name': 'david', 'id': 34.2} != {'id': 34.2, 'name': 'david'}", "r": false }, "t5": { "c": "{'name': 'henry', 'id': 111} = {'name': 'henry'}", "r": false }, "t6": { "c": "{'a': 1, 'b': 2} = {'c': 3, 'd': 4}", "r": false }, "t7": { "c": "{'aa': 11, 'bb': 22} = {'bb': 22, 'cc': 33}", "r": false }, "t8": { "c": "{'aa': 33, 'bb': missing} != {'aa': 33}", "r": false }, "t9": { "c": "{'bb': missing, 'a_a': 9} = {'a_a': 9}", "r": true }, "t10": { "c": "{'kk': missing, 'aa': 22, 'jj': 'foo'} = {'jj': 'foo', 'dd': missing, 'aa': 22}", "r": true }, "t11": { "c": "{'dept_ids': [3,1,5], 'manager': {'name': 'mike', 'id': 987}, 'salary': 32.2, 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}]} = {'salary': 3 2.2, 'dept_ids': [3,1,5], 'employees': [{'name': 'seth', 'id': 22}, {'name': 'dave'}], 'manager': {'name': 'mike', 'id': 987}}", "r": true }, "t12": { "c": "{'f1': [5,6,1], 'f2': [9,2,8]} != {'f1': [5,6,1], 'f2': [8,9,2]}", "r": true }, "t13": { "c": "{'f1': 44, 'f2': 99} = {'f2': 44, 'f1': 99}", "r": false }, "t14": { "c": "{'f1': 33, 'F2': 77} = {'f1': 33, 'f2': 77}", "r": false }, "t15": { "c": "{'f1': 12, 'f2': 34, 'F2': 56} = {'f1': 12, 'F2': 56, 'f2': 34}", "r": true }, "t16": { "c": "{} = {}", "r": true }, "t17": { "c": "{'a': missing, 'c': missing} = {'b': missing}", "r": true }, "t18": { "c": "{'a': 22, 'b': 'john'} != {}", "r": true }, "t19": { "c": "{} != {'a': 22, 'b': 'john'}", "r": true }, "t20": { "c": "{'yy': float('5'), 'zz': tinyint('8')} = {'yy': 5, 'zz': double('8')}", "r": true } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.004.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.004.adm new file mode 100644 index 0000000..209061a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.004.adm @@ -0,0 +1 @@ +{ "t1": { "c": "{'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'label': 'foo', 'a': 3}], {'a1': 7, 'z1': 2}, 'str'], 'f2': 3, 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}} } = {'f1': [4, [5.4, {'id': 33, 'dept': 11}, {'a': 3, 'label': 'foo'}], {'a1': 7, 'z1': 2}, 'str'], 'f3': {'n1': {'nn1': {'a': 9, 'b': 10}, 'nn2': {'a': 99, 'x': 14}}, 'n2': {'a': 3, 'b': 5}},'f2': 3 }", "r": true }, "t2": { "c": "{'a': 2, 'b': 4} < {'a': 88, 'b': 99}", "r": null }, "t3": { "c": "[99, {'id': 33, 'a': 'z'}] < [1, {'id': 44, 'a': 'x'}]", "r": null }, "t4": { "c": "{'a': 3, 'j': 6} = {'m': 2, 'a': 'str'}", "r": null }, "t5": { "c": "{'list': [1,2,4], 'f': 4} != {'f': 3, 'list': [1,'str']}", "r": null } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.005.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.005.adm new file mode 100644 index 0000000..4b7aac1 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.005.adm @@ -0,0 +1 @@ +{ "t1": { "c": "{'a': 2, 'b': null} = {'a': 2, 'b': 3}", "r": null }, "t2": { "c": "{'a': 2, 'b': missing} = {'a': 2, 'b': 3}", "r": false }, "t3": { "c": "{'list': [1, null], 'f': 3} = {'f': 3, 'list': [1, 2]}", "r": null }, "t4": { "c": "{'list': [1, missing], 'f': 3} = {'f': 3, 'list': [1, 2]}" }, "t5": { "c": "{'a': 4, 'b': null} = {'a': 2, 'b': 3}", "r": false } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.006.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.006.adm new file mode 100644 index 0000000..af77f98 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.006.adm @@ -0,0 +1,4 @@ +{ "id": 3, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 4, "subRec": null } +{ "id": 7, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 8, "subRec": null } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.007.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.007.adm new file mode 100644 index 0000000..dc0f8e5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.007.adm @@ -0,0 +1,6 @@ +{ "id": 1, "subRec": { "name": "john", "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 3, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 5, "subRec": { "name": "mat", "age": 10, "colors": [ "yellow", "blue" ] } } +{ "id": 6, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ] } } +{ "id": 7, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 9, "subRec": { "name": "mat", "age": 10, "colors": [ "blue", "yellow" ] } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.008.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.008.adm new file mode 100644 index 0000000..8e48014 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.008.adm @@ -0,0 +1,19 @@ +{ "id": 1, "subRec": { "name": "john", "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 2, "subRec": { "name": "david", "age": 100, "colors": [ "white", "blue" ] } } +{ "id": 3, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 4, "subRec": null } +{ "id": 5, "subRec": { "name": "mat", "age": 10, "colors": [ "yellow", "blue" ] } } +{ "id": 6, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ] } } +{ "id": 7, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 8 } +{ "id": 9, "subRec": { "name": "mat", "age": 10, "colors": [ "blue", "yellow" ] } } +{ "id": 10 } +{ "id": 11, "subRec": { "name": null, "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 12, "subRec": { "name": "david", "age": "100", "colors": [ "white", "blue" ] } } +{ "id": 13, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", 3, "green" ] } } +{ "id": 14, "subRec": null } +{ "id": 15, "subRec": { "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 16, "subRec": { "name": "john", "age": 28, "colors": [ null, "black", "orange" ] } } +{ "id": 17, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ], "nested": { "x": 2, "y": "str" } } } +{ "id": 18, "subRec": { "name": "john", "age": 28, "colors": [ "green", null, "orange" ] } } +{ "id": 19, "subRec": { "name": "mat", "age": 10, "colors": [ "yellow", "blue" ], "extraF": 33 } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.009.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.009.adm new file mode 100644 index 0000000..5f814d4 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.009.adm @@ -0,0 +1,10 @@ +{ "id": 1, "subRec": { "name": "john", "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 4, "subRec": null } +{ "id": 8 } +{ "id": 10 } +{ "id": 11, "subRec": { "name": null, "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 12, "subRec": { "name": "david", "age": "100", "colors": [ "white", "blue" ] } } +{ "id": 13, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", 3, "green" ] } } +{ "id": 14, "subRec": null } +{ "id": 16, "subRec": { "name": "john", "age": 28, "colors": [ null, "black", "orange" ] } } +{ "id": 18, "subRec": { "name": "john", "age": 28, "colors": [ "green", null, "orange" ] } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.010.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.010.adm new file mode 100644 index 0000000..ea7e986 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.010.adm @@ -0,0 +1 @@ +{ "id": 17, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ], "nested": { "x": 2, "y": "str" } } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.011.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.011.adm new file mode 100644 index 0000000..4bf4154 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.011.adm @@ -0,0 +1 @@ +{ "id": 15, "subRec": { "age": 28, "colors": [ "green", "black", "orange" ] } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.012.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.012.adm new file mode 100644 index 0000000..6f13c73 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/records/records.012.adm @@ -0,0 +1,17 @@ +{ "id": 1, "subRec": { "name": "john", "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 2, "subRec": { "name": "david", "age": 100, "colors": [ "white", "blue" ] } } +{ "id": 3, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 4, "subRec": null } +{ "id": 5, "subRec": { "name": "mat", "age": 10, "colors": [ "yellow", "blue" ] } } +{ "id": 6, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ] } } +{ "id": 7, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", "blue" ] } } +{ "id": 9, "subRec": { "name": "mat", "age": 10, "colors": [ "blue", "yellow" ] } } +{ "id": 11, "subRec": { "name": null, "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 12, "subRec": { "name": "david", "age": "100", "colors": [ "white", "blue" ] } } +{ "id": 13, "subRec": { "name": "jones", "age": 105, "colors": [ "purple", 3, "green" ] } } +{ "id": 14, "subRec": null } +{ "id": 15, "subRec": { "age": 28, "colors": [ "green", "black", "orange" ] } } +{ "id": 16, "subRec": { "name": "john", "age": 28, "colors": [ null, "black", "orange" ] } } +{ "id": 17, "subRec": { "name": "jones", "age": 45, "colors": [ "purple", "blue" ], "nested": { "x": 2, "y": "str" } } } +{ "id": 18, "subRec": { "name": "john", "age": 28, "colors": [ "green", null, "orange" ] } } +{ "id": 19, "subRec": { "name": "mat", "age": 10, "colors": [ "yellow", "blue" ], "extraF": 33 } } \ No newline at end of file diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/LogicalComplexBinaryComparator.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/LogicalComplexBinaryComparator.java index a1c1faa..87d21da 100644 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/LogicalComplexBinaryComparator.java +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/LogicalComplexBinaryComparator.java @@ -18,14 +18,24 @@ */ package org.apache.asterix.dataflow.data.nontagged.comparators; +import static org.apache.asterix.om.types.ATypeTag.SERIALIZED_MISSING_TYPE_TAG; +import static org.apache.asterix.om.types.ATypeTag.VALUE_TYPE_MAPPING; + import java.io.IOException; +import java.util.BitSet; +import java.util.List; import org.apache.asterix.builders.AbvsBuilderFactory; import org.apache.asterix.dataflow.data.common.ILogicalBinaryComparator; import org.apache.asterix.dataflow.data.common.ListAccessorUtil; +import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider; import org.apache.asterix.om.base.IAObject; +import org.apache.asterix.om.pointables.ARecordVisitablePointable; +import org.apache.asterix.om.pointables.PointableAllocator; import org.apache.asterix.om.pointables.base.DefaultOpenFieldType; +import org.apache.asterix.om.pointables.base.IVisitablePointable; import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils; +import org.apache.asterix.om.types.ARecordType; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.AbstractCollectionType; import org.apache.asterix.om.types.EnumDeserializer; @@ -33,14 +43,18 @@ import org.apache.asterix.om.util.container.IObjectFactory; import org.apache.asterix.om.util.container.IObjectPool; import org.apache.asterix.om.util.container.ListObjectPool; +import org.apache.hyracks.api.dataflow.value.IBinaryComparator; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.data.std.api.IMutableValueStorage; import org.apache.hyracks.data.std.api.IPointable; +import org.apache.hyracks.data.std.api.IValueReference; import org.apache.hyracks.data.std.primitive.VoidPointable; import org.apache.hyracks.data.std.util.ArrayBackedValueStorage; +import org.apache.hyracks.util.string.UTF8StringUtil; public class LogicalComplexBinaryComparator implements ILogicalBinaryComparator { + private static final IObjectFactory<BitSet, Void> BIT_SET_FACTORY = (type) -> new BitSet(); private static final IObjectFactory<IPointable, Void> VOID_FACTORY = (type) -> new VoidPointable(); private final IAType leftType; private final IAType rightType; @@ -48,6 +62,10 @@ private final LogicalScalarBinaryComparator scalarComparator; private final IObjectPool<IMutableValueStorage, ATypeTag> storageAllocator; private final IObjectPool<IPointable, Void> voidPointableAllocator; + private final IObjectPool<BitSet, Void> bitSetAllocator; + private final PointableAllocator pointableAllocator; + private final IBinaryComparator utf8Comp; + private final StringBuilder builder; public LogicalComplexBinaryComparator(IAType leftType, IAType rightType, boolean isEquality) { this.leftType = leftType; @@ -56,6 +74,10 @@ this.scalarComparator = new LogicalScalarBinaryComparator(isEquality); storageAllocator = new ListObjectPool<>(new AbvsBuilderFactory()); voidPointableAllocator = new ListObjectPool<>(VOID_FACTORY); + bitSetAllocator = new ListObjectPool<>(BIT_SET_FACTORY); + pointableAllocator = new PointableAllocator(); + utf8Comp = BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator(); + builder = new StringBuilder(); } @Override @@ -126,16 +148,24 @@ if (leftRuntimeTag != rightRuntimeTag) { return Result.INCOMPARABLE; } + IAType leftCompileType = TypeComputeUtils.getActualType(leftType); + if (leftCompileType.getTypeTag() == ATypeTag.ANY) { + leftCompileType = DefaultOpenFieldType.getDefaultOpenFieldType(leftRuntimeTag); + } + IAType rightCompileType = TypeComputeUtils.getActualType(rightType); + if (rightCompileType.getTypeTag() == ATypeTag.ANY) { + rightCompileType = DefaultOpenFieldType.getDefaultOpenFieldType(rightRuntimeTag); + } switch (leftRuntimeTag) { case MULTISET: - return compareMultisets(leftType, leftRuntimeTag, leftBytes, leftStart, rightType, rightRuntimeTag, - rightBytes, rightStart); + return compareMultisets(leftCompileType, leftRuntimeTag, leftBytes, leftStart, rightCompileType, + rightRuntimeTag, rightBytes, rightStart); case ARRAY: - return compareArrays(leftType, leftRuntimeTag, leftBytes, leftStart, rightType, rightRuntimeTag, - rightBytes, rightStart); + return compareArrays(leftCompileType, leftRuntimeTag, leftBytes, leftStart, rightCompileType, + rightRuntimeTag, rightBytes, rightStart); case OBJECT: - return compareRecords(leftType, leftBytes, leftStart, leftLen, rightType, rightBytes, rightStart, - rightLen); + return compareRecords(leftCompileType, leftBytes, leftStart, leftLen, rightCompileType, rightBytes, + rightStart, rightLen); default: return Result.NULL; } @@ -146,16 +176,8 @@ // reaching here, both left and right have to be arrays (should be enforced) int leftNumItems = ListAccessorUtil.numberOfItems(leftBytes, leftStart); int rightNumItems = ListAccessorUtil.numberOfItems(rightBytes, rightStart); - IAType leftListCompileType = TypeComputeUtils.getActualType(leftType); - if (leftListCompileType.getTypeTag() == ATypeTag.ANY) { - leftListCompileType = DefaultOpenFieldType.getDefaultOpenFieldType(leftListTag); - } - IAType rightListCompileType = TypeComputeUtils.getActualType(rightType); - if (rightListCompileType.getTypeTag() == ATypeTag.ANY) { - rightListCompileType = DefaultOpenFieldType.getDefaultOpenFieldType(rightListTag); - } - IAType leftItemCompileType = ((AbstractCollectionType) leftListCompileType).getItemType(); - IAType rightItemCompileType = ((AbstractCollectionType) rightListCompileType).getItemType(); + IAType leftItemCompileType = ((AbstractCollectionType) leftType).getItemType(); + IAType rightItemCompileType = ((AbstractCollectionType) rightType).getItemType(); ATypeTag leftItemTag = leftItemCompileType.getTypeTag(); ATypeTag rightItemTag = rightItemCompileType.getTypeTag(); @@ -248,12 +270,143 @@ } private Result compareRecords(IAType leftType, byte[] leftBytes, int leftStart, int leftLen, IAType rightType, - byte[] rightBytes, int rightStart, int rightLen) { - // TODO(ali): record comparison logic here + byte[] rightBytes, int rightStart, int rightLen) throws HyracksDataException { // equality is the only operation defined for records if (!isEquality) { return Result.INCOMPARABLE; } - return Result.NULL; + ARecordType leftRecordType = (ARecordType) leftType; + ARecordType rightRecordType = (ARecordType) rightType; + ARecordVisitablePointable leftRecord = pointableAllocator.allocateRecordValue(leftRecordType); + ARecordVisitablePointable rightRecord = pointableAllocator.allocateRecordValue(rightRecordType); + // keeps track of the fields in the right record that have not been matched + BitSet notMatched = bitSetAllocator.allocate(null); + try { + leftRecord.set(leftBytes, leftStart, leftLen); + rightRecord.set(rightBytes, rightStart, rightLen); + List<IVisitablePointable> leftFieldValues = leftRecord.getFieldValues(); + List<IVisitablePointable> leftFieldNames = leftRecord.getFieldNames(); + List<IVisitablePointable> rightFieldValues = rightRecord.getFieldValues(); + List<IVisitablePointable> rightFieldNames = rightRecord.getFieldNames(); + IVisitablePointable leftFieldValue; + IVisitablePointable leftFieldName; + IVisitablePointable rightFieldValue; + IVisitablePointable rightFieldName; + int leftNumFields = leftFieldNames.size(); + int rightNumFields = rightFieldNames.size(); + IAType leftFieldType; + IAType rightFieldType; + ATypeTag leftFTag; + ATypeTag rightFTag; + Result tempCompResult; + Result unknownResult = null; + Result determiningResult = null; + String complexFieldName; + boolean foundFieldInRight; + boolean notEqual = false; + notMatched.set(0, rightNumFields); + for (int i = 0; i < leftNumFields; i++) { + leftFieldValue = leftFieldValues.get(i); + leftFTag = VALUE_TYPE_MAPPING[leftFieldValue.getByteArray()[leftFieldValue.getStartOffset()]]; + + // ignore if the field value is missing + if (leftFTag != ATypeTag.MISSING) { + foundFieldInRight = false; + leftFieldName = leftFieldNames.get(i); + for (int k = 0; k < rightNumFields; k++) { + rightFieldName = rightFieldNames.get(k); + if (notMatched.get(k) && equalNames(leftFieldName, rightFieldName)) { + notMatched.clear(k); + rightFieldValue = rightFieldValues.get(k); + rightFTag = VALUE_TYPE_MAPPING[rightFieldValue.getByteArray()[rightFieldValue + .getStartOffset()]]; + // if right field has a missing value, ignore and flag the two records as not equal + if (rightFTag != ATypeTag.MISSING) { + foundFieldInRight = true; + if (leftFTag == ATypeTag.NULL || rightFTag == ATypeTag.NULL) { + tempCompResult = Result.NULL; + } else if (leftFTag.isDerivedType() && rightFTag.isDerivedType()) { + complexFieldName = getComplexFieldName(leftFieldName); + leftFieldType = getComplexFieldType(leftRecordType, complexFieldName, leftFTag); + rightFieldType = getComplexFieldType(rightRecordType, complexFieldName, rightFTag); + tempCompResult = + compareComplex(leftFieldType, leftFTag, leftFieldValue.getByteArray(), + leftFieldValue.getStartOffset(), leftFieldValue.getLength(), + rightFieldType, rightFTag, rightFieldValue.getByteArray(), + rightFieldValue.getStartOffset(), rightFieldValue.getLength()); + } else { + tempCompResult = scalarComparator.compare(leftFieldValue.getByteArray(), + leftFieldValue.getStartOffset(), leftFieldValue.getLength(), + rightFieldValue.getByteArray(), rightFieldValue.getStartOffset(), + rightFieldValue.getLength()); + } + + if (tempCompResult == Result.INCOMPARABLE) { + return tempCompResult; + } + if (tempCompResult == Result.MISSING || tempCompResult == Result.NULL) { + if (unknownResult != Result.MISSING) { + unknownResult = tempCompResult; + } + } else if (tempCompResult != Result.EQ && determiningResult == null) { + determiningResult = tempCompResult; + } + } + break; + } + } + if (!foundFieldInRight) { + notEqual = true; + } + } + } + + if (notEqual) { + // LT or GT does not make a difference since this is an answer to equality + return Result.LT; + } + // two fields with the same name but having different values + if (determiningResult != null) { + return determiningResult; + } + // check if there is a field in the right record that does not exist in left record + byte rightFieldTag; + for (int i = 0; i < rightNumFields; i++) { + rightFieldValue = rightFieldValues.get(i); + rightFieldTag = rightFieldValue.getByteArray()[rightFieldValue.getStartOffset()]; + if (notMatched.get(i) && rightFieldTag != SERIALIZED_MISSING_TYPE_TAG) { + notEqual = true; + break; + } + } + if (notEqual) { + return Result.LT; + } + // reaching here means every field in the left record exists in the right and vice versa + if (unknownResult != null) { + return unknownResult; + } + return Result.EQ; + } finally { + pointableAllocator.freeRecord(rightRecord); + pointableAllocator.freeRecord(leftRecord); + bitSetAllocator.free(notMatched); + } + } + + private IAType getComplexFieldType(ARecordType recordType, String fieldName, ATypeTag fieldRuntimeTag) { + IAType fieldType = recordType.getFieldType(fieldName); + return fieldType == null ? DefaultOpenFieldType.getDefaultOpenFieldType(fieldRuntimeTag) : fieldType; + } + + private String getComplexFieldName(IValueReference fieldName) { + builder.setLength(0); + return UTF8StringUtil.toString(builder, fieldName.getByteArray(), fieldName.getStartOffset() + 1).toString(); + } + + private boolean equalNames(IValueReference fieldName1, IValueReference fieldName2) throws HyracksDataException { + // TODO(ali): refactor with PointableHelper and move it from runtime package + return utf8Comp.compare(fieldName1.getByteArray(), fieldName1.getStartOffset() + 1, fieldName1.getLength() - 1, + fieldName2.getByteArray(), fieldName2.getStartOffset() + 1, fieldName2.getLength() - 1) == 0; } } diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/PointableAllocator.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/PointableAllocator.java index 411f067..ecbfdae 100644 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/PointableAllocator.java +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/PointableAllocator.java @@ -134,6 +134,10 @@ return recordValueAllocator.allocate(type); } + public void freeRecord(ARecordVisitablePointable instance) { + recordValueAllocator.free(instance); + } + public void reset() { flatValueAllocator.reset(); recordValueAllocator.reset(); diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/container/IObjectPool.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/container/IObjectPool.java index a911c72..d80f716 100644 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/container/IObjectPool.java +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/container/IObjectPool.java @@ -31,12 +31,18 @@ * the argument to create E * @return an E instance */ - public E allocate(T arg); + E allocate(T arg); /** * Mark all instances in the pool as unused */ - public void reset(); + void reset(); + /** + * Frees the argument element in the pool and makes it available again. + * + * @param element instance to free. + * @return true if the element is marked available in the pool. Otherwise, false. + */ boolean free(E element); } -- To view, visit https://asterix-gerrit.ics.uci.edu/3222 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e8bfbb014b86295749e980d123b0d3edf079beb Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Ali Alsuliman <[email protected]>
