http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.1.ddl.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.1.ddl.sqlpp new file mode 100644 index 0000000..da0bd7b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.1.ddl.sqlpp @@ -0,0 +1,33 @@ +/* + * 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 test.TestType as +{ + id : bigint, + gid : bigint, + val : double +}; + +create dataset Test(TestType) primary key id;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.2.update.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.2.update.sqlpp new file mode 100644 index 0000000..1b4eac9 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.2.update.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. + */ + +use test; + +insert into Test +select element {'id':0,'gid':1,'val':double(4.32),'valplus':float('2.0')}; +insert into Test +select element {'id':1,'gid':1,'val':double(5.32),'valplus':float('1.0')}; +insert into Test +select element {'id':2,'gid':1,'val':double(6.32),'valplus':'hello world'}; +insert into Test +select element {'id':3,'gid':1,'val':double(4.32),'valplus':double('3.0')}; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp new file mode 100644 index 0000000..96551e2 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.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. + */ + /* + * Description : Run serial-sum over an ordered list with mixed types + * Expected Res : Failure + * Date : March 5th 2018 + */ + +use test; + +select gid, strict_sum((select value g.valplus from g)) as sum +from Test as t +/* +hash */ +group by t.gid as gid group as g(valplus as valplus); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.1.ddl.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.1.ddl.sqlpp new file mode 100644 index 0000000..21479a2 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.1.ddl.sqlpp @@ -0,0 +1,22 @@ +/* + * 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; + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.2.update.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.2.update.sqlpp new file mode 100644 index 0000000..bd244d0 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.2.update.sqlpp @@ -0,0 +1,19 @@ +/* + * 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. + */ + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.3.query.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.3.query.sqlpp new file mode 100644 index 0000000..2520b7e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_overflow/sum_int64_overflow.3.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; + + +select element test.strict_sum(( + select element x + from [test.bigint('1'),test.bigint('2'),test.bigint('3'),test.bigint('9223372036854775807')] as x +)); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp index 595ecca..d592b74 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp @@ -22,5 +22,5 @@ use test; select element test.strict_sum(( select element x - from [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x + from [test.tinyint('100'),test.tinyint('100'),test.tinyint('100')] as x )); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double/serial_sum_double.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double/serial_sum_double.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double/serial_sum_double.1.adm new file mode 100644 index 0000000..26d8cc3 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double/serial_sum_double.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 24.6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.adm new file mode 100644 index 0000000..56b8cdb --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 38473827485890992.0 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_empty/serial_sum_empty.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_empty/serial_sum_empty.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_empty/serial_sum_empty.1.adm new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float/serial_sum_float.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float/serial_sum_float.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float/serial_sum_float.1.adm new file mode 100644 index 0000000..26d8cc3 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float/serial_sum_float.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 24.6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.adm new file mode 100644 index 0000000..d28ddd8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 6.0 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16/serial_sum_int16.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16/serial_sum_int16.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16/serial_sum_int16.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16/serial_sum_int16.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.adm new file mode 100644 index 0000000..d41f389 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32/serial_sum_int32.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32/serial_sum_int32.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32/serial_sum_int32.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32/serial_sum_int32.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.adm new file mode 100644 index 0000000..d41f389 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64/serial_sum_int64.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64/serial_sum_int64.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64/serial_sum_int64.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64/serial_sum_int64.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.adm new file mode 100644 index 0000000..d41f389 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8/serial_sum_int8.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8/serial_sum_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8/serial_sum_int8.1.adm new file mode 100644 index 0000000..663d0a8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8/serial_sum_int8.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 370 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.adm new file mode 100644 index 0000000..7f976d2 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 300 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_int8/sum_int8.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_int8/sum_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_int8/sum_int8.1.adm index 1e8b314..697cb3a 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_int8/sum_int8.1.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_int8/sum_int8.1.adm @@ -1 +1 @@ -6 +300 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double/serial_sum_double.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double/serial_sum_double.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double/serial_sum_double.1.adm new file mode 100644 index 0000000..26d8cc3 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double/serial_sum_double.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 24.6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double_null/serial_sum_double_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double_null/serial_sum_double_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double_null/serial_sum_double_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_double_null/serial_sum_double_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_empty/serial_sum_empty.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_empty/serial_sum_empty.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_empty/serial_sum_empty.1.adm new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float/serial_sum_float.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float/serial_sum_float.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float/serial_sum_float.1.adm new file mode 100644 index 0000000..26d8cc3 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float/serial_sum_float.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 24.6 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float_null/serial_sum_float_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float_null/serial_sum_float_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float_null/serial_sum_float_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_float_null/serial_sum_float_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16/serial_sum_int16.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16/serial_sum_int16.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16/serial_sum_int16.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16/serial_sum_int16.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16_null/serial_sum_int16_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16_null/serial_sum_int16_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16_null/serial_sum_int16_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int16_null/serial_sum_int16_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32/serial_sum_int32.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32/serial_sum_int32.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32/serial_sum_int32.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32/serial_sum_int32.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32_null/serial_sum_int32_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32_null/serial_sum_int32_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32_null/serial_sum_int32_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int32_null/serial_sum_int32_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64/serial_sum_int64.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64/serial_sum_int64.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64/serial_sum_int64.1.adm new file mode 100644 index 0000000..60e711a --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64/serial_sum_int64.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 23 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64_null/serial_sum_int64_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64_null/serial_sum_int64_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64_null/serial_sum_int64_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int64_null/serial_sum_int64_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8/serial_sum_int8.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8/serial_sum_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8/serial_sum_int8.1.adm new file mode 100644 index 0000000..663d0a8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8/serial_sum_int8.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": 370 } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8_null/serial_sum_int8_null.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8_null/serial_sum_int8_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8_null/serial_sum_int8_null.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_int8_null/serial_sum_int8_null.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_mixed/serial_sum_mixed.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_mixed/serial_sum_mixed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_mixed/serial_sum_mixed.1.adm new file mode 100644 index 0000000..eb5581f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/serial_sum_mixed/serial_sum_mixed.1.adm @@ -0,0 +1 @@ +{ "gid": 1, "sum": null } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_int8/sum_int8.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_int8/sum_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_int8/sum_int8.1.adm index 1e8b314..697cb3a 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_int8/sum_int8.1.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_int8/sum_int8.1.adm @@ -1 +1 @@ -6 +300 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access/explain_field_access.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access/explain_field_access.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access/explain_field_access.1.adm index 384e8f8..4e079d0 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access/explain_field_access.1.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access/explain_field_access.1.adm @@ -9,7 +9,7 @@ distribute result [$$40] exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| group by ([$#1 := $$48]) decor ([]) { - aggregate [$$43] <- [agg-sql-sum($$47)] + aggregate [$$43] <- [agg-global-sql-sum($$47)] -- AGGREGATE |LOCAL| nested tuple source -- NESTED_TUPLE_SOURCE |LOCAL| http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access_closed/explain_field_access_closed.1.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access_closed/explain_field_access_closed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access_closed/explain_field_access_closed.1.adm index b82dda7..2477020 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access_closed/explain_field_access_closed.1.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/explain/explain_field_access_closed/explain_field_access_closed.1.adm @@ -9,7 +9,7 @@ distribute result [$$39] exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| group by ([$#1 := $$46]) decor ([]) { - aggregate [$$42] <- [agg-sql-sum($$45)] + aggregate [$$42] <- [agg-global-sql-sum($$45)] -- AGGREGATE |LOCAL| nested tuple source -- NESTED_TUPLE_SOURCE |LOCAL| http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast index 350605d..cd32941 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast @@ -8,13 +8,13 @@ FunctionCall asterix.sql-sum@1[ ] FROM [ OrderedListConstructor [ FunctionCall test.int8@1[ - LiteralExpr [STRING] [1] + LiteralExpr [STRING] [100] ] FunctionCall test.int8@1[ - LiteralExpr [STRING] [2] + LiteralExpr [STRING] [100] ] FunctionCall test.int8@1[ - LiteralExpr [STRING] [3] + LiteralExpr [STRING] [100] ] ] AS Variable [ Name=$x ] http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast index 11eb977..8cd57a7 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast @@ -8,13 +8,13 @@ FunctionCall asterix.sum@1[ ] FROM [ OrderedListConstructor [ FunctionCall test.int8@1[ - LiteralExpr [STRING] [1] + LiteralExpr [STRING] [100] ] FunctionCall test.int8@1[ - LiteralExpr [STRING] [2] + LiteralExpr [STRING] [100] ] FunctionCall test.int8@1[ - LiteralExpr [STRING] [3] + LiteralExpr [STRING] [100] ] ] AS Variable [ Name=$x ] http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml index 18455df..619d12c 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml @@ -194,12 +194,6 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="sum_mixed"> - <output-dir compare="Text">sum_mixed</output-dir> - <expected-error>Type incompatibility: function agg-sum gets incompatible input values: string and float</expected-error> - </compilation-unit> - </test-case> - <test-case FilePath="aggregate"> <compilation-unit name="min_mixed"> <output-dir compare="Text">min_mixed</output-dir> <expected-error>Type incompatibility: function min/max gets incompatible input values: string and float</expected-error> @@ -230,6 +224,18 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate"> + <compilation-unit name="sum_mixed"> + <output-dir compare="Text">sum_mixed</output-dir> + <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_mixed"> + <output-dir compare="Text">serial_sum_mixed</output-dir> + <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> <compilation-unit name="var_mixed"> <output-dir compare="Text">var_mixed</output-dir> <expected-error>Type incompatibility: function agg-var gets incompatible input values: string and float</expected-error> @@ -590,28 +596,28 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="scalar_var"> - <output-dir compare="Text">scalar_var</output-dir> + <compilation-unit name="scalar_sum_empty"> + <output-dir compare="Text">scalar_sum_empty</output-dir> </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="scalar_var_empty"> - <output-dir compare="Text">scalar_var_empty</output-dir> + <compilation-unit name="scalar_sum_null"> + <output-dir compare="Text">scalar_sum_null</output-dir> </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="scalar_var_null"> - <output-dir compare="Text">scalar_var_null</output-dir> + <compilation-unit name="scalar_var"> + <output-dir compare="Text">scalar_var</output-dir> </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="scalar_sum_empty"> - <output-dir compare="Text">scalar_sum_empty</output-dir> + <compilation-unit name="scalar_var_empty"> + <output-dir compare="Text">scalar_var_empty</output-dir> </compilation-unit> </test-case> <test-case FilePath="aggregate"> - <compilation-unit name="scalar_sum_null"> - <output-dir compare="Text">scalar_sum_null</output-dir> + <compilation-unit name="scalar_var_null"> + <output-dir compare="Text">scalar_var_null</output-dir> </compilation-unit> </test-case> <test-case FilePath="aggregate"> @@ -680,6 +686,77 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_double"> + <output-dir compare="Text">serial_sum_double</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_double_null"> + <output-dir compare="Text">serial_sum_double_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_empty"> + <output-dir compare="Text">serial_sum_empty</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_float"> + <output-dir compare="Text">serial_sum_float</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_float_null"> + <output-dir compare="Text">serial_sum_float_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int16"> + <output-dir compare="Text">serial_sum_int16</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int16_null"> + <output-dir compare="Text">serial_sum_int16_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int32"> + <output-dir compare="Text">serial_sum_int32</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int32_null"> + <output-dir compare="Text">serial_sum_int32_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int64"> + <output-dir compare="Text">serial_sum_int64</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int64_null"> + <output-dir compare="Text">serial_sum_int64_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int64_overflow"> + <output-dir compare="Text">serial_sum_int64_overflow</output-dir> + <expected-error>Overflow in agg-sum</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int8"> + <output-dir compare="Text">serial_sum_int8</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="serial_sum_int8_null"> + <output-dir compare="Text">serial_sum_int8_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> <compilation-unit name="serial_var_double"> <output-dir compare="Text">serial_var_double</output-dir> </compilation-unit> @@ -880,6 +957,17 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate"> + <compilation-unit name="sum_int64_null"> + <output-dir compare="Text">sum_int64_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> + <compilation-unit name="sum_int64_overflow"> + <output-dir compare="Text">sum_int64_overflow</output-dir> + <expected-error>Overflow in agg-sum</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate"> <compilation-unit name="sum_int8"> <output-dir compare="Text">sum_int8</output-dir> </compilation-unit> @@ -1013,12 +1101,6 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate-sql"> - <compilation-unit name="sum_mixed"> - <output-dir compare="Text">sum_mixed</output-dir> - <expected-error>Type incompatibility: function agg-sum gets incompatible input values: string and float</expected-error> - </compilation-unit> - </test-case> - <test-case FilePath="aggregate-sql"> <compilation-unit name="min_mixed"> <output-dir compare="Text">min_mixed</output-dir> <expected-error>Type incompatibility: function min/max gets incompatible input values: string and float</expected-error> @@ -1049,6 +1131,18 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate-sql"> + <compilation-unit name="sum_mixed"> + <output-dir compare="Text">sum_mixed</output-dir> + <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_mixed"> + <output-dir compare="Text">serial_sum_mixed</output-dir> + <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> <compilation-unit name="serial_var_mixed"> <output-dir compare="Text">serial_var_mixed</output-dir> <expected-error>Invalid item type: function agg-var cannot process item type string in an input array (or multiset)</expected-error> @@ -1428,6 +1522,77 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_double"> + <output-dir compare="Text">serial_sum_double</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_double_null"> + <output-dir compare="Text">serial_sum_double_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_empty"> + <output-dir compare="Text">serial_sum_empty</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_float"> + <output-dir compare="Text">serial_sum_float</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_float_null"> + <output-dir compare="Text">serial_sum_float_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int16"> + <output-dir compare="Text">serial_sum_int16</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int16_null"> + <output-dir compare="Text">serial_sum_int16_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int32"> + <output-dir compare="Text">serial_sum_int32</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int32_null"> + <output-dir compare="Text">serial_sum_int32_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int64"> + <output-dir compare="Text">serial_sum_int64</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int64_null"> + <output-dir compare="Text">serial_sum_int64_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int64_overflow"> + <output-dir compare="Text">serial_sum_int64_overflow</output-dir> + <expected-error>Overflow in agg-sum</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int8"> + <output-dir compare="Text">serial_sum_int8</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> + <compilation-unit name="serial_sum_int8_null"> + <output-dir compare="Text">serial_sum_int8_null</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> <compilation-unit name="serial_var_double"> <output-dir compare="Text">serial_var_double</output-dir> </compilation-unit> @@ -1628,6 +1793,12 @@ </compilation-unit> </test-case> <test-case FilePath="aggregate-sql"> + <compilation-unit name="sum_int64_overflow"> + <output-dir compare="Text">sum_int64_overflow</output-dir> + <expected-error>Overflow in agg-sum</expected-error> + </compilation-unit> + </test-case> + <test-case FilePath="aggregate-sql"> <compilation-unit name="sum_int8"> <output-dir compare="Text">sum_int8</output-dir> </compilation-unit> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java index ccb124a..9a52f55 100644 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java @@ -89,7 +89,7 @@ import org.apache.asterix.om.typecomputer.impl.NotUnknownTypeComputer; import org.apache.asterix.om.typecomputer.impl.NullIfTypeComputer; import org.apache.asterix.om.typecomputer.impl.NullableDoubleTypeComputer; import org.apache.asterix.om.typecomputer.impl.NumericAddSubMulDivTypeComputer; -import org.apache.asterix.om.typecomputer.impl.NumericAggTypeComputer; +import org.apache.asterix.om.typecomputer.impl.NumericSumAggTypeComputer; import org.apache.asterix.om.typecomputer.impl.NumericDivideTypeComputer; import org.apache.asterix.om.typecomputer.impl.NumericDoubleOutputFunctionTypeComputer; import org.apache.asterix.om.typecomputer.impl.NumericInt8OutputFunctionTypeComputer; @@ -460,6 +460,10 @@ public class BuiltinFunctions { public static final FunctionIdentifier SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sum", 1); public static final FunctionIdentifier LOCAL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-local-sum", 1); + public static final FunctionIdentifier INTERMEDIATE_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-intermediate-sum", 1); + public static final FunctionIdentifier GLOBAL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-global-sum", 1); public static final FunctionIdentifier MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-max", 1); public static final FunctionIdentifier LOCAL_MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-local-max", 1); @@ -557,6 +561,10 @@ public class BuiltinFunctions { new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sum-serial", 1); public static final FunctionIdentifier SERIAL_LOCAL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sum-serial", 1); + public static final FunctionIdentifier SERIAL_INTERMEDIATE_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "intermediate-sum-serial", 1); + public static final FunctionIdentifier SERIAL_GLOBAL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sum-serial", 1); public static final FunctionIdentifier SERIAL_GLOBAL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-avg-serial", 1); public static final FunctionIdentifier SERIAL_LOCAL_AVG = @@ -645,6 +653,10 @@ public class BuiltinFunctions { new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sql-sum", 1); public static final FunctionIdentifier LOCAL_SQL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-local-sql-sum", 1); + public static final FunctionIdentifier INTERMEDIATE_SQL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-intermediate-sql-sum", 1); + public static final FunctionIdentifier GLOBAL_SQL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-global-sql-sum", 1); public static final FunctionIdentifier SQL_MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sql-max", 1); public static final FunctionIdentifier LOCAL_SQL_MAX = @@ -738,6 +750,10 @@ public class BuiltinFunctions { new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-sum-serial", 1); public static final FunctionIdentifier SERIAL_LOCAL_SQL_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-sum-serial", 1); + public static final FunctionIdentifier SERIAL_INTERMEDIATE_SQL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "intermediate-sql-sum-serial", 1); + public static final FunctionIdentifier SERIAL_GLOBAL_SQL_SUM = + new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-sum-serial", 1); public static final FunctionIdentifier SERIAL_GLOBAL_SQL_AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-avg-serial", 1); public static final FunctionIdentifier SERIAL_INTERMEDIATE_SQL_AVG = @@ -1565,8 +1581,6 @@ public class BuiltinFunctions { addFunction(COUNT, AInt64TypeComputer.INSTANCE, true); addPrivateFunction(LOCAL_AVG, LocalAvgTypeComputer.INSTANCE, true); addFunction(AVG, NullableDoubleTypeComputer.INSTANCE, true); - addFunction(SUM, NumericAggTypeComputer.INSTANCE, true); - addPrivateFunction(LOCAL_SUM, NumericAggTypeComputer.INSTANCE, true); addPrivateFunction(GLOBAL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_FIRST_ELEMENT, CollectionMemberResultType.INSTANCE, true); addPrivateFunction(FIRST_ELEMENT, PropagateTypeComputer.INSTANCE, true); @@ -1586,20 +1600,28 @@ public class BuiltinFunctions { addFunction(VAR_POP, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(GLOBAL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true); + // SUM + addFunction(SUM, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SCALAR_SUM, ScalarVersionOfAggregateResultType.INSTANCE, true); + addPrivateFunction(LOCAL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(INTERMEDIATE_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(GLOBAL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_LOCAL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_INTERMEDIATE_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_GLOBAL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_SQL_COUNT, AInt64TypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_GLOBAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_LOCAL_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_INTERMEDIATE_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true); - addPrivateFunction(SERIAL_SQL_SUM, NumericAggTypeComputer.INSTANCE, true); - addPrivateFunction(SERIAL_LOCAL_SQL_SUM, NumericAggTypeComputer.INSTANCE, true); addFunction(SCALAR_AVG, NullableDoubleTypeComputer.INSTANCE, true); addFunction(SCALAR_COUNT, AInt64TypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_GLOBAL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_LOCAL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addFunction(SCALAR_MAX, ScalarVersionOfAggregateResultType.INSTANCE, true); addFunction(SCALAR_MIN, ScalarVersionOfAggregateResultType.INSTANCE, true); - addFunction(SCALAR_SUM, ScalarVersionOfAggregateResultType.INSTANCE, true); addPrivateFunction(INTERMEDIATE_AVG, LocalAvgTypeComputer.INSTANCE, true); addFunction(SCALAR_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_GLOBAL_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); @@ -1634,6 +1656,17 @@ public class BuiltinFunctions { addPrivateFunction(SERIAL_LOCAL_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_INTERMEDIATE_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true); + // SQL SUM + addFunction(SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SCALAR_SQL_SUM, ScalarVersionOfAggregateResultType.INSTANCE, true); + addPrivateFunction(LOCAL_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(INTERMEDIATE_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(GLOBAL_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_LOCAL_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_INTERMEDIATE_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addPrivateFunction(SERIAL_GLOBAL_SQL_SUM, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(GLOBAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(LOCAL_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true); @@ -1643,15 +1676,12 @@ public class BuiltinFunctions { addPrivateFunction(LOCAL_SQL_MAX, MinMaxAggTypeComputer.INSTANCE, true); addFunction(SQL_MIN, MinMaxAggTypeComputer.INSTANCE, true); addPrivateFunction(LOCAL_SQL_MIN, MinMaxAggTypeComputer.INSTANCE, true); - addFunction(SQL_SUM, NumericAggTypeComputer.INSTANCE, true); - addPrivateFunction(LOCAL_SQL_SUM, NumericAggTypeComputer.INSTANCE, true); addFunction(SCALAR_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addFunction(SCALAR_SQL_COUNT, AInt64TypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_GLOBAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SCALAR_LOCAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addFunction(SCALAR_SQL_MAX, ScalarVersionOfAggregateResultType.INSTANCE, true); addFunction(SCALAR_SQL_MIN, ScalarVersionOfAggregateResultType.INSTANCE, true); - addFunction(SCALAR_SQL_SUM, ScalarVersionOfAggregateResultType.INSTANCE, true); addPrivateFunction(INTERMEDIATE_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true); addFunction(SQL_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(GLOBAL_SQL_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); @@ -1687,8 +1717,6 @@ public class BuiltinFunctions { addPrivateFunction(SERIAL_GLOBAL_AVG, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_LOCAL_AVG, LocalAvgTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_INTERMEDIATE_AVG, LocalAvgTypeComputer.INSTANCE, true); - addPrivateFunction(SERIAL_SUM, NumericAggTypeComputer.INSTANCE, true); - addPrivateFunction(SERIAL_LOCAL_SUM, NumericAggTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_GLOBAL_STDDEV, NullableDoubleTypeComputer.INSTANCE, true); addPrivateFunction(SERIAL_LOCAL_STDDEV, LocalSingleVarStatisticsTypeComputer.INSTANCE, true); @@ -1713,10 +1741,10 @@ public class BuiltinFunctions { addFunction(SQL_COUNT_DISTINCT, AInt64TypeComputer.INSTANCE, true); addFunction(SCALAR_SQL_COUNT_DISTINCT, AInt64TypeComputer.INSTANCE, true); - addFunction(SUM_DISTINCT, NumericAggTypeComputer.INSTANCE, true); - addFunction(SCALAR_SUM_DISTINCT, ScalarVersionOfAggregateResultType.INSTANCE, true); - addFunction(SQL_SUM_DISTINCT, NumericAggTypeComputer.INSTANCE, true); - addFunction(SCALAR_SQL_SUM_DISTINCT, ScalarVersionOfAggregateResultType.INSTANCE, true); + addFunction(SUM_DISTINCT, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SCALAR_SUM_DISTINCT, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SQL_SUM_DISTINCT, NumericSumAggTypeComputer.INSTANCE, true); + addFunction(SCALAR_SQL_SUM_DISTINCT, NumericSumAggTypeComputer.INSTANCE, true); addFunction(AVG_DISTINCT, NullableDoubleTypeComputer.INSTANCE, true); addFunction(SCALAR_AVG_DISTINCT, NullableDoubleTypeComputer.INSTANCE, true); @@ -2251,27 +2279,29 @@ public class BuiltinFunctions { addScalarAgg(MIN_DISTINCT, SCALAR_MIN_DISTINCT); // SUM - addAgg(SUM); addAgg(LOCAL_SUM); + addAgg(GLOBAL_SUM); addLocalAgg(SUM, LOCAL_SUM); - addIntermediateAgg(LOCAL_SUM, SUM); - addIntermediateAgg(SUM, SUM); - addGlobalAgg(SUM, SUM); - + addIntermediateAgg(SUM, INTERMEDIATE_SUM); + addIntermediateAgg(LOCAL_SUM, INTERMEDIATE_SUM); + addIntermediateAgg(GLOBAL_SUM, INTERMEDIATE_SUM); + addGlobalAgg(SUM, GLOBAL_SUM); addScalarAgg(SUM, SCALAR_SUM); - addSerialAgg(SUM, SERIAL_SUM); - addSerialAgg(LOCAL_SUM, SERIAL_LOCAL_SUM); addAgg(SERIAL_SUM); addAgg(SERIAL_LOCAL_SUM); + addAgg(SERIAL_GLOBAL_SUM); + addSerialAgg(SUM, SERIAL_SUM); + addSerialAgg(LOCAL_SUM, SERIAL_LOCAL_SUM); + addSerialAgg(GLOBAL_SUM, SERIAL_GLOBAL_SUM); addLocalAgg(SERIAL_SUM, SERIAL_LOCAL_SUM); - addIntermediateAgg(SERIAL_SUM, SERIAL_SUM); - addIntermediateAgg(SERIAL_LOCAL_SUM, SERIAL_SUM); - addGlobalAgg(SERIAL_SUM, SERIAL_SUM); - - // SUM DISTINCT + addIntermediateAgg(SERIAL_SUM, SERIAL_INTERMEDIATE_SUM); + addIntermediateAgg(SERIAL_LOCAL_SUM, SERIAL_INTERMEDIATE_SUM); + addIntermediateAgg(SERIAL_GLOBAL_SUM, SERIAL_INTERMEDIATE_SUM); + addGlobalAgg(SERIAL_SUM, SERIAL_GLOBAL_SUM); + // SUM Distinct addDistinctAgg(SUM_DISTINCT, SCALAR_SUM); addScalarAgg(SUM_DISTINCT, SCALAR_SUM_DISTINCT); @@ -2493,27 +2523,29 @@ public class BuiltinFunctions { addScalarAgg(SQL_MIN_DISTINCT, SCALAR_SQL_MIN_DISTINCT); // SQL SUM - addAgg(SQL_SUM); addAgg(LOCAL_SQL_SUM); + addAgg(GLOBAL_SQL_SUM); addLocalAgg(SQL_SUM, LOCAL_SQL_SUM); - addIntermediateAgg(LOCAL_SQL_SUM, SQL_SUM); - addIntermediateAgg(SQL_SUM, SQL_SUM); - addGlobalAgg(SQL_SUM, SQL_SUM); - + addIntermediateAgg(SQL_SUM, INTERMEDIATE_SQL_SUM); + addIntermediateAgg(LOCAL_SQL_SUM, INTERMEDIATE_SQL_SUM); + addIntermediateAgg(GLOBAL_SQL_SUM, INTERMEDIATE_SQL_SUM); + addGlobalAgg(SQL_SUM, GLOBAL_SQL_SUM); addScalarAgg(SQL_SUM, SCALAR_SQL_SUM); - addSerialAgg(SQL_SUM, SERIAL_SQL_SUM); - addSerialAgg(LOCAL_SQL_SUM, SERIAL_LOCAL_SQL_SUM); addAgg(SERIAL_SQL_SUM); addAgg(SERIAL_LOCAL_SQL_SUM); + addAgg(SERIAL_GLOBAL_SQL_SUM); + addSerialAgg(SQL_SUM, SERIAL_SQL_SUM); + addSerialAgg(LOCAL_SQL_SUM, SERIAL_LOCAL_SQL_SUM); + addSerialAgg(GLOBAL_SQL_SUM, SERIAL_GLOBAL_SQL_SUM); addLocalAgg(SERIAL_SQL_SUM, SERIAL_LOCAL_SQL_SUM); - addIntermediateAgg(SERIAL_LOCAL_SQL_SUM, SERIAL_SQL_SUM); addIntermediateAgg(SERIAL_SQL_SUM, SERIAL_SQL_SUM); - addGlobalAgg(SERIAL_SQL_SUM, SERIAL_SQL_SUM); - - // SQL SUM DISTINCT + addIntermediateAgg(SERIAL_LOCAL_SQL_SUM, SERIAL_INTERMEDIATE_SQL_SUM); + addIntermediateAgg(SERIAL_GLOBAL_SQL_SUM, SERIAL_INTERMEDIATE_SQL_SUM); + addGlobalAgg(SERIAL_SQL_SUM, SERIAL_GLOBAL_SQL_SUM); + // SQL SUM Distinct addDistinctAgg(SQL_SUM_DISTINCT, SCALAR_SQL_SUM); addScalarAgg(SQL_SUM_DISTINCT, SCALAR_SQL_SUM_DISTINCT); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericAggTypeComputer.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericAggTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericAggTypeComputer.java deleted file mode 100644 index 32a6487..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericAggTypeComputer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -package org.apache.asterix.om.typecomputer.impl; - -import org.apache.asterix.om.exceptions.UnsupportedTypeException; -import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer; -import org.apache.asterix.om.types.ATypeTag; -import org.apache.asterix.om.types.AUnionType; -import org.apache.asterix.om.types.BuiltinType; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; -import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression; -import org.apache.hyracks.api.exceptions.SourceLocation; - -public class NumericAggTypeComputer extends AbstractResultTypeComputer { - public static final NumericAggTypeComputer INSTANCE = new NumericAggTypeComputer(); - - private NumericAggTypeComputer() { - } - - @Override - protected void checkArgType(String funcName, int argIndex, IAType type, SourceLocation sourceLoc) - throws AlgebricksException { - ATypeTag tag = type.getTypeTag(); - switch (tag) { - case DOUBLE: - case FLOAT: - case BIGINT: - case INTEGER: - case SMALLINT: - case TINYINT: - case ANY: - break; - default: - throw new UnsupportedTypeException(sourceLoc, funcName, tag); - } - } - - @Override - protected IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException { - ATypeTag tag = strippedInputTypes[0].getTypeTag(); - switch (tag) { - case DOUBLE: - case FLOAT: - case BIGINT: - case INTEGER: - case SMALLINT: - case TINYINT: - case ANY: - IAType type = strippedInputTypes[0]; - return AUnionType.createNullableType(type, "AggResult"); - default: - // All other possible cases. - return BuiltinType.ANULL; - } - - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericSumAggTypeComputer.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericSumAggTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericSumAggTypeComputer.java new file mode 100644 index 0000000..7b0bca6 --- /dev/null +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericSumAggTypeComputer.java @@ -0,0 +1,78 @@ +/* + * 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. + */ +package org.apache.asterix.om.typecomputer.impl; + +import org.apache.asterix.om.exceptions.UnsupportedTypeException; +import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer; +import org.apache.asterix.om.types.ATypeTag; +import org.apache.asterix.om.types.AUnionType; +import org.apache.asterix.om.types.BuiltinType; +import org.apache.asterix.om.types.IAType; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; +import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression; +import org.apache.hyracks.api.exceptions.SourceLocation; + +public class NumericSumAggTypeComputer extends AbstractResultTypeComputer { + public static final NumericSumAggTypeComputer INSTANCE = new NumericSumAggTypeComputer(); + + private NumericSumAggTypeComputer() { + } + + @Override + protected void checkArgType(String funcName, int argIndex, IAType type, SourceLocation sourceLoc) + throws AlgebricksException { + ATypeTag tag = type.getTypeTag(); + switch (tag) { + case DOUBLE: + case FLOAT: + case BIGINT: + case INTEGER: + case SMALLINT: + case TINYINT: + case ANY: + break; + default: + throw new UnsupportedTypeException(sourceLoc, funcName, tag); + } + } + + @Override + protected IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException { + ATypeTag tag = strippedInputTypes[0].getTypeTag(); + switch (tag) { + case TINYINT: + case SMALLINT: + case INTEGER: + case BIGINT: + IAType int64Type = BuiltinType.AINT64; + return AUnionType.createNullableType(int64Type, "AggResult"); + case FLOAT: + case DOUBLE: + IAType doubleType = BuiltinType.ADOUBLE; + return AUnionType.createNullableType(doubleType, "AggResult"); + case ANY: + IAType anyType = strippedInputTypes[0]; + return AUnionType.createNullableType(anyType, "AggResult"); + default: + // All other possible cases. + return BuiltinType.ANULL; + } + + } +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSqlSumAggregateDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSqlSumAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSqlSumAggregateDescriptor.java index 078ea57..e1fcd1a 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSqlSumAggregateDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSqlSumAggregateDescriptor.java @@ -28,14 +28,8 @@ public class ScalarSqlSumAggregateDescriptor extends AbstractScalarAggregateDesc private static final long serialVersionUID = 1L; - public final static FunctionIdentifier FID = BuiltinFunctions.SCALAR_SQL_SUM; - - public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() { - @Override - public IFunctionDescriptor createFunctionDescriptor() { - return new ScalarSqlSumAggregateDescriptor(SqlSumAggregateDescriptor.FACTORY.createFunctionDescriptor()); - } - }; + public static final IFunctionDescriptorFactory FACTORY = + () -> new ScalarSqlSumAggregateDescriptor(SqlSumAggregateDescriptor.FACTORY.createFunctionDescriptor()); private ScalarSqlSumAggregateDescriptor(IFunctionDescriptor aggFuncDesc) { super(aggFuncDesc); @@ -43,6 +37,6 @@ public class ScalarSqlSumAggregateDescriptor extends AbstractScalarAggregateDesc @Override public FunctionIdentifier getIdentifier() { - return FID; + return BuiltinFunctions.SCALAR_SQL_SUM; } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSumAggregateDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSumAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSumAggregateDescriptor.java index 4d547e1..eb1d38b 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSumAggregateDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/ScalarSumAggregateDescriptor.java @@ -28,14 +28,8 @@ public class ScalarSumAggregateDescriptor extends AbstractScalarAggregateDescrip private static final long serialVersionUID = 1L; - public final static FunctionIdentifier FID = BuiltinFunctions.SCALAR_SUM; - - public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() { - @Override - public IFunctionDescriptor createFunctionDescriptor() { - return new ScalarSumAggregateDescriptor(SumAggregateDescriptor.FACTORY.createFunctionDescriptor()); - } - }; + public static final IFunctionDescriptorFactory FACTORY = + () -> new ScalarSumAggregateDescriptor(SumAggregateDescriptor.FACTORY.createFunctionDescriptor()); private ScalarSumAggregateDescriptor(IFunctionDescriptor aggFuncDesc) { super(aggFuncDesc); @@ -43,6 +37,6 @@ public class ScalarSumAggregateDescriptor extends AbstractScalarAggregateDescrip @Override public FunctionIdentifier getIdentifier() { - return FID; + return BuiltinFunctions.SCALAR_SUM; } }
