This is an automated email from the ASF dual-hosted git repository.
alsuliman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 54b31ad [ASTERIXDB-2689][FUN] Make numeric functions return NULL on
invalid arguments
54b31ad is described below
commit 54b31ada42911bd799db66e8c57ed9c209de1d30
Author: Ali Alsuliman <[email protected]>
AuthorDate: Mon Jan 13 15:23:11 2020 -0800
[ASTERIXDB-2689][FUN] Make numeric functions return NULL on invalid
arguments
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Make numeric functions return NULL on invalid arguments.
Change-Id: Id26229064058c3ecbaa54ece3001d3b8980f8d8b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/4583
Contrib: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
Reviewed-by: Dmitry Lychagin <[email protected]>
---
asterixdb/NOTICE | 2 +-
.../numeric_fun_001/numeric_fun_001.01.ddl.sqlpp | 29 +++++
.../numeric_fun_001.02.update.sqlpp | 24 ++++
.../numeric_fun_001/numeric_fun_001.03.query.sqlpp | 54 +++++++++
.../numeric_fun_001/numeric_fun_001.04.ddl.sqlpp | 20 ++++
.../queries_sqlpp/numeric/atan2/atan2.2.ddl.sqlpp | 28 +++++
.../numeric/atan2/atan2.3.update.sqlpp | 24 ++++
.../numeric/atan2/atan2.4.query.sqlpp | 22 ++++
.../queries_sqlpp/numeric/atan2/atan2.5.ddl.sqlpp | 20 ++++
.../numeric_fun_001/numeric_fun_001.03.adm | 1 +
.../runtimets/results/numeric/atan2/atan2.2.adm | 1 +
.../test/resources/runtimets/testsuite_sqlpp.xml | 79 +++++++++++++
.../asterix/om/functions/BuiltinFunctions.java | 52 ++++----
...java => NumericBinaryToDoubleTypeComputer.java} | 39 +++---
.../NumericDoubleOutputFunctionTypeComputer.java | 62 ----------
...Computer.java => NumericUnaryTypeComputer.java} | 44 +++----
.../typecomputer/impl/UnaryMinusTypeComputer.java | 71 -----------
.../AbstractUnaryNumericFunctionEval.java | 13 +-
.../functions/NumericATan2Descriptor.java | 35 ++++--
.../NumericRoundHalfToEvenDescriptor.java | 131 ++++++---------------
.../functions/RandomWithSeedDescriptor.java | 5 +
hyracks-fullstack/NOTICE | 2 +-
22 files changed, 439 insertions(+), 319 deletions(-)
diff --git a/asterixdb/NOTICE b/asterixdb/NOTICE
index 7615782..b4729a8 100644
--- a/asterixdb/NOTICE
+++ b/asterixdb/NOTICE
@@ -1,5 +1,5 @@
Apache AsterixDB
-Copyright 2015-2019 The Apache Software Foundation
+Copyright 2015-2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp
new file mode 100644
index 0000000..dd607f7
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.01.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 t1 as {
+id: int,
+str1: string
+};
+
+create dataset ds1(t1) primary key id;
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
new file mode 100644
index 0000000..05c78d2
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 ds1([
+{"id": 1, "str1": "text", "str2": "text"}
+]);
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp
new file mode 100644
index 0000000..0612ae7
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.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.
+ */
+
+/*
+ * Description: tests reporting invalid argument type for numeric functions
+ */
+// requesttype=application/json
+// param max-warnings:json=1000
+
+use test;
+
+set `import-private-functions` "true";
+
+from ds1 as ds1
+select
+abs(str1) as f1, abs(str2) as f2, abs("text") as f3,
+acos(str1) as f4, acos(str2) as f5, acos("text") as f6,
+asin(str1) as f7, asin(str2) as f8, asin("text") as f9,
+atan(str1) as f10, atan(str2) as f11, atan("text") as f12,
+atan2(str1, str1) as f13, atan2(str2, str2) as f14, atan2("text", "text") as
f15,
+degrees(str1) as f16, degrees(str2) as f17, degrees("text") as f18,
+radians(str1) as f19, radians(str2) as f20, radians("text") as f21,
+cos(str1) as f22, cos(str2) as f23, cos("text") as f24,
+cosh(str1) as f25, cosh(str2) as f26, cosh("text") as f27,
+sin(str1) as f28, sin(str2) as f29, sin("text") as f30,
+sinh(str1) as f31, sinh(str2) as f32, sinh("text") as f33,
+tan(str1) as f34, tan(str2) as f35, tan("text") as f36,
+tanh(str1) as f37, tanh(str2) as f38, tanh("text") as f39,
+exp(str1) as f40, exp(str2) as f41, exp("text") as f42,
+ln(str1) as f43, ln(str2) as f44, ln("text") as f45,
+log(str1) as f46, log(str2) as f47, log("text") as f48,
+sqrt(str1) as f49, sqrt(str2) as f50, sqrt("text") as f51,
+sign(str1) as f52, sign(str2) as f53, sign("text") as f54,
+ceil(str1) as f55, ceil(str2) as f56, ceil("text") as f57,
+floor(str1) as f58, floor(str2) as f59, floor("text") as f60,
+`round-half-to-even`(str1) as f61, `round-half-to-even`(str2) as f62,
`round-half-to-even`("text") as f63,
+random(str1) as f64, random(str2) as f65, random("text") as f66,
+-str1 as f67, -str2 as f68, -"text" as f69;
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp
new file mode 100644
index 0000000..548e632
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.04.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/queries_sqlpp/numeric/atan2/atan2.2.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.2.ddl.sqlpp
new file mode 100644
index 0000000..dd27eaa
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.2.ddl.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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 t1 as {
+id: int
+};
+
+create dataset ds1(t1) primary key id;
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.3.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.3.update.sqlpp
new file mode 100644
index 0000000..dd61be0
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.3.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 ds1([
+{"id": 1, "field": 10}
+]);
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.4.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.4.query.sqlpp
new file mode 100644
index 0000000..296fecf
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.4.query.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.
+ */
+
+use test;
+
+from ds1 select value atan2(field, 1.0f);
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.5.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.5.ddl.sqlpp
new file mode 100644
index 0000000..548e632
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/atan2/atan2.5.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/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
new file mode 100644
index 0000000..043ba3b
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
@@ -0,0 +1 @@
+{ "f1": null, "f3": null, "f4": null, "f5": null, "f6": null, "f7": null,
"f8": null, "f9": null, "f10": null, "f11": null, "f12": null, "f13": null,
"f14": null, "f15": null, "f16": null, "f17": null, "f18": null, "f19": null,
"f20": null, "f21": null, "f22": null, "f23": null, "f24": null, "f25": null,
"f26": null, "f27": null, "f28": null, "f29": null, "f30": null, "f31": null,
"f32": null, "f33": null, "f34": null, "f35": null, "f36": null, "f37": null,
"f38": null, "f39": null, "f40 [...]
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/atan2/atan2.2.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/atan2/atan2.2.adm
new file mode 100644
index 0000000..b8bee73
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/atan2/atan2.2.adm
@@ -0,0 +1 @@
+1.4711276743037347
\ No newline at end of file
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 7a6fb94..e81c6a3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -13741,4 +13741,83 @@
</compilation-unit>
</test-case>
</test-group>
+ <test-group name="fun_return_null/numeric_fun" >
+ <test-case FilePath="fun_return_null/numeric_fun" check-warnings="true">
+ <compilation-unit name="numeric_fun_001">
+ <output-dir compare="Text">numeric_fun_001</output-dir>
+ <expected-warn>Type mismatch: function abs expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function acos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string </expected-warn>
+ <expected-warn>Type mismatch: function asin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan2 expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function degrees expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function radians expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cosh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sinh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tanh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function exp expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ln expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function log expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sqrt expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sign expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ceiling expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function floor expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function round-half-to-even expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function numeric-unary-minus expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function random expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+
+ <expected-warn>Type mismatch: function abs expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function acos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string </expected-warn>
+ <expected-warn>Type mismatch: function asin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan2 expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function degrees expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function radians expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cosh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sinh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tanh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function exp expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ln expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function log expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sqrt expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sign expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ceiling expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function floor expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function round-half-to-even expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function numeric-unary-minus expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function random expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+
+ <expected-warn>Type mismatch: function abs expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function acos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string </expected-warn>
+ <expected-warn>Type mismatch: function asin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function atan2 expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function degrees expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function radians expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cos expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function cosh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sin expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sinh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tan expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function tanh expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function exp expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ln expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function log expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sqrt expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function sign expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function ceiling expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function floor expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function round-half-to-even expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function numeric-unary-minus expects its
1st input parameter to be of type tinyint, smallint, integer, bigint, float or
double, but the actual input type is string</expected-warn>
+ <expected-warn>Type mismatch: function random expects its 1st input
parameter to be of type tinyint, smallint, integer, bigint, float or double,
but the actual input type is string</expected-warn>
+ <source-location>false</source-location>
+ </compilation-unit>
+ </test-case>
+ </test-group>
</test-suite>
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 94303a7..8bd6454 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
@@ -104,13 +104,12 @@ 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.NumericBinaryToDoubleTypeComputer;
import org.apache.asterix.om.typecomputer.impl.NumericDivideTypeComputer;
-import
org.apache.asterix.om.typecomputer.impl.NumericDoubleOutputFunctionTypeComputer;
-import
org.apache.asterix.om.typecomputer.impl.NumericInt8OutputFunctionTypeComputer;
import org.apache.asterix.om.typecomputer.impl.NumericRound2TypeComputer;
import
org.apache.asterix.om.typecomputer.impl.NumericRoundFunctionTypeComputer;
import org.apache.asterix.om.typecomputer.impl.NumericSumAggTypeComputer;
-import
org.apache.asterix.om.typecomputer.impl.NumericUnaryFunctionTypeComputer;
+import org.apache.asterix.om.typecomputer.impl.NumericUnaryTypeComputer;
import org.apache.asterix.om.typecomputer.impl.OpenARecordTypeComputer;
import org.apache.asterix.om.typecomputer.impl.OpenRecordConstructorResultType;
import
org.apache.asterix.om.typecomputer.impl.OrderedListConstructorTypeComputer;
@@ -136,7 +135,6 @@ import
org.apache.asterix.om.typecomputer.impl.ToNumberTypeComputer;
import org.apache.asterix.om.typecomputer.impl.ToObjectTypeComputer;
import org.apache.asterix.om.typecomputer.impl.TreatAsTypeComputer;
import org.apache.asterix.om.typecomputer.impl.UnaryBinaryInt64TypeComputer;
-import org.apache.asterix.om.typecomputer.impl.UnaryMinusTypeComputer;
import org.apache.asterix.om.typecomputer.impl.UniformInputTypeComputer;
import
org.apache.asterix.om.typecomputer.impl.UnorderedListConstructorTypeComputer;
import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
@@ -1622,7 +1620,7 @@ public class BuiltinFunctions {
addFunction(CREATE_QUERY_UID, ABinaryTypeComputer.INSTANCE, false);
addFunction(UUID_CONSTRUCTOR, AUUIDTypeComputer.INSTANCE, true);
addFunction(RANDOM, ADoubleTypeComputer.INSTANCE, false);
- addFunction(RANDOM_WITH_SEED, ADoubleTypeComputer.INSTANCE_NULLABLE,
false);
+ addFunction(RANDOM_WITH_SEED,
NumericUnaryTypeComputer.INSTANCE_DOUBLE, false);
addFunction(DATE_CONSTRUCTOR, ADateTypeComputer.INSTANCE, true);
addFunction(DATETIME_CONSTRUCTOR, ADateTimeTypeComputer.INSTANCE,
true);
@@ -1654,38 +1652,38 @@ public class BuiltinFunctions {
addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, null, true);
addPrivateFunction(MAKE_FIELD_NAME_HANDLE, null, true);
- addPrivateFunction(NUMERIC_UNARY_MINUS,
UnaryMinusTypeComputer.INSTANCE, true);
+ addPrivateFunction(NUMERIC_UNARY_MINUS,
NumericUnaryTypeComputer.INSTANCE, true);
addPrivateFunction(NUMERIC_SUBTRACT,
NumericAddSubMulDivTypeComputer.INSTANCE, true);
addPrivateFunction(NUMERIC_MULTIPLY,
NumericAddSubMulDivTypeComputer.INSTANCE, true);
addPrivateFunction(NUMERIC_DIVIDE, NumericDivideTypeComputer.INSTANCE,
true);
addPrivateFunction(NUMERIC_MOD,
NumericAddSubMulDivTypeComputer.INSTANCE_NULLABLE, true);
addPrivateFunction(NUMERIC_DIV,
NumericAddSubMulDivTypeComputer.INSTANCE_NULLABLE, true);
- addFunction(NUMERIC_ABS, NumericUnaryFunctionTypeComputer.INSTANCE,
true);
- addFunction(NUMERIC_ACOS,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_ASIN,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_ATAN,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_ATAN2,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_DEGREES,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_RADIANS,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_COS,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_COSH,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_SIN,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_SINH,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_TAN,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_TANH,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
+ addFunction(NUMERIC_ABS, NumericUnaryTypeComputer.INSTANCE, true);
+ addFunction(NUMERIC_ACOS, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_ASIN, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_ATAN, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_ATAN2, NumericBinaryToDoubleTypeComputer.INSTANCE,
true);
+ addFunction(NUMERIC_DEGREES, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_RADIANS, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_COS, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_COSH, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_SIN, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_SINH, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_TAN, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_TANH, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
addFunction(NUMERIC_E, ADoubleTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_EXP,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_LN,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_LOG,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
+ addFunction(NUMERIC_EXP, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_LN, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_LOG, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
addFunction(NUMERIC_PI, ADoubleTypeComputer.INSTANCE, true);
addFunction(NUMERIC_POWER, NumericAddSubMulDivTypeComputer.INSTANCE,
true);
- addFunction(NUMERIC_SQRT,
NumericDoubleOutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_SIGN,
NumericInt8OutputFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_CEILING,
NumericUnaryFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_FLOOR, NumericUnaryFunctionTypeComputer.INSTANCE,
true);
+ addFunction(NUMERIC_SQRT, NumericUnaryTypeComputer.INSTANCE_DOUBLE,
true);
+ addFunction(NUMERIC_SIGN, NumericUnaryTypeComputer.INSTANCE_INT8,
true);
+ addFunction(NUMERIC_CEILING, NumericUnaryTypeComputer.INSTANCE, true);
+ addFunction(NUMERIC_FLOOR, NumericUnaryTypeComputer.INSTANCE, true);
addFunction(NUMERIC_ROUND, NumericRoundFunctionTypeComputer.INSTANCE,
true);
addFunction(NUMERIC_ROUND_WITH_ROUND_DIGIT,
NumericRoundFunctionTypeComputer.INSTANCE, true);
- addFunction(NUMERIC_ROUND_HALF_TO_EVEN,
NumericUnaryFunctionTypeComputer.INSTANCE, true);
+ addFunction(NUMERIC_ROUND_HALF_TO_EVEN,
NumericUnaryTypeComputer.INSTANCE, true);
addFunction(NUMERIC_ROUND_HALF_TO_EVEN2,
NumericRound2TypeComputer.INSTANCE, true);
addFunction(NUMERIC_TRUNC, NumericRound2TypeComputer.INSTANCE, true);
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericInt8OutputFunctionTypeComputer.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericBinaryToDoubleTypeComputer.java
similarity index 55%
rename from
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericInt8OutputFunctionTypeComputer.java
rename to
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericBinaryToDoubleTypeComputer.java
index 203deef..c42ced1 100644
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericInt8OutputFunctionTypeComputer.java
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericBinaryToDoubleTypeComputer.java
@@ -16,46 +16,37 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.asterix.om.typecomputer.impl;
-import org.apache.asterix.om.exceptions.TypeMismatchException;
+import static org.apache.asterix.om.types.ATypeTag.ANY;
+
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.asterix.om.types.hierachy.ATypeHierarchy;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.api.exceptions.SourceLocation;
-public class NumericInt8OutputFunctionTypeComputer extends
AbstractResultTypeComputer {
+public class NumericBinaryToDoubleTypeComputer extends
AbstractResultTypeComputer {
- public static final NumericInt8OutputFunctionTypeComputer INSTANCE = new
NumericInt8OutputFunctionTypeComputer();
+ public static final NumericBinaryToDoubleTypeComputer INSTANCE = new
NumericBinaryToDoubleTypeComputer();
- private NumericInt8OutputFunctionTypeComputer() {
+ private NumericBinaryToDoubleTypeComputer() {
}
@Override
- protected void checkArgType(FunctionIdentifier funcId, int argIndex,
IAType type, SourceLocation sourceLoc)
- throws AlgebricksException {
- ATypeTag tag = type.getTypeTag();
- switch (tag) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case DOUBLE:
- break;
- default:
- throw new TypeMismatchException(sourceLoc, funcId, argIndex,
tag, ATypeTag.TINYINT, ATypeTag.SMALLINT,
- ATypeTag.INTEGER, ATypeTag.BIGINT, ATypeTag.FLOAT,
ATypeTag.DOUBLE);
+ protected IAType getResultType(ILogicalExpression expr, IAType...
strippedInputTypes) throws AlgebricksException {
+ ATypeTag t0 = strippedInputTypes[0].getTypeTag();
+ ATypeTag t1 = strippedInputTypes[1].getTypeTag();
+ if (!isValidType(t0) || !isValidType(t1)) {
+ return BuiltinType.ANULL;
}
+ return (t0 == ANY || t1 == ANY) ?
AUnionType.createUnknownableType(BuiltinType.ADOUBLE) : BuiltinType.ADOUBLE;
}
- @Override
- protected IAType getResultType(ILogicalExpression expr, IAType...
strippedInputTypes) throws AlgebricksException {
- return BuiltinType.AINT8;
+ private static boolean isValidType(ATypeTag tag) {
+ return ATypeHierarchy.getTypeDomain(tag) ==
ATypeHierarchy.Domain.NUMERIC || tag == ANY;
}
}
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericDoubleOutputFunctionTypeComputer.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericDoubleOutputFunctionTypeComputer.java
deleted file mode 100644
index 61f0e98..0000000
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericDoubleOutputFunctionTypeComputer.java
+++ /dev/null
@@ -1,62 +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.TypeMismatchException;
-import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer;
-import org.apache.asterix.om.types.ATypeTag;
-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.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.api.exceptions.SourceLocation;
-
-public class NumericDoubleOutputFunctionTypeComputer extends
AbstractResultTypeComputer {
-
- public static final NumericDoubleOutputFunctionTypeComputer INSTANCE =
- new NumericDoubleOutputFunctionTypeComputer();
-
- private NumericDoubleOutputFunctionTypeComputer() {
- }
-
- @Override
- protected void checkArgType(FunctionIdentifier funcId, int argIndex,
IAType type, SourceLocation sourceLoc)
- throws AlgebricksException {
- ATypeTag tag = type.getTypeTag();
- switch (tag) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case DOUBLE:
- break;
- default:
- throw new TypeMismatchException(sourceLoc, funcId, argIndex,
tag, ATypeTag.TINYINT, ATypeTag.SMALLINT,
- ATypeTag.INTEGER, ATypeTag.BIGINT, ATypeTag.FLOAT,
ATypeTag.DOUBLE);
- }
- }
-
- @Override
- protected IAType getResultType(ILogicalExpression expr, IAType...
strippedInputTypes) throws AlgebricksException {
- return BuiltinType.ADOUBLE;
- }
-}
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryFunctionTypeComputer.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryTypeComputer.java
similarity index 58%
rename from
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryFunctionTypeComputer.java
rename to
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryTypeComputer.java
index 37103f8..9e1c3d4 100644
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryFunctionTypeComputer.java
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericUnaryTypeComputer.java
@@ -23,38 +23,28 @@
*/
package org.apache.asterix.om.typecomputer.impl;
-import org.apache.asterix.om.exceptions.TypeMismatchException;
+import static org.apache.asterix.om.types.BuiltinType.ADOUBLE;
+import static org.apache.asterix.om.types.BuiltinType.AINT8;
+
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.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.api.exceptions.SourceLocation;
-public class NumericUnaryFunctionTypeComputer extends
AbstractResultTypeComputer {
- public static final NumericUnaryFunctionTypeComputer INSTANCE = new
NumericUnaryFunctionTypeComputer();
+public class NumericUnaryTypeComputer extends AbstractResultTypeComputer {
- private NumericUnaryFunctionTypeComputer() {
- }
+ public static final NumericUnaryTypeComputer INSTANCE = new
NumericUnaryTypeComputer(null);
+ public static final NumericUnaryTypeComputer INSTANCE_INT8 = new
NumericUnaryTypeComputer(AINT8);
+ public static final NumericUnaryTypeComputer INSTANCE_DOUBLE = new
NumericUnaryTypeComputer(ADOUBLE);
- @Override
- protected void checkArgType(FunctionIdentifier funcId, int argIndex,
IAType type, SourceLocation sourceLoc)
- throws AlgebricksException {
- ATypeTag tag = type.getTypeTag();
- switch (tag) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case DOUBLE:
- case ANY:
- break;
- default:
- throw new TypeMismatchException(sourceLoc, funcId, argIndex,
tag, ATypeTag.TINYINT, ATypeTag.SMALLINT,
- ATypeTag.INTEGER, ATypeTag.BIGINT, ATypeTag.FLOAT,
ATypeTag.DOUBLE);
- }
+ // when returnType is null, the function returns the same type as the
input argument
+ private final IAType returnType;
+
+ private NumericUnaryTypeComputer(IAType returnType) {
+ this.returnType = returnType;
}
@Override
@@ -67,10 +57,12 @@ public class NumericUnaryFunctionTypeComputer extends
AbstractResultTypeComputer
case BIGINT:
case FLOAT:
case DOUBLE:
+ return returnType == null ? strippedInputTypes[0] : returnType;
case ANY:
- return strippedInputTypes[0];
+ return returnType == null ? BuiltinType.ANY :
AUnionType.createUnknownableType(returnType);
default:
- return null;
+ // null for all other invalid types
+ return BuiltinType.ANULL;
}
}
}
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/UnaryMinusTypeComputer.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/UnaryMinusTypeComputer.java
deleted file mode 100644
index cae6664..0000000
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/UnaryMinusTypeComputer.java
+++ /dev/null
@@ -1,71 +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.TypeMismatchException;
-import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer;
-import org.apache.asterix.om.types.ATypeTag;
-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.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.api.exceptions.SourceLocation;
-
-public class UnaryMinusTypeComputer extends AbstractResultTypeComputer {
-
- public static final UnaryMinusTypeComputer INSTANCE = new
UnaryMinusTypeComputer();
-
- private UnaryMinusTypeComputer() {
- }
-
- @Override
- public void checkArgType(FunctionIdentifier funcId, int argIndex, IAType
type, SourceLocation sourceLoc)
- throws AlgebricksException {
- ATypeTag tag = type.getTypeTag();
- switch (tag) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case DOUBLE:
- break;
- default:
- throw new TypeMismatchException(sourceLoc, funcId, argIndex,
tag, ATypeTag.TINYINT, ATypeTag.SMALLINT,
- ATypeTag.INTEGER, ATypeTag.BIGINT, ATypeTag.FLOAT,
ATypeTag.DOUBLE);
- }
- }
-
- @Override
- public IAType getResultType(ILogicalExpression expr, IAType... knownTypes)
throws AlgebricksException {
- ATypeTag tag = knownTypes[0].getTypeTag();
- switch (tag) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case DOUBLE:
- case ANY:
- return knownTypes[0];
- default:
- return null;
- }
- }
-}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractUnaryNumericFunctionEval.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractUnaryNumericFunctionEval.java
index 548b6ff..6c199d0 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractUnaryNumericFunctionEval.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractUnaryNumericFunctionEval.java
@@ -36,9 +36,10 @@ import org.apache.asterix.om.base.AMutableInt32;
import org.apache.asterix.om.base.AMutableInt64;
import org.apache.asterix.om.base.AMutableInt8;
import org.apache.asterix.om.base.IAObject;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
+import org.apache.asterix.runtime.evaluators.common.ArgumentUtils;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -94,12 +95,14 @@ abstract class AbstractUnaryNumericFunctionEval implements
IScalarEvaluator {
// The function identifier, used for error messages.
private final FunctionIdentifier funcID;
private final SourceLocation sourceLoc;
+ private final IEvaluatorContext ctx;
- public AbstractUnaryNumericFunctionEval(IEvaluatorContext context,
IScalarEvaluatorFactory argEvalFactory,
+ AbstractUnaryNumericFunctionEval(IEvaluatorContext context,
IScalarEvaluatorFactory argEvalFactory,
FunctionIdentifier funcID, SourceLocation sourceLoc) throws
HyracksDataException {
this.argEval = argEvalFactory.createScalarEvaluator(context);
this.funcID = funcID;
this.sourceLoc = sourceLoc;
+ this.ctx = context;
}
@SuppressWarnings("unchecked")
@@ -134,10 +137,8 @@ abstract class AbstractUnaryNumericFunctionEval implements
IScalarEvaluator {
double val = ADoubleSerializerDeserializer.getDouble(data, offset
+ 1);
processDouble(val, result);
} else {
- throw new TypeMismatchException(sourceLoc, funcID, 0,
data[offset], ATypeTag.SERIALIZED_INT8_TYPE_TAG,
- ATypeTag.SERIALIZED_INT16_TYPE_TAG,
ATypeTag.SERIALIZED_INT32_TYPE_TAG,
- ATypeTag.SERIALIZED_INT64_TYPE_TAG,
ATypeTag.SERIALIZED_FLOAT_TYPE_TAG,
- ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
+ ExceptionUtil.warnTypeMismatch(ctx, sourceLoc, funcID,
data[offset], 0, ArgumentUtils.EXPECTED_NUMERIC);
+ PointableHelper.setNull(result);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericATan2Descriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericATan2Descriptor.java
index 9b0f8bb..da52b4a 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericATan2Descriptor.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericATan2Descriptor.java
@@ -18,11 +18,15 @@
*/
package org.apache.asterix.runtime.evaluators.functions;
+import static org.apache.asterix.om.types.ATypeTag.VALUE_TYPE_MAPPING;
+import static
org.apache.asterix.runtime.evaluators.common.ArgumentUtils.EXPECTED_NUMERIC;
+
import java.io.DataOutput;
import org.apache.asterix.common.annotations.MissingNullInOutFunction;
import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
import org.apache.asterix.om.base.AMutableDouble;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
import org.apache.asterix.om.functions.BuiltinFunctions;
import org.apache.asterix.om.functions.IFunctionDescriptor;
import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -69,7 +73,8 @@ public class NumericATan2Descriptor extends
AbstractScalarFunctionDynamicDescrip
private final IPointable rightPtr = new VoidPointable();
private final IScalarEvaluator evalLeft =
args[0].createScalarEvaluator(ctx);
private final IScalarEvaluator evalRight =
args[1].createScalarEvaluator(ctx);
- private final double[] operands = new double[args.length];
+ private double operand0;
+ private double operand1;
// For the output.
private final AMutableDouble aDouble = new
AMutableDouble(0.0);
@@ -90,19 +95,33 @@ public class NumericATan2Descriptor extends
AbstractScalarFunctionDynamicDescrip
return;
}
- for (int i = 0; i < args.length; i++) {
- IPointable argPtr = i == 0 ? leftPtr : rightPtr;
- byte[] data = argPtr.getByteArray();
- int offset = argPtr.getStartOffset();
- operands[i] =
ATypeHierarchy.getDoubleValue(getIdentifier().getName(), i, data, offset);
+ if (checkTypeAndWarn(leftPtr, 0) ||
checkTypeAndWarn(rightPtr, 1)) {
+ PointableHelper.setNull(result);
+ return;
}
- aDouble.setValue(Math.atan2(operands[0], operands[1]));
+ String funName = getIdentifier().getName();
+ operand0 = ATypeHierarchy.getDoubleValue(funName, 0,
leftPtr.getByteArray(),
+ leftPtr.getStartOffset());
+ operand1 = ATypeHierarchy.getDoubleValue(funName, 1,
rightPtr.getByteArray(),
+ rightPtr.getStartOffset());
+ aDouble.setValue(Math.atan2(operand0, operand1));
outputSerde.serialize(aDouble, out);
result.set(resultStorage);
}
+
+ private boolean checkTypeAndWarn(IPointable argPtr, int
argIdx) {
+ byte[] data = argPtr.getByteArray();
+ int offset = argPtr.getStartOffset();
+ byte type = data[offset];
+ if
(ATypeHierarchy.getTypeDomain(VALUE_TYPE_MAPPING[type]) !=
ATypeHierarchy.Domain.NUMERIC) {
+ ExceptionUtil.warnTypeMismatch(ctx, sourceLoc,
getIdentifier(), type, argIdx,
+ EXPECTED_NUMERIC);
+ return true;
+ }
+ return false;
+ }
};
}
};
}
-
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
index 73cf677..b1879a6 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
@@ -23,39 +23,18 @@
*/
package org.apache.asterix.runtime.evaluators.functions;
-import java.io.DataOutput;
-
import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import
org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import
org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
-import
org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
-import
org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import
org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
-import
org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AMutableDouble;
-import org.apache.asterix.om.base.AMutableFloat;
-import org.apache.asterix.om.base.AMutableInt16;
-import org.apache.asterix.om.base.AMutableInt32;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.AMutableInt8;
import org.apache.asterix.om.functions.BuiltinFunctions;
import org.apache.asterix.om.functions.IFunctionDescriptor;
import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
import
org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@MissingNullInOutFunction
public class NumericRoundHalfToEvenDescriptor extends
AbstractScalarFunctionDynamicDescriptor {
@@ -79,82 +58,48 @@ public class NumericRoundHalfToEvenDescriptor extends
AbstractScalarFunctionDyna
@Override
public IScalarEvaluator createScalarEvaluator(final
IEvaluatorContext ctx) throws HyracksDataException {
+ return new RoundHalfToEvenEvaluator(ctx, args[0],
getIdentifier(), sourceLoc);
+ }
+ };
+ }
+
+ private static class RoundHalfToEvenEvaluator extends
AbstractUnaryNumericFunctionEval {
- return new IScalarEvaluator() {
+ RoundHalfToEvenEvaluator(IEvaluatorContext context,
IScalarEvaluatorFactory argEvalFactory,
+ FunctionIdentifier funID, SourceLocation sourceLocation)
throws HyracksDataException {
+ super(context, argEvalFactory, funID, sourceLocation);
+ }
- private ArrayBackedValueStorage resultStorage = new
ArrayBackedValueStorage();
- private DataOutput out = resultStorage.getDataOutput();
- private IPointable argPtr = new VoidPointable();
- private IScalarEvaluator eval =
args[0].createScalarEvaluator(ctx);
- private AMutableDouble aDouble = new AMutableDouble(0);
- private AMutableFloat aFloat = new AMutableFloat(0);
- private AMutableInt64 aInt64 = new AMutableInt64(0);
- private AMutableInt32 aInt32 = new AMutableInt32(0);
- private AMutableInt16 aInt16 = new AMutableInt16((short)
0);
- private AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
- @SuppressWarnings("rawtypes")
- private ISerializerDeserializer serde;
+ @Override
+ protected void processInt8(byte arg, IPointable resultPointable)
throws HyracksDataException {
+ resultPointable.set(argPtr);
+ }
+
+ @Override
+ protected void processInt16(short arg, IPointable resultPointable)
throws HyracksDataException {
+ resultPointable.set(argPtr);
+ }
- @SuppressWarnings("unchecked")
- @Override
- public void evaluate(IFrameTupleReference tuple,
IPointable result) throws HyracksDataException {
- resultStorage.reset();
- eval.evaluate(tuple, argPtr);
+ @Override
+ protected void processInt32(int arg, IPointable resultPointable)
throws HyracksDataException {
+ resultPointable.set(argPtr);
+ }
- if (PointableHelper.checkAndSetMissingOrNull(result,
argPtr)) {
- return;
- }
+ @Override
+ protected void processInt64(long arg, IPointable resultPointable)
throws HyracksDataException {
+ resultPointable.set(argPtr);
+ }
- byte[] data = argPtr.getByteArray();
- int offset = argPtr.getStartOffset();
+ @Override
+ protected void processFloat(float arg, IPointable resultPointable)
throws HyracksDataException {
+ aFloat.setValue((float) Math.rint(arg));
+ serialize(aFloat, floatSerde, resultPointable);
+ }
- if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG)
{
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.AINT8);
- byte val =
AInt8SerializerDeserializer.getByte(data, offset + 1);
- aInt8.setValue(val);
- serde.serialize(aInt8, out);
- } else if (data[offset] ==
ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.AINT16);
- short val =
AInt16SerializerDeserializer.getShort(data, offset + 1);
- aInt16.setValue(val);
- serde.serialize(aInt16, out);
- } else if (data[offset] ==
ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.AINT32);
- int val =
AInt32SerializerDeserializer.getInt(data, offset + 1);
- aInt32.setValue(val);
- serde.serialize(aInt32, out);
- } else if (data[offset] ==
ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.AINT64);
- long val =
AInt64SerializerDeserializer.getLong(data, offset + 1);
- aInt64.setValue(val);
- serde.serialize(aInt64, out);
- } else if (data[offset] ==
ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.AFLOAT);
- float val =
AFloatSerializerDeserializer.getFloat(data, offset + 1);
- aFloat.setValue((float) Math.rint(val));
- serde.serialize(aFloat, out);
- } else if (data[offset] ==
ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
- serde = SerializerDeserializerProvider.INSTANCE
-
.getSerializerDeserializer(BuiltinType.ADOUBLE);
- double val =
ADoubleSerializerDeserializer.getDouble(data, offset + 1);
- aDouble.setValue(Math.rint(val));
- serde.serialize(aDouble, out);
- } else {
- throw new TypeMismatchException(sourceLoc,
getIdentifier(), 0, data[offset],
- ATypeTag.SERIALIZED_INT8_TYPE_TAG,
ATypeTag.SERIALIZED_INT16_TYPE_TAG,
- ATypeTag.SERIALIZED_INT32_TYPE_TAG,
ATypeTag.SERIALIZED_INT64_TYPE_TAG,
- ATypeTag.SERIALIZED_FLOAT_TYPE_TAG,
ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
- }
- result.set(resultStorage);
- }
- };
- }
- };
+ @Override
+ protected void processDouble(double arg, IPointable resultPointable)
throws HyracksDataException {
+ aDouble.setValue(Math.rint(arg));
+ serialize(aDouble, doubleSerde, resultPointable);
+ }
}
-
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RandomWithSeedDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RandomWithSeedDescriptor.java
index aa49010..7f24e8d 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RandomWithSeedDescriptor.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RandomWithSeedDescriptor.java
@@ -19,7 +19,10 @@
package org.apache.asterix.runtime.evaluators.functions;
+import static
org.apache.asterix.runtime.evaluators.common.ArgumentUtils.EXPECTED_NUMERIC;
+
import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
import org.apache.asterix.om.functions.BuiltinFunctions;
import org.apache.asterix.om.functions.IFunctionDescriptor;
import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -82,6 +85,8 @@ public class RandomWithSeedDescriptor extends
AbstractScalarFunctionDynamicDescr
randomHelper.nextDouble(resultPointable);
break;
default:
+ ExceptionUtil.warnTypeMismatch(ctx, sourceLoc,
getIdentifier(), bytes[offset], 0,
+ EXPECTED_NUMERIC);
PointableHelper.setNull(resultPointable);
break;
}
diff --git a/hyracks-fullstack/NOTICE b/hyracks-fullstack/NOTICE
index 77f31ad..95fe98a 100644
--- a/hyracks-fullstack/NOTICE
+++ b/hyracks-fullstack/NOTICE
@@ -1,5 +1,5 @@
Apache Hyracks and Algebricks
-Copyright 2015-2019 The Apache Software Foundation
+Copyright 2015-2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).