zstan commented on code in PR #4422:
URL: https://github.com/apache/ignite-3/pull/4422#discussion_r1773331665
##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDataTypesTest.java:
##########
@@ -606,64 +604,51 @@ public void testDecimalCastsFromNumeric(RelDataType
inputType, Object input,
@ParameterizedTest(name = "{1} {2}")
@MethodSource("decimalOverflows")
public void testCalcOpOverflow(SqlTypeName type, String expr, Object
param) {
- if (param == EMPTY_PARAM) {
- assertThrowsSqlException(RUNTIME_ERR, type.getName() + " out of
range", () -> sql(expr));
- } else {
- assertThrowsSqlException(RUNTIME_ERR, type.getName() + " out of
range", () -> sql(expr, param));
- }
+ assertThrowsSqlException(RUNTIME_ERR, type.getName() + " out of
range", () -> sql(expr, param));
}
private static Stream<Arguments> decimalOverflows() {
return Stream.of(
// BIGINT
- arguments(SqlTypeName.BIGINT, "SELECT 9223372036854775807 +
1", EMPTY_PARAM),
- arguments(SqlTypeName.BIGINT, "SELECT 9223372036854775807 *
2", EMPTY_PARAM),
- arguments(SqlTypeName.BIGINT, "SELECT -9223372036854775808 -
1", EMPTY_PARAM),
- arguments(SqlTypeName.BIGINT, "SELECT -(-9223372036854775807 -
1)", EMPTY_PARAM),
- arguments(SqlTypeName.BIGINT, "SELECT
-CAST(-9223372036854775808 AS BIGINT)", EMPTY_PARAM),
arguments(SqlTypeName.BIGINT, "SELECT -(?)",
-9223372036854775808L),
- arguments(SqlTypeName.BIGINT, "SELECT
-9223372036854775808/-1", EMPTY_PARAM),
+ arguments(SqlTypeName.BIGINT, "SELECT -CAST(? AS BIGINT)",
-9223372036854775808L),
// INTEGER
- arguments(SqlTypeName.INTEGER, "SELECT 2147483647 + 1",
EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "SELECT CAST(CAST(2147483648 AS
BIGINT) AS INTEGER)", EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "SELECT 2147483647 * 2",
EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "SELECT -2147483648 - 1",
EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "SELECT -(-2147483647 - 1)",
EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "SELECT -CAST(-2147483648 AS
INTEGER)", EMPTY_PARAM),
arguments(SqlTypeName.INTEGER, "SELECT -(?)", -2147483648),
- arguments(SqlTypeName.INTEGER, "SELECT -2147483648/-1",
EMPTY_PARAM),
- arguments(SqlTypeName.INTEGER, "select
CAST(9223372036854775807.5 + 9223372036854775807.5 AS INTEGER)",
- EMPTY_PARAM),
+ arguments(SqlTypeName.INTEGER, "SELECT -CAST(? AS INTEGER)",
-2147483648),
// SMALLINT
Review Comment:
derived type for SMALLINT and TINYINT tests without explicit casting is
INTEGER so - no overflow will raised here
--
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]