mihaibudiu commented on code in PR #4411:
URL: https://github.com/apache/calcite/pull/4411#discussion_r2144379321


##########
core/src/test/resources/sql/unsigned.iq:
##########
@@ -0,0 +1,126 @@
+# unsigned.iq - Tests for unsigned types
+#
+# 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 post
+!set outputformat csv
+
+SELECT CAST(200 AS INT UNSIGNED) - 100;
+EXPR$0
+100
+!ok
+
+SELECT CAST(1 AS INT UNSIGNED);
+EXPR$0
+1
+!ok
+
+SELECT CAST(-1 AS INT UNSIGNED);
+java.lang.NumberFormatException: Value is out of range : -1
+!error
+
+#SELECT CAST(255 AS TINYINT UNSIGNED);
+#EXPR$0
+#255
+#!ok
+#
+#SELECT CAST(255 AS TINYINT);
+#java.lang.ArithmeticException: Value 255 out of range
+#!error
+#
+SELECT CAST(200 AS INT UNSIGNED) - CAST(100 AS INT UNSIGNED);
+EXPR$0
+100
+!ok
+
+SELECT CAST(100 AS INT UNSIGNED) - CAST(200 AS INT UNSIGNED);
+java.lang.NumberFormatException: Value is out of range : -100
+!error
+
+SELECT CAST(CAST(100 AS INT UNSIGNED) AS INT) - 200;
+EXPR$0
+-100
+!ok
+
+SELECT CAST(100 AS INT UNSIGNED) - 200;
+java.lang.NumberFormatException: Value is out of range : -100
+!error
+
+SELECT CAST(100 AS INT UNSIGNED) + 200;
+EXPR$0
+300
+!ok
+
+SELECT CAST(100 AS INT UNSIGNED) * 10;
+EXPR$0
+1000
+!ok
+
+SELECT CAST(CAST(10 AS TINYINT) AS INT UNSIGNED);

Review Comment:
   I don't know of a good place to document the differences between Calcite and 
specific SQL dialects. 
   Do you have a suggestion?
   Whatever Calcite does, it should be a superset of what MySQL can do with 
unsigned types.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to