From 7a2e161c3fb92d900adf62a43ae26b954cce918a Mon Sep 17 00:00:00 2001 From: Evgeniy Stanilovskiy Date: Wed, 11 Dec 2024 08:29:57 +0300 Subject: [PATCH] IGNITE-22755 Sql. Bump calcite version to 1.38 (#4837) --- check-rules/pmd-rules.xml | 2 + gradle/libs.versions.toml | 2 +- .../engine/ItAlterTableAlterColumnTest.java | 1 + .../engine/datatypes/ItCastToBigintTest.java | 5 + .../sql/engine/datatypes/ItCastToIntTest.java | 5 + .../datatypes/ItCastToSmallintTest.java | 5 + .../engine/datatypes/ItCastToTinyintTest.java | 5 + .../ItCastToTsWithLocalTimeZoneTest.java | 5 + .../sql/group1/cast/test_cast_double.test | 4 +- .../sql/group1/cast/test_cast_string.test | 4 +- .../group1/join/inner/join_cross_product.test | 5 +- .../types/integer/integer_overflow.test | 2 +- .../exec/exp/ExpressionFactoryImpl.java | 4 +- .../engine/exec/exp/IgniteSqlFunctions.java | 24 + .../sql/engine/exec/exp/RexImpTable.java | 909 +++++--- .../engine/exec/exp/RexToLixTranslator.java | 93 +- .../sql/engine/externalize/RelJson.java | 22 + .../prepare/IgniteSqlToRelConvertor.java | 40 +- .../engine/prepare/IgniteSqlValidator.java | 8 +- .../sql/engine/rex/IgniteRexBuilder.java | 17 +- .../sql/fun/IgniteSqlOperatorTable.java | 456 ++-- .../sql/engine/type/IgniteTypeSystem.java | 55 + .../internal/sql/engine/util/IgniteMath.java | 4 +- .../sql/engine/util/IgniteMethod.java | 4 + .../exec/exp/ExpressionFactoryImplTest.java | 16 +- .../engine/planner/DynamicParametersTest.java | 17 +- .../sql/engine/planner/ImplicitCastsTest.java | 2 +- .../planner/IndexSearchBoundsPlannerTest.java | 6 +- .../planner/PartitionPruningMetadataTest.java | 17 +- .../datatypes/NumericInTypeCoercionTest.java | 2065 ++++++++++------- .../NumericInsertSourcesCoercionTest.java | 18 +- .../NumericUpdateSourcesCoercionTest.java | 18 +- .../engine/planner/datatypes/utils/Types.java | 3 + .../sql/engine/sql/SqlReservedWordsTest.java | 3 + 34 files changed, 2405 insertions(+), 1441 deletions(-) diff --git a/check-rules/pmd-rules.xml b/check-rules/pmd-rules.xml index 42833bf2c70..facf26af0ee 100644 --- a/check-rules/pmd-rules.xml +++ b/check-rules/pmd-rules.xml @@ -146,4 +146,6 @@ .*/src/main/java/com/facebook/presto/.* + .*/sql/engine/exec/exp/RexImpTable\.java + .*/sql/engine/exec/exp/RexToLixTranslator\.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ae587525446..5c93adb4bd8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -56,7 +56,7 @@ hamcrestOptional = "2.0.0" hamcrestPath = "1.0.1" hamcrestJson = "0.3" scalecube = "2.6.15" -calcite = "1.37.0" +calcite = "1.38.0" value = "2.10.1" janino = "3.1.12" jsonpath = "2.9.0" diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItAlterTableAlterColumnTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItAlterTableAlterColumnTest.java index da6945e69b1..618dbfd0b45 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItAlterTableAlterColumnTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItAlterTableAlterColumnTest.java @@ -102,6 +102,7 @@ private static Stream supportedTypesTransitions() { arguments.add(Arguments.of("SMALLINT", Short.MAX_VALUE, ColumnType.INT32, "INT", Integer.MAX_VALUE)); arguments.add(Arguments.of("INT", Integer.MAX_VALUE, ColumnType.INT64, "BIGINT", Long.MAX_VALUE)); arguments.add(Arguments.of("FLOAT", Float.MAX_VALUE, ColumnType.DOUBLE, "DOUBLE", Double.MAX_VALUE)); + arguments.add(Arguments.of("FLOAT", Float.MIN_VALUE, ColumnType.DOUBLE, "DOUBLE", Double.MIN_VALUE)); arguments.add(Arguments.of("VARCHAR(10)", "'" + "c".repeat(10) + "'", ColumnType.STRING, "VARCHAR(20)", "'" + "c".repeat(20) + "'")); arguments.add(Arguments.of("VARBINARY(1)", "x'01'", ColumnType.BYTE_ARRAY, diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToBigintTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToBigintTest.java index 3ce72697624..964c09c01c0 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToBigintTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToBigintTest.java @@ -45,6 +45,11 @@ */ @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true") public class ItCastToBigintTest extends BaseSqlIntegrationTest { + @Override + protected int initialNodes() { + return 1; + } + @BeforeAll static void createTable() { sql("CREATE TABLE test (val BIGINT)"); diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToIntTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToIntTest.java index d17b3c88362..32846de84a8 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToIntTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToIntTest.java @@ -45,6 +45,11 @@ */ @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true") public class ItCastToIntTest extends BaseSqlIntegrationTest { + @Override + protected int initialNodes() { + return 1; + } + @BeforeAll static void createTable() { sql("CREATE TABLE test (val INTEGER)"); diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToSmallintTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToSmallintTest.java index 5adf3539c6e..a9b7af513d7 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToSmallintTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToSmallintTest.java @@ -45,6 +45,11 @@ */ @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true") public class ItCastToSmallintTest extends BaseSqlIntegrationTest { + @Override + protected int initialNodes() { + return 1; + } + @BeforeAll static void createTable() { sql("CREATE TABLE test (val SMALLINT)"); diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTinyintTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTinyintTest.java index 868fca6cb77..b985991cff9 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTinyintTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTinyintTest.java @@ -45,6 +45,11 @@ */ @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true") public class ItCastToTinyintTest extends BaseSqlIntegrationTest { + @Override + protected int initialNodes() { + return 1; + } + @BeforeAll static void createTable() { sql("CREATE TABLE test (val TINYINT)"); diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTsWithLocalTimeZoneTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTsWithLocalTimeZoneTest.java index 62f69f229f5..cc4006fc22f 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTsWithLocalTimeZoneTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/ItCastToTsWithLocalTimeZoneTest.java @@ -49,6 +49,11 @@ */ @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true") public class ItCastToTsWithLocalTimeZoneTest extends BaseSqlIntegrationTest { + @Override + protected int initialNodes() { + return 1; + } + @BeforeAll static void createTable() { sql("CREATE TABLE test (val TIMESTAMP WITH LOCAL TIME ZONE)"); diff --git a/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_double.test b/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_double.test index 75d549e2a86..ef51bc3b635 100644 --- a/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_double.test +++ b/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_double.test @@ -46,12 +46,12 @@ endfor query T SELECT CAST(100.1::REAL AS DOUBLE); ---- -100.1 +100.0999984741211 query T SELECT CAST(100.1::FLOAT AS DOUBLE); ---- -100.1 +100.0999984741211 statement error: For input string: "e1" SELECT CAST('e1' AS DOUBLE); diff --git a/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_string.test b/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_string.test index 4a6a02e8978..512bcc70816 100644 --- a/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_string.test +++ b/modules/sql-engine/src/integrationTest/sql/group1/cast/test_cast_string.test @@ -44,14 +44,14 @@ SELECT 1::BIGINT::VARCHAR, 1244295295289253::BIGINT::VARCHAR, (-2000000111551166 query TTT SELECT 2::FLOAT::VARCHAR, 0.5::FLOAT::VARCHAR, (-128.5)::FLOAT::VARCHAR ---- -2 +2.0 0.5 -128.5 query TTT SELECT 2::DOUBLE::VARCHAR, 0.5::DOUBLE::VARCHAR, (-128.5)::DOUBLE::VARCHAR ---- -2 +2.0 0.5 -128.5 diff --git a/modules/sql-engine/src/integrationTest/sql/group1/join/inner/join_cross_product.test b/modules/sql-engine/src/integrationTest/sql/group1/join/inner/join_cross_product.test index 32ebc60dba1..598f1ca2d38 100644 --- a/modules/sql-engine/src/integrationTest/sql/group1/join/inner/join_cross_product.test +++ b/modules/sql-engine/src/integrationTest/sql/group1/join/inner/join_cross_product.test @@ -35,5 +35,8 @@ select * from t1 join t2 on (i=j), t3 join t4 on (k=l) order by 1, 2, 3, 4; 1 1 2 2 1 1 3 3 -statement error +query IIII rowsort select * from t1 join t2 on (i=j), t3 join t4 on (i+k=j+l) +---- +1 1 2 2 +1 1 3 3 diff --git a/modules/sql-engine/src/integrationTest/sql/group1/types/integer/integer_overflow.test b/modules/sql-engine/src/integrationTest/sql/group1/types/integer/integer_overflow.test index ccca1cc8fda..15d83cd05c4 100644 --- a/modules/sql-engine/src/integrationTest/sql/group1/types/integer/integer_overflow.test +++ b/modules/sql-engine/src/integrationTest/sql/group1/types/integer/integer_overflow.test @@ -63,7 +63,7 @@ statement error: BIGINT out of range SELECT -9223372036854775808/-1 statement error: BIGINT out of range -SELECT 9223372036854775808 +SELECT 9223372036854775808::BIGINT statement error: BIGINT out of range SELECT 9223372036854775807 + 1 diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImpl.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImpl.java index bb6a35ab123..68b53600271 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImpl.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImpl.java @@ -353,7 +353,7 @@ public Iterable values(List values, RelDataType rowType) { RelDataType dataType = literal.getType(); if (SqlTypeUtil.isNumeric(dataType)) { - BigDecimal value = (BigDecimal) literal.getValue(); + Number value = (Number) literal.getValue(); if (value == null) { return null; } @@ -1223,7 +1223,7 @@ public RexNode visitCorrelVariable(RexCorrelVariable variable) { } } - private static Object convertNumericLiteral(RelDataType dataType, BigDecimal value, Class type) { + private static Object convertNumericLiteral(RelDataType dataType, Number value, Class type) { Primitive primitive = Primitive.ofBoxOr(type); assert primitive != null || type == BigDecimal.class : "Neither primitive nor BigDecimal: " + type; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java index d3b0cddfa09..2a425f69a35 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java @@ -342,6 +342,30 @@ public static BigDecimal toBigDecimal(Number value, int precision, int scale) { } } + // LN, LOG, LOG10, LOG2 + + /** SQL {@code LOG(number, number2)} function applied to double values. */ + public static double log(double d0, double d1) { + return Math.log(d0) / Math.log(d1); + } + + /** SQL {@code LOG(number, number2)} function applied to + * double and BigDecimal values. */ + public static double log(double d0, BigDecimal d1) { + return Math.log(d0) / Math.log(d1.doubleValue()); + } + + /** SQL {@code LOG(number, number2)} function applied to + * BigDecimal and double values. */ + public static double log(BigDecimal d0, double d1) { + return Math.log(d0.doubleValue()) / Math.log(d1); + } + + /** SQL {@code LOG(number, number2)} function applied to double values. */ + public static double log(BigDecimal d0, BigDecimal d1) { + return Math.log(d0.doubleValue()) / Math.log(d1.doubleValue()); + } + private static BigDecimal processValueWithIntegralPart(Number value, int precision, int scale) { BigDecimal dec = convertToBigDecimal(value); diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java index d4525063e71..7e2d27b2389 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java @@ -19,6 +19,23 @@ //CHECKSTYLE:OFF +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.stream.Collectors; + import static java.util.Objects.requireNonNull; import static org.apache.calcite.adapter.enumerable.EnumUtils.generateCollatorExpression; import static org.apache.calcite.linq4j.tree.ExpressionType.Add; @@ -35,6 +52,7 @@ import static org.apache.calcite.linq4j.tree.ExpressionType.UnaryPlus; import static org.apache.calcite.sql.fun.SqlInternalOperators.LITERAL_AGG; import static org.apache.calcite.sql.fun.SqlInternalOperators.THROW_UNLESS; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.ACOSD; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ACOSH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ARRAY; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ARRAYS_OVERLAP; @@ -61,12 +79,18 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.ARRAY_SIZE; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ARRAY_TO_STRING; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ARRAY_UNION; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.ASIND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ASINH; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.ATAND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.ATANH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BITAND_AGG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BITOR_AGG; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.BIT_COUNT_BIG_QUERY; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.BIT_COUNT_MYSQL; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BIT_GET; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BIT_LENGTH; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.BOOLAND_AGG; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.BOOLOR_AGG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BOOL_AND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.BOOL_OR; import static org.apache.calcite.sql.fun.SqlLibraryOperators.CEIL_BIG_QUERY; @@ -80,7 +104,10 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_FUNCTION_WITH_NULL; import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_WS; import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_WS_MSSQL; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_WS_POSTGRESQL; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONCAT_WS_SPARK; import static org.apache.calcite.sql.fun.SqlLibraryOperators.CONTAINS_SUBSTR; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.COSD; import static org.apache.calcite.sql.fun.SqlLibraryOperators.COSH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.COTH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.CSC; @@ -128,9 +155,12 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.LEFT; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LEVENSHTEIN; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOG; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOG1P; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOG2; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOGICAL_AND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOGICAL_OR; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOG_MYSQL; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.LOG_POSTGRES; import static org.apache.calcite.sql.fun.SqlLibraryOperators.LPAD; import static org.apache.calcite.sql.fun.SqlLibraryOperators.MAP; import static org.apache.calcite.sql.fun.SqlLibraryOperators.MAP_CONCAT; @@ -152,6 +182,7 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.PARSE_TIMESTAMP; import static org.apache.calcite.sql.fun.SqlLibraryOperators.PARSE_URL; import static org.apache.calcite.sql.fun.SqlLibraryOperators.POW; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.POWER_PG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.RANDOM; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_CONTAINS; @@ -159,9 +190,18 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_EXTRACT_ALL; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_INSTR; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_LIKE; -import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_2; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_3; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_4; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_5; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_5_ORACLE; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_6; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_BIG_QUERY_3; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_PG_3; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REGEXP_REPLACE_PG_4; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REPEAT; import static org.apache.calcite.sql.fun.SqlLibraryOperators.REVERSE; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.REVERSE_SPARK; import static org.apache.calcite.sql.fun.SqlLibraryOperators.RIGHT; import static org.apache.calcite.sql.fun.SqlLibraryOperators.RLIKE; import static org.apache.calcite.sql.fun.SqlLibraryOperators.RPAD; @@ -178,6 +218,7 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.SHA1; import static org.apache.calcite.sql.fun.SqlLibraryOperators.SHA256; import static org.apache.calcite.sql.fun.SqlLibraryOperators.SHA512; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.SIND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.SINH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.SORT_ARRAY; import static org.apache.calcite.sql.fun.SqlLibraryOperators.SOUNDEX; @@ -187,6 +228,8 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.STARTS_WITH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.STRCMP; import static org.apache.calcite.sql.fun.SqlLibraryOperators.STR_TO_MAP; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.SUBSTRING_INDEX; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.TAND; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TANH; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TIME; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TIMESTAMP; @@ -198,11 +241,15 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_BASE32; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_BASE64; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_CHAR; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_CHAR_PG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_CODE_POINTS; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_DATE; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_DATE_PG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_HEX; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_TIMESTAMP; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.TO_TIMESTAMP_PG; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TRANSLATE3; +import static org.apache.calcite.sql.fun.SqlLibraryOperators.TRUNC_BIG_QUERY; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TRY_CAST; import static org.apache.calcite.sql.fun.SqlLibraryOperators.UNIX_DATE; import static org.apache.calcite.sql.fun.SqlLibraryOperators.UNIX_MICROS; @@ -213,6 +260,12 @@ import static org.apache.calcite.sql.fun.SqlLibraryOperators.XML_TRANSFORM; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ABS; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ACOS; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_EQ; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_GE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_GT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_LE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_LT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ALL_NE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.AND; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ANY_VALUE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ARG_MAX; @@ -222,6 +275,11 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ASIN; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ATAN; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ATAN2; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BITAND; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BITCOUNT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BITNOT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BITOR; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BITXOR; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BIT_AND; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BIT_OR; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.BIT_XOR; @@ -258,12 +316,14 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EVERY; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EXP; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EXTRACT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.FIRST_VALUE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.FLOOR; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.FUSION; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN_OR_EQUAL; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GROUPING; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GROUPING_ID; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.HOP; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.INITCAP; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.INTERSECTION; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_A_SET; @@ -295,7 +355,11 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.JSON_TYPE_OPERATOR; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.JSON_VALUE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.JSON_VALUE_EXPRESSION; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAG; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAST; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAST_DAY; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAST_VALUE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LEAD; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN_OR_EQUAL; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LIKE; @@ -326,6 +390,8 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_EQUALS; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_SUBMULTISET_OF; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NTH_VALUE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NTILE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OCTET_LENGTH; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OR; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OVERLAY; @@ -345,6 +411,7 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROUND; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROW; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROW_NUMBER; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SESSION; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SESSION_USER; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SIGN; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SIMILAR_TO; @@ -352,6 +419,12 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SINGLE_VALUE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SLICE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_EQ; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_GE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_GT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_LE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_LT; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME_NE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.STRUCT_ACCESS; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBMULTISET_OF; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBSTRING; @@ -364,6 +437,7 @@ import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TRANSLATE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TRIM; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TRUNCATE; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TUMBLE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UNARY_MINUS; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UNARY_PLUS; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UPPER; @@ -420,6 +494,7 @@ import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.linq4j.tree.ExpressionType; import org.apache.calcite.linq4j.tree.Expressions; +import org.apache.calcite.linq4j.tree.FunctionExpression; import org.apache.calcite.linq4j.tree.MemberExpression; import org.apache.calcite.linq4j.tree.MethodCallExpression; import org.apache.calcite.linq4j.tree.NewExpression; @@ -432,7 +507,9 @@ import org.apache.calcite.rex.RexCall; import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; +import org.apache.calcite.rex.RexWindowExclusion; import org.apache.calcite.runtime.FlatLists; +import org.apache.calcite.runtime.PairList; import org.apache.calcite.runtime.SqlFunctions; import org.apache.calcite.schema.FunctionContext; import org.apache.calcite.schema.ImplementableAggFunction; @@ -441,6 +518,8 @@ import org.apache.calcite.schema.impl.AggregateFunctionImpl; import org.apache.calcite.sql.SqlAggFunction; import org.apache.calcite.sql.SqlBinaryOperator; +import org.apache.calcite.sql.SqlFunction; +import org.apache.calcite.sql.SqlIntervalQualifier; import org.apache.calcite.sql.SqlJsonConstructorNullClause; import org.apache.calcite.sql.SqlJsonEmptyOrError; import org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior; @@ -452,6 +531,8 @@ import org.apache.calcite.sql.fun.SqlItemOperator; import org.apache.calcite.sql.fun.SqlJsonArrayAggAggFunction; import org.apache.calcite.sql.fun.SqlJsonObjectAggAggFunction; +import org.apache.calcite.sql.fun.SqlLibrary; +import org.apache.calcite.sql.fun.SqlQuantifyOperator; import org.apache.calcite.sql.fun.SqlStdOperatorTable; import org.apache.calcite.sql.fun.SqlTrimFunction; import org.apache.calcite.sql.type.SqlTypeName; @@ -461,6 +542,7 @@ import org.apache.calcite.sql.validate.SqlUserDefinedTableFunction; import org.apache.calcite.sql.validate.SqlUserDefinedTableMacro; import org.apache.calcite.util.BuiltInMethod; +import org.apache.calcite.util.Pair; import org.apache.calcite.util.Util; import org.apache.ignite.internal.sql.engine.sql.fun.IgniteSqlOperatorTable; import org.apache.ignite.internal.sql.engine.util.IgniteMethod; @@ -469,7 +551,7 @@ /** * Contains implementations of Rex operators as Java code. * Changes in comparison with original code: - * 1. Removed original ROUND, TRUNCATE, TRUNC_BIG_QUERY functions + * 1. Removed original ROUND, TRUNCATE, TRUNC_BIG_QUERY, LN, LOG, LOG10 functions * 2. populateIgnite() * 3. Removed support of all quantifiers (SOME_EQ, SOME_GT, SOME_LE, ...) * 4. Removed windows aggregate functions (FIRST_VALUE, LAST_VALUE, LEAD, LAG, NTILE, LAST) @@ -484,15 +566,23 @@ * Expressions.subtract -> IgniteExpressions.subtractExact * Expressions.add -> IgniteExpressions.addExact * Expressions.subtract -> IgniteExpressions.subtractExact - * 6. Consider Void.class return type as NULL_EXPR in genValueStatement(...) method + * 6. Custom LogImplementor * *

Immutable. */ @SuppressWarnings("PMD.UnnecessaryFullyQualifiedName") public class RexImpTable { /** The singleton instance. */ - public static final RexImpTable INSTANCE = - new RexImpTable(new Builder().populate()); + public static final RexImpTable INSTANCE; + + static { + final Builder builder = new Builder(); + builder.populate1(); + builder.populate2(); + builder.populate3(); + builder.populateIgnite(); + INSTANCE = new RexImpTable(builder); + } public static final ConstantExpression NULL_EXPR = Expressions.constant(null); @@ -509,7 +599,7 @@ public class RexImpTable { public static final MemberExpression BOXED_TRUE_EXPR = Expressions.field(null, Boolean.class, "TRUE"); - private final ImmutableMap map; + private final ImmutableMap> map; private final ImmutableMap> aggMap; private final ImmutableMap> winAggMap; private final ImmutableMap> matchMap; @@ -517,7 +607,10 @@ public class RexImpTable { tvfImplementorMap; private RexImpTable(Builder builder) { - this.map = ImmutableMap.copyOf(builder.map); + final ImmutableMap.Builder> + mapBuilder = ImmutableMap.builder(); + builder.map.forEach((k, v) -> mapBuilder.put(k, v.immutable())); + this.map = ImmutableMap.copyOf(mapBuilder.build()); this.aggMap = ImmutableMap.copyOf(builder.aggMap); this.winAggMap = ImmutableMap.copyOf(builder.winAggMap); this.matchMap = ImmutableMap.copyOf(builder.matchMap); @@ -525,20 +618,100 @@ private RexImpTable(Builder builder) { } /** Holds intermediate state from which a RexImpTable can be constructed. */ - private static class Builder { - private final Map map = new HashMap<>(); - private final Map> aggMap = - new HashMap<>(); - private final Map> winAggMap = - new HashMap<>(); - private final Map> matchMap = - new HashMap<>(); - private final Map> - tvfImplementorMap = new HashMap<>(); + @SuppressWarnings({"UnusedReturnValue", "SameParameterValue"}) + private abstract static class AbstractBuilder { + /** Maps an operator to an implementor. */ + abstract I define(SqlOperator operator, + I implementor); + + /** Maps an aggregate function to an implementor. */ + abstract void defineAgg(SqlAggFunction operator, + Supplier implementorSupplier); + + /** Maps a window function to an implementor. */ + abstract void defineWinAgg(SqlAggFunction operator, + Supplier implementorSupplier); + + /** Maps a match function to an implementor. */ + abstract void defineMatch(SqlMatchFunction operator, + Supplier implementorSupplier); + + /** Maps a table-valued function to an implementor. */ + abstract void defineTvf(SqlFunction operator, + Supplier implementorSupplier); + + /** Maps an operator to a method. */ + private MethodImplementor defineMethod(SqlOperator operator, Method method, + NullPolicy nullPolicy) { + return define(operator, + new MethodImplementor(method, nullPolicy, false)); + } + + /** Maps an operator to an implementor that calls one of a given list + * of methods. */ + private ReflectiveImplementor defineReflective(SqlOperator operator, + Method... methods) { + final ReflectiveImplementor implementor = + new ReflectiveImplementor(ImmutableList.copyOf(methods)); + return define(operator, implementor); + } + + /** Maps a unary operator to an implementor. */ + private UnaryImplementor defineUnary(SqlOperator operator, + ExpressionType expressionType, NullPolicy nullPolicy, + @Nullable String backupMethodName) { + return define(operator, + new UnaryImplementor(expressionType, nullPolicy, backupMethodName)); + } + + /** Maps a binary operator to an implementor. */ + private BinaryImplementor defineBinary(SqlOperator operator, + ExpressionType expressionType, NullPolicy nullPolicy, + String backupMethodName) { + return define(operator, + new BinaryImplementor(nullPolicy, true, expressionType, + backupMethodName)); + } + + /** Maps a quantify operator to a quantify implementor for a binary + * operator. */ +/* private QuantifyCollectionImplementor defineQuantify( + SqlQuantifyOperator operator, SqlBinaryOperator binaryOperator) { + final RexCallImplementor binaryImplementor = get(binaryOperator); + return define(operator, + new QuantifyCollectionImplementor(binaryOperator, binaryImplementor)); + }*/ + + /** Maps an operator to the same implementor as another operator. */ + private RexCallImplementor defineEquiv(SqlOperator operator, + SqlOperator previousOperator) { + return define(operator, get(previousOperator)); + } + + /** Maps an aggregate function to an implementor that calls a given class' + * constructor. */ + void defineAgg(SqlAggFunction operator, + Class klass) { + defineAgg(operator, constructorSupplier(klass)); + } + + /** Maps a window function to an implementor that calls a given class' + * constructor. */ + void defineWinAgg(SqlAggFunction operator, + Class klass) { + defineWinAgg(operator, constructorSupplier(klass)); + } + + /** Returns the implementor of an operator. */ + protected abstract RexCallImplementor get(SqlOperator operator); /** Populates this Builder with implementors for all Calcite built-in and - * library operators. */ - Builder populate() { + * library operators. + * + *

After this method, call {@link #populate2()}, {@link #populate3()}, + * etc. The method grew too large, so we had to split into multiple + * methods. Feel free to decompose further. */ + void populate1() { defineMethod(THROW_UNLESS, BuiltInMethod.THROW_UNLESS.method, NullPolicy.NONE); defineMethod(ROW, BuiltInMethod.ARRAY.method, NullPolicy.ALL); defineMethod(UPPER, BuiltInMethod.UPPER.method, NullPolicy.STRICT); @@ -577,7 +750,15 @@ Builder populate() { NullPolicy.STRICT); defineMethod(GETBIT, BuiltInMethod.BIT_GET.method, NullPolicy.STRICT); - map.put(CONCAT, new ConcatImplementor()); + defineMethod(BITAND, BuiltInMethod.BIT_AND.method, + NullPolicy.STRICT); + defineMethod(BITOR, BuiltInMethod.BIT_OR.method, + NullPolicy.STRICT); + defineMethod(BITXOR, BuiltInMethod.BIT_XOR.method, + NullPolicy.STRICT); + defineMethod(BITNOT, BuiltInMethod.BIT_NOT.method, + NullPolicy.STRICT); + define(CONCAT, new ConcatImplementor()); defineMethod(CONCAT_FUNCTION, BuiltInMethod.MULTI_STRING_CONCAT.method, NullPolicy.STRICT); defineMethod(CONCAT_FUNCTION_WITH_NULL, @@ -587,9 +768,15 @@ Builder populate() { defineMethod(CONCAT_WS, BuiltInMethod.MULTI_STRING_CONCAT_WITH_SEPARATOR.method, NullPolicy.ARG0); + defineMethod(CONCAT_WS_POSTGRESQL, + BuiltInMethod.MULTI_TYPE_OBJECT_CONCAT_WITH_SEPARATOR.method, + NullPolicy.ARG0); defineMethod(CONCAT_WS_MSSQL, BuiltInMethod.MULTI_STRING_CONCAT_WITH_SEPARATOR.method, NullPolicy.NONE); + defineMethod(CONCAT_WS_SPARK, + BuiltInMethod.MULTI_TYPE_STRING_ARRAY_CONCAT_WITH_SEPARATOR.method, + NullPolicy.ARG0); defineMethod(OVERLAY, BuiltInMethod.OVERLAY.method, NullPolicy.STRICT); defineMethod(POSITION, BuiltInMethod.POSITION.method, NullPolicy.STRICT); defineMethod(ASCII, BuiltInMethod.ASCII.method, NullPolicy.STRICT); @@ -608,6 +795,8 @@ Builder populate() { defineMethod(SOUNDEX_SPARK, BuiltInMethod.SOUNDEX_SPARK.method, NullPolicy.STRICT); defineMethod(DIFFERENCE, BuiltInMethod.DIFFERENCE.method, NullPolicy.STRICT); defineMethod(REVERSE, BuiltInMethod.REVERSE.method, NullPolicy.STRICT); + defineReflective(REVERSE_SPARK, BuiltInMethod.REVERSE.method, + BuiltInMethod.ARRAY_REVERSE.method); defineMethod(LEVENSHTEIN, BuiltInMethod.LEVENSHTEIN.method, NullPolicy.STRICT); defineMethod(SPLIT, BuiltInMethod.SPLIT.method, NullPolicy.STRICT); defineReflective(PARSE_URL, BuiltInMethod.PARSE_URL2.method, @@ -623,14 +812,14 @@ Builder populate() { BuiltInMethod.REGEXP_INSTR5.method); defineMethod(FIND_IN_SET, BuiltInMethod.FIND_IN_SET.method, NullPolicy.ANY); - map.put(TRIM, new TrimImplementor()); + define(TRIM, new TrimImplementor()); - map.put(CONTAINS_SUBSTR, new ContainsSubstrImplementor()); + define(CONTAINS_SUBSTR, new ContainsSubstrImplementor()); // logical - map.put(AND, new LogicalAndImplementor()); - map.put(OR, new LogicalOrImplementor()); - map.put(NOT, new LogicalNotImplementor()); + define(AND, new LogicalAndImplementor()); + define(OR, new LogicalOrImplementor()); + define(NOT, new LogicalNotImplementor()); // comparisons defineBinary(LESS_THAN, LessThan, NullPolicy.STRICT, "lt"); @@ -654,12 +843,16 @@ Builder populate() { defineMethod(MOD, BuiltInMethod.MOD.method, NullPolicy.STRICT); defineMethod(EXP, BuiltInMethod.EXP.method, NullPolicy.STRICT); defineMethod(POWER, BuiltInMethod.POWER.method, NullPolicy.STRICT); + defineMethod(POWER_PG, BuiltInMethod.POWER_PG.method, NullPolicy.STRICT); defineMethod(ABS, BuiltInMethod.ABS.method, NullPolicy.STRICT); - defineMethod(LOG2, BuiltInMethod.LOG2.method, NullPolicy.STRICT); - map.put(LN, new LogImplementor()); - map.put(LOG, new LogImplementor()); - map.put(LOG10, new LogImplementor()); + //define(LN, new LogImplementor(SqlLibrary.BIG_QUERY)); + //define(LOG, new LogImplementor(SqlLibrary.BIG_QUERY)); + //define(LOG10, new LogImplementor(SqlLibrary.BIG_QUERY)); + + define(LOG_POSTGRES, new LogImplementor()); + define(LOG_MYSQL, new LogImplementor()); + define(LOG2, new LogImplementor()); defineReflective(RAND, BuiltInMethod.RAND.method, BuiltInMethod.RAND_SEED.method); @@ -668,14 +861,18 @@ Builder populate() { defineReflective(RANDOM, BuiltInMethod.RAND.method); defineMethod(ACOS, BuiltInMethod.ACOS.method, NullPolicy.STRICT); + defineMethod(ACOSD, BuiltInMethod.ACOSD.method, NullPolicy.STRICT); defineMethod(ACOSH, BuiltInMethod.ACOSH.method, NullPolicy.STRICT); defineMethod(ASIN, BuiltInMethod.ASIN.method, NullPolicy.STRICT); + defineMethod(ASIND, BuiltInMethod.ASIND.method, NullPolicy.STRICT); defineMethod(ASINH, BuiltInMethod.ASINH.method, NullPolicy.STRICT); defineMethod(ATAN, BuiltInMethod.ATAN.method, NullPolicy.STRICT); defineMethod(ATAN2, BuiltInMethod.ATAN2.method, NullPolicy.STRICT); + defineMethod(ATAND, BuiltInMethod.ATAND.method, NullPolicy.STRICT); defineMethod(ATANH, BuiltInMethod.ATANH.method, NullPolicy.STRICT); defineMethod(CBRT, BuiltInMethod.CBRT.method, NullPolicy.STRICT); defineMethod(COS, BuiltInMethod.COS.method, NullPolicy.STRICT); + defineMethod(COSD, BuiltInMethod.COSD.method, NullPolicy.STRICT); defineMethod(COSH, BuiltInMethod.COSH.method, NullPolicy.STRICT); defineMethod(COT, BuiltInMethod.COT.method, NullPolicy.STRICT); defineMethod(COTH, BuiltInMethod.COTH.method, NullPolicy.STRICT); @@ -693,76 +890,81 @@ Builder populate() { defineMethod(SECH, BuiltInMethod.SECH.method, NullPolicy.STRICT); defineMethod(SIGN, BuiltInMethod.SIGN.method, NullPolicy.STRICT); defineMethod(SIN, BuiltInMethod.SIN.method, NullPolicy.STRICT); + defineMethod(SIND, BuiltInMethod.SIND.method, NullPolicy.STRICT); defineMethod(SINH, BuiltInMethod.SINH.method, NullPolicy.STRICT); defineMethod(TAN, BuiltInMethod.TAN.method, NullPolicy.STRICT); + defineMethod(TAND, BuiltInMethod.TAND.method, NullPolicy.STRICT); defineMethod(TANH, BuiltInMethod.TANH.method, NullPolicy.STRICT); - // Removed. - //defineMethod(TRUNC_BIG_QUERY, BuiltInMethod.STRUNCATE.method, NullPolicy.STRICT); + defineMethod(TRUNC_BIG_QUERY, BuiltInMethod.STRUNCATE.method, NullPolicy.STRICT); // Uses ignite version //defineMethod(TRUNCATE, BuiltInMethod.STRUNCATE.method, NullPolicy.STRICT); + defineMethod(LOG1P, BuiltInMethod.LOG1P.method, NullPolicy.STRICT); - map.put(SAFE_ADD, + define(SAFE_ADD, new SafeArithmeticImplementor(BuiltInMethod.SAFE_ADD.method)); - map.put(SAFE_DIVIDE, + define(SAFE_DIVIDE, new SafeArithmeticImplementor(BuiltInMethod.SAFE_DIVIDE.method)); - map.put(SAFE_MULTIPLY, + define(SAFE_MULTIPLY, new SafeArithmeticImplementor(BuiltInMethod.SAFE_MULTIPLY.method)); - map.put(SAFE_NEGATE, + define(SAFE_NEGATE, new SafeArithmeticImplementor(BuiltInMethod.SAFE_MULTIPLY.method)); - map.put(SAFE_SUBTRACT, + define(SAFE_SUBTRACT, new SafeArithmeticImplementor(BuiltInMethod.SAFE_SUBTRACT.method)); - map.put(PI, new PiImplementor()); - return populate2(); + define(PI, new PiImplementor()); } - /** Second step of population. The {@code populate} method grew too large, - * and we factored this out. Feel free to decompose further. */ - Builder populate2() { + /** Second step of population. */ + void populate2() { + // bitwise + defineMethod(BITCOUNT, BuiltInMethod.BITCOUNT.method, NullPolicy.STRICT); + defineMethod(BIT_COUNT_BIG_QUERY, BuiltInMethod.BITCOUNT.method, NullPolicy.STRICT); + defineMethod(BIT_COUNT_MYSQL, BuiltInMethod.BITCOUNT.method, NullPolicy.STRICT); + // datetime - map.put(DATETIME_PLUS, new DatetimeArithmeticImplementor()); - map.put(MINUS_DATE, new DatetimeArithmeticImplementor()); - map.put(EXTRACT, new ExtractImplementor()); - map.put(DATE_PART, new ExtractImplementor()); - map.put(FLOOR, + define(DATETIME_PLUS, new DatetimeArithmeticImplementor()); + define(MINUS_DATE, new DatetimeArithmeticImplementor()); + define(EXTRACT, new ExtractImplementor()); + define(DATE_PART, new ExtractImplementor()); + define(FLOOR, new FloorImplementor(BuiltInMethod.FLOOR.method, BuiltInMethod.UNIX_TIMESTAMP_FLOOR.method, - BuiltInMethod.UNIX_DATE_FLOOR.method, - BuiltInMethod.CUSTOM_TIMESTAMP_FLOOR.method, - BuiltInMethod.CUSTOM_DATE_FLOOR.method)); - map.put(CEIL, + BuiltInMethod.UNIX_DATE_FLOOR.method, + BuiltInMethod.CUSTOM_TIMESTAMP_FLOOR.method, + BuiltInMethod.CUSTOM_DATE_FLOOR.method)); + define(CEIL, new FloorImplementor(BuiltInMethod.CEIL.method, BuiltInMethod.UNIX_TIMESTAMP_CEIL.method, - BuiltInMethod.UNIX_DATE_CEIL.method, - BuiltInMethod.CUSTOM_TIMESTAMP_CEIL.method, - BuiltInMethod.CUSTOM_DATE_CEIL.method)); - map.put(TIMESTAMP_ADD, + BuiltInMethod.UNIX_DATE_CEIL.method, + BuiltInMethod.CUSTOM_TIMESTAMP_CEIL.method, + BuiltInMethod.CUSTOM_DATE_CEIL.method)); + define(TIMESTAMP_ADD, new TimestampAddImplementor( BuiltInMethod.CUSTOM_TIMESTAMP_ADD.method, BuiltInMethod.CUSTOM_DATE_ADD.method)); - map.put(DATEADD, map.get(TIMESTAMP_ADD)); - map.put(TIMESTAMP_DIFF, + defineEquiv(DATEADD, TIMESTAMP_ADD); + define(TIMESTAMP_DIFF, new TimestampDiffImplementor( BuiltInMethod.CUSTOM_TIMESTAMP_DIFF.method, BuiltInMethod.CUSTOM_DATE_DIFF.method)); // TIMESTAMP_TRUNC and TIME_TRUNC methods are syntactic sugar for standard // datetime FLOOR. - map.put(DATE_TRUNC, map.get(FLOOR)); - map.put(TIMESTAMP_TRUNC, map.get(FLOOR)); - map.put(TIME_TRUNC, map.get(FLOOR)); - map.put(DATETIME_TRUNC, map.get(FLOOR)); + defineEquiv(DATE_TRUNC, FLOOR); + defineEquiv(TIMESTAMP_TRUNC, FLOOR); + defineEquiv(TIME_TRUNC, FLOOR); + defineEquiv(DATETIME_TRUNC, FLOOR); // BigQuery FLOOR and CEIL should use same implementation as standard - map.put(CEIL_BIG_QUERY, map.get(CEIL)); - map.put(FLOOR_BIG_QUERY, map.get(FLOOR)); + defineEquiv(CEIL_BIG_QUERY, CEIL); + defineEquiv(FLOOR_BIG_QUERY, FLOOR); - map.put(LAST_DAY, + define(LAST_DAY, new LastDayImplementor("lastDay", BuiltInMethod.LAST_DAY)); - map.put(DAYNAME, + define(DAYNAME, new PeriodNameImplementor("dayName", BuiltInMethod.DAYNAME_WITH_TIMESTAMP, BuiltInMethod.DAYNAME_WITH_DATE)); - map.put(MONTHNAME, + define(MONTHNAME, new PeriodNameImplementor("monthName", BuiltInMethod.MONTHNAME_WITH_TIMESTAMP, BuiltInMethod.MONTHNAME_WITH_DATE)); @@ -798,22 +1000,29 @@ Builder populate2() { // Datetime formatting methods defineReflective(TO_CHAR, BuiltInMethod.TO_CHAR.method); + //define(TO_CHAR_PG, new ToCharPgImplementor()); defineReflective(TO_DATE, BuiltInMethod.TO_DATE.method); +/* define(TO_DATE_PG, + new ToTimestampPgImplementor("toDate", + BuiltInMethod.TO_DATE_PG.method));*/ defineReflective(TO_TIMESTAMP, BuiltInMethod.TO_TIMESTAMP.method); +/* define(TO_TIMESTAMP_PG, + new ToTimestampPgImplementor("toTimestamp", + BuiltInMethod.TO_TIMESTAMP_PG.method));*/ final FormatDatetimeImplementor datetimeFormatImpl = new FormatDatetimeImplementor(); - map.put(FORMAT_DATE, datetimeFormatImpl); - map.put(FORMAT_DATETIME, datetimeFormatImpl); - map.put(FORMAT_TIME, datetimeFormatImpl); - map.put(FORMAT_TIMESTAMP, datetimeFormatImpl); + define(FORMAT_DATE, datetimeFormatImpl); + define(FORMAT_DATETIME, datetimeFormatImpl); + define(FORMAT_TIME, datetimeFormatImpl); + define(FORMAT_TIMESTAMP, datetimeFormatImpl); // Boolean operators - map.put(IS_NULL, new IsNullImplementor()); - map.put(IS_NOT_NULL, new IsNotNullImplementor()); - map.put(IS_TRUE, new IsTrueImplementor()); - map.put(IS_NOT_TRUE, new IsNotTrueImplementor()); - map.put(IS_FALSE, new IsFalseImplementor()); - map.put(IS_NOT_FALSE, new IsNotFalseImplementor()); + define(IS_NULL, new IsNullImplementor()); + define(IS_NOT_NULL, new IsNotNullImplementor()); + define(IS_TRUE, new IsTrueImplementor()); + define(IS_NOT_TRUE, new IsNotTrueImplementor()); + define(IS_FALSE, new IsFalseImplementor()); + define(IS_NOT_FALSE, new IsNotFalseImplementor()); // LIKE, ILIKE, RLIKE and SIMILAR defineReflective(LIKE, BuiltInMethod.LIKE.method, @@ -831,12 +1040,20 @@ Builder populate2() { ReflectiveImplementor sensitiveImplementor = defineReflective(POSIX_REGEX_CASE_SENSITIVE, BuiltInMethod.POSIX_REGEX_SENSITIVE.method); - map.put(NEGATED_POSIX_REGEX_CASE_INSENSITIVE, + define(NEGATED_POSIX_REGEX_CASE_INSENSITIVE, NotImplementor.of(insensitiveImplementor)); - map.put(NEGATED_POSIX_REGEX_CASE_SENSITIVE, + define(NEGATED_POSIX_REGEX_CASE_SENSITIVE, NotImplementor.of(sensitiveImplementor)); - map.put(REGEXP_REPLACE, new RegexpReplaceImplementor()); - + defineReflective(REGEXP_REPLACE_2, BuiltInMethod.REGEXP_REPLACE2.method); + defineReflective(REGEXP_REPLACE_3, BuiltInMethod.REGEXP_REPLACE3.method); + defineReflective(REGEXP_REPLACE_4, BuiltInMethod.REGEXP_REPLACE4.method); + defineReflective(REGEXP_REPLACE_5, BuiltInMethod.REGEXP_REPLACE5_OCCURRENCE.method, + BuiltInMethod.REGEXP_REPLACE5_MATCHTYPE.method); + defineReflective(REGEXP_REPLACE_5_ORACLE, BuiltInMethod.REGEXP_REPLACE5_OCCURRENCE.method); + defineReflective(REGEXP_REPLACE_6, BuiltInMethod.REGEXP_REPLACE6.method); + defineReflective(REGEXP_REPLACE_BIG_QUERY_3, BuiltInMethod.REGEXP_REPLACE_BIG_QUERY_3.method); + defineReflective(REGEXP_REPLACE_PG_3, BuiltInMethod.REGEXP_REPLACE_PG_3.method); + defineReflective(REGEXP_REPLACE_PG_4, BuiltInMethod.REGEXP_REPLACE_PG_4.method); // Multisets & arrays defineMethod(CARDINALITY, BuiltInMethod.COLLECTION_SIZE.method, @@ -876,19 +1093,20 @@ Builder populate2() { defineMethod(MAP_VALUES, BuiltInMethod.MAP_VALUES.method, NullPolicy.STRICT); defineMethod(MAP_FROM_ARRAYS, BuiltInMethod.MAP_FROM_ARRAYS.method, NullPolicy.ANY); defineMethod(MAP_FROM_ENTRIES, BuiltInMethod.MAP_FROM_ENTRIES.method, NullPolicy.STRICT); - map.put(STR_TO_MAP, new StringToMapImplementor()); - map.put(ARRAY_CONCAT, new ArrayConcatImplementor()); - map.put(SORT_ARRAY, new SortArrayImplementor()); + define(STR_TO_MAP, new StringToMapImplementor()); + defineMethod(SUBSTRING_INDEX, BuiltInMethod.SUBSTRING_INDEX.method, NullPolicy.STRICT); + define(ARRAY_CONCAT, new ArrayConcatImplementor()); + define(SORT_ARRAY, new SortArrayImplementor()); final MethodImplementor isEmptyImplementor = new MethodImplementor(BuiltInMethod.IS_EMPTY.method, NullPolicy.NONE, false); - map.put(IS_EMPTY, isEmptyImplementor); - map.put(IS_NOT_EMPTY, NotImplementor.of(isEmptyImplementor)); + define(IS_EMPTY, isEmptyImplementor); + define(IS_NOT_EMPTY, NotImplementor.of(isEmptyImplementor)); final MethodImplementor isASetImplementor = new MethodImplementor(BuiltInMethod.IS_A_SET.method, NullPolicy.NONE, false); - map.put(IS_A_SET, isASetImplementor); - map.put(IS_NOT_A_SET, NotImplementor.of(isASetImplementor)); + define(IS_A_SET, isASetImplementor); + define(IS_NOT_A_SET, NotImplementor.of(isASetImplementor)); defineMethod(MULTISET_INTERSECT_DISTINCT, BuiltInMethod.MULTISET_INTERSECT_DISTINCT.method, NullPolicy.NONE); defineMethod(MULTISET_INTERSECT, @@ -901,34 +1119,34 @@ Builder populate2() { defineMethod(MULTISET_UNION, BuiltInMethod.MULTISET_UNION_ALL.method, NullPolicy.NONE); final MethodImplementor subMultisetImplementor = new MethodImplementor(BuiltInMethod.SUBMULTISET_OF.method, NullPolicy.NONE, false); - map.put(SUBMULTISET_OF, subMultisetImplementor); - map.put(NOT_SUBMULTISET_OF, NotImplementor.of(subMultisetImplementor)); + define(SUBMULTISET_OF, subMultisetImplementor); + define(NOT_SUBMULTISET_OF, NotImplementor.of(subMultisetImplementor)); - map.put(COALESCE, new CoalesceImplementor()); - map.put(CAST, new CastImplementor()); - map.put(SAFE_CAST, new CastImplementor()); - map.put(TRY_CAST, new CastImplementor()); + define(COALESCE, new CoalesceImplementor()); + define(CAST, new CastImplementor()); + define(SAFE_CAST, new CastImplementor()); + define(TRY_CAST, new CastImplementor()); - map.put(REINTERPRET, new ReinterpretImplementor()); - map.put(CONVERT, new ConvertImplementor()); - map.put(TRANSLATE, new TranslateImplementor()); + define(REINTERPRET, new ReinterpretImplementor()); + define(CONVERT, new ConvertImplementor()); + define(TRANSLATE, new TranslateImplementor()); final RexCallImplementor value = new ValueConstructorImplementor(); - map.put(MAP_VALUE_CONSTRUCTOR, value); - map.put(ARRAY_VALUE_CONSTRUCTOR, value); + define(MAP_VALUE_CONSTRUCTOR, value); + define(ARRAY_VALUE_CONSTRUCTOR, value); defineMethod(ARRAY, BuiltInMethod.ARRAYS_AS_LIST.method, NullPolicy.NONE); defineMethod(MAP, BuiltInMethod.MAP.method, NullPolicy.NONE); // ITEM operator - map.put(ITEM, new ItemImplementor()); + define(ITEM, new ItemImplementor()); // BigQuery array subscript operators final ArrayItemImplementor arrayItemImplementor = new ArrayItemImplementor(); - map.put(OFFSET, arrayItemImplementor); - map.put(ORDINAL, arrayItemImplementor); - map.put(SAFE_OFFSET, arrayItemImplementor); - map.put(SAFE_ORDINAL, arrayItemImplementor); + define(OFFSET, arrayItemImplementor); + define(ORDINAL, arrayItemImplementor); + define(SAFE_OFFSET, arrayItemImplementor); + define(SAFE_ORDINAL, arrayItemImplementor); - map.put(DEFAULT, new DefaultImplementor()); + define(DEFAULT, new DefaultImplementor()); // Sequences defineMethod(CURRENT_VALUE, BuiltInMethod.SEQUENCE_CURRENT_VALUE.method, @@ -956,9 +1174,9 @@ Builder populate2() { BuiltInMethod.JSON_VALUE_EXPRESSION.method, NullPolicy.STRICT); defineReflective(JSON_EXISTS, BuiltInMethod.JSON_EXISTS2.method, BuiltInMethod.JSON_EXISTS3.method); - map.put(JSON_VALUE, + define(JSON_VALUE, new JsonValueImplementor(BuiltInMethod.JSON_VALUE.method)); - defineReflective(JSON_QUERY, BuiltInMethod.JSON_QUERY.method); + define(JSON_QUERY, new JsonQueryImplementor(BuiltInMethod.JSON_QUERY.method)); defineMethod(JSON_TYPE, BuiltInMethod.JSON_TYPE.method, NullPolicy.ARG0); defineMethod(JSON_DEPTH, BuiltInMethod.JSON_DEPTH.method, NullPolicy.ARG0); defineMethod(JSON_INSERT, BuiltInMethod.JSON_INSERT.method, NullPolicy.ARG0); @@ -971,62 +1189,60 @@ Builder populate2() { defineMethod(JSON_SET, BuiltInMethod.JSON_SET.method, NullPolicy.ARG0); defineMethod(JSON_OBJECT, BuiltInMethod.JSON_OBJECT.method, NullPolicy.NONE); defineMethod(JSON_ARRAY, BuiltInMethod.JSON_ARRAY.method, NullPolicy.NONE); - aggMap.put(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL), + defineAgg(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL), JsonObjectAggImplementor .supplierFor(BuiltInMethod.JSON_OBJECTAGG_ADD.method)); - aggMap.put(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL), + defineAgg(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL), JsonObjectAggImplementor .supplierFor(BuiltInMethod.JSON_OBJECTAGG_ADD.method)); - aggMap.put(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL), + defineAgg(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL), JsonArrayAggImplementor .supplierFor(BuiltInMethod.JSON_ARRAYAGG_ADD.method)); - aggMap.put(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL), + defineAgg(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL), JsonArrayAggImplementor .supplierFor(BuiltInMethod.JSON_ARRAYAGG_ADD.method)); - map.put(IS_JSON_VALUE, + define(IS_JSON_VALUE, new MethodImplementor(BuiltInMethod.IS_JSON_VALUE.method, NullPolicy.NONE, false)); - map.put(IS_JSON_OBJECT, + define(IS_JSON_OBJECT, new MethodImplementor(BuiltInMethod.IS_JSON_OBJECT.method, NullPolicy.NONE, false)); - map.put(IS_JSON_ARRAY, + define(IS_JSON_ARRAY, new MethodImplementor(BuiltInMethod.IS_JSON_ARRAY.method, NullPolicy.NONE, false)); - map.put(IS_JSON_SCALAR, + define(IS_JSON_SCALAR, new MethodImplementor(BuiltInMethod.IS_JSON_SCALAR.method, NullPolicy.NONE, false)); - map.put(IS_NOT_JSON_VALUE, - NotImplementor.of( + define(IS_NOT_JSON_VALUE, + NotJsonImplementor.of( new MethodImplementor(BuiltInMethod.IS_JSON_VALUE.method, NullPolicy.NONE, false))); - map.put(IS_NOT_JSON_OBJECT, - NotImplementor.of( + define(IS_NOT_JSON_OBJECT, + NotJsonImplementor.of( new MethodImplementor(BuiltInMethod.IS_JSON_OBJECT.method, NullPolicy.NONE, false))); - map.put(IS_NOT_JSON_ARRAY, - NotImplementor.of( + define(IS_NOT_JSON_ARRAY, + NotJsonImplementor.of( new MethodImplementor(BuiltInMethod.IS_JSON_ARRAY.method, NullPolicy.NONE, false))); - map.put(IS_NOT_JSON_SCALAR, - NotImplementor.of( + define(IS_NOT_JSON_SCALAR, + NotJsonImplementor.of( new MethodImplementor(BuiltInMethod.IS_JSON_SCALAR.method, NullPolicy.NONE, false))); - - return populate3(); } /** Third step of population. */ - Builder populate3() { + void populate3() { // System functions final SystemFunctionImplementor systemFunctionImplementor = new SystemFunctionImplementor(); - map.put(USER, systemFunctionImplementor); - map.put(CURRENT_USER, systemFunctionImplementor); - map.put(SESSION_USER, systemFunctionImplementor); - map.put(SYSTEM_USER, systemFunctionImplementor); - map.put(CURRENT_PATH, systemFunctionImplementor); - map.put(CURRENT_ROLE, systemFunctionImplementor); - map.put(CURRENT_CATALOG, systemFunctionImplementor); + define(USER, systemFunctionImplementor); + define(CURRENT_USER, systemFunctionImplementor); + define(SESSION_USER, systemFunctionImplementor); + define(SYSTEM_USER, systemFunctionImplementor); + define(CURRENT_PATH, systemFunctionImplementor); + define(CURRENT_ROLE, systemFunctionImplementor); + define(CURRENT_CATALOG, systemFunctionImplementor); /* defineQuantify(SOME_EQ, EQUALS); defineQuantify(SOME_GT, GREATER_THAN); @@ -1042,82 +1258,74 @@ Builder populate3() { defineQuantify(ALL_NE, NOT_EQUALS);*/ // Current time functions - map.put(CURRENT_TIME, systemFunctionImplementor); - map.put(CURRENT_TIMESTAMP, systemFunctionImplementor); - map.put(CURRENT_DATE, systemFunctionImplementor); - map.put(CURRENT_DATETIME, systemFunctionImplementor); - map.put(LOCALTIME, systemFunctionImplementor); - map.put(LOCALTIMESTAMP, systemFunctionImplementor); - - aggMap.put(COUNT, constructorSupplier(CountImplementor.class)); - aggMap.put(REGR_COUNT, constructorSupplier(CountImplementor.class)); - aggMap.put(SUM0, constructorSupplier(SumImplementor.class)); - aggMap.put(SUM, constructorSupplier(SumImplementor.class)); - Supplier minMax = - constructorSupplier(MinMaxImplementor.class); - aggMap.put(MIN, minMax); - aggMap.put(MAX, minMax); - aggMap.put(ARG_MIN, constructorSupplier(ArgMinMaxImplementor.class)); - aggMap.put(ARG_MAX, constructorSupplier(ArgMinMaxImplementor.class)); - aggMap.put(MIN_BY, constructorSupplier(ArgMinMaxImplementor.class)); - aggMap.put(MAX_BY, constructorSupplier(ArgMinMaxImplementor.class)); - aggMap.put(ANY_VALUE, minMax); - aggMap.put(SOME, minMax); - aggMap.put(EVERY, minMax); - aggMap.put(BOOL_AND, minMax); - aggMap.put(BOOL_OR, minMax); - aggMap.put(LOGICAL_AND, minMax); - aggMap.put(LOGICAL_OR, minMax); - final Supplier bitop = - constructorSupplier(BitOpImplementor.class); - aggMap.put(BITAND_AGG, bitop); - aggMap.put(BITOR_AGG, bitop); - aggMap.put(BIT_AND, bitop); - aggMap.put(BIT_OR, bitop); - aggMap.put(BIT_XOR, bitop); - aggMap.put(SINGLE_VALUE, constructorSupplier(SingleValueImplementor.class)); - aggMap.put(COLLECT, constructorSupplier(CollectImplementor.class)); - aggMap.put(ARRAY_AGG, constructorSupplier(CollectImplementor.class)); - aggMap.put(LISTAGG, constructorSupplier(ListaggImplementor.class)); - aggMap.put(FUSION, constructorSupplier(FusionImplementor.class)); - aggMap.put(MODE, constructorSupplier(ModeImplementor.class)); - aggMap.put(ARRAY_CONCAT_AGG, constructorSupplier(FusionImplementor.class)); - aggMap.put(INTERSECTION, constructorSupplier(IntersectionImplementor.class)); - final Supplier grouping = - constructorSupplier(GroupingImplementor.class); - aggMap.put(GROUPING, grouping); - aggMap.put(GROUPING_ID, grouping); - aggMap.put(LITERAL_AGG, constructorSupplier(LiteralAggImplementor.class)); - winAggMap.put(RANK, constructorSupplier(RankImplementor.class)); - winAggMap.put(DENSE_RANK, constructorSupplier(DenseRankImplementor.class)); - winAggMap.put(ROW_NUMBER, constructorSupplier(RowNumberImplementor.class)); - /*winAggMap.put(FIRST_VALUE, - constructorSupplier(FirstValueImplementor.class));*/ - //winAggMap.put(NTH_VALUE, constructorSupplier(NthValueImplementor.class)); - //winAggMap.put(LAST_VALUE, constructorSupplier(LastValueImplementor.class)); - //winAggMap.put(LEAD, constructorSupplier(LeadImplementor.class)); - //winAggMap.put(LAG, constructorSupplier(LagImplementor.class)); - //winAggMap.put(NTILE, constructorSupplier(NtileImplementor.class)); - winAggMap.put(COUNT, constructorSupplier(CountWinImplementor.class)); - winAggMap.put(REGR_COUNT, constructorSupplier(CountWinImplementor.class)); + define(CURRENT_TIME, systemFunctionImplementor); + define(CURRENT_TIMESTAMP, systemFunctionImplementor); + define(CURRENT_DATE, systemFunctionImplementor); + define(CURRENT_DATETIME, systemFunctionImplementor); + define(LOCALTIME, systemFunctionImplementor); + define(LOCALTIMESTAMP, systemFunctionImplementor); + + defineAgg(COUNT, CountImplementor.class); + defineAgg(REGR_COUNT, CountImplementor.class); + defineAgg(SUM0, SumImplementor.class); + defineAgg(SUM, SumImplementor.class); + defineAgg(MIN, MinMaxImplementor.class); + defineAgg(MAX, MinMaxImplementor.class); + defineAgg(ARG_MIN, ArgMinMaxImplementor.class); + defineAgg(ARG_MAX, ArgMinMaxImplementor.class); + defineAgg(MIN_BY, ArgMinMaxImplementor.class); + defineAgg(MAX_BY, ArgMinMaxImplementor.class); + defineAgg(ANY_VALUE, MinMaxImplementor.class); + defineAgg(SOME, MinMaxImplementor.class); + defineAgg(EVERY, MinMaxImplementor.class); + defineAgg(BOOL_AND, MinMaxImplementor.class); + defineAgg(BOOL_OR, MinMaxImplementor.class); + defineAgg(BOOLAND_AGG, MinMaxImplementor.class); + defineAgg(BOOLOR_AGG, MinMaxImplementor.class); + defineAgg(LOGICAL_AND, MinMaxImplementor.class); + defineAgg(LOGICAL_OR, MinMaxImplementor.class); + defineAgg(BITAND_AGG, BitOpImplementor.class); + defineAgg(BITOR_AGG, BitOpImplementor.class); + defineAgg(BIT_AND, BitOpImplementor.class); + defineAgg(BIT_OR, BitOpImplementor.class); + defineAgg(BIT_XOR, BitOpImplementor.class); + defineAgg(SINGLE_VALUE, SingleValueImplementor.class); + defineAgg(COLLECT, CollectImplementor.class); + defineAgg(ARRAY_AGG, CollectImplementor.class); + defineAgg(LISTAGG, ListaggImplementor.class); + defineAgg(FUSION, FusionImplementor.class); + defineAgg(MODE, ModeImplementor.class); + defineAgg(ARRAY_CONCAT_AGG, FusionImplementor.class); + defineAgg(INTERSECTION, IntersectionImplementor.class); + defineAgg(GROUPING, GroupingImplementor.class); + defineAgg(GROUPING_ID, GroupingImplementor.class); + defineAgg(LITERAL_AGG, LiteralAggImplementor.class); +/* defineWinAgg(RANK, RankImplementor.class); + defineWinAgg(DENSE_RANK, DenseRankImplementor.class); + defineWinAgg(ROW_NUMBER, RowNumberImplementor.class); + defineWinAgg(FIRST_VALUE, FirstValueImplementor.class); + defineWinAgg(NTH_VALUE, NthValueImplementor.class); + defineWinAgg(LAST_VALUE, LastValueImplementor.class); + defineWinAgg(LEAD, LeadImplementor.class); + defineWinAgg(LAG, LagImplementor.class); + defineWinAgg(NTILE, NtileImplementor.class); + defineWinAgg(COUNT, CountWinImplementor.class); + defineWinAgg(REGR_COUNT, CountWinImplementor.class);*/ // Functions for MATCH_RECOGNIZE - matchMap.put(CLASSIFIER, ClassifierImplementor::new); - //matchMap.put(LAST, LastImplementor::new); - - //tvfImplementorMap.put(TUMBLE, TumbleImplementor::new); - //tvfImplementorMap.put(HOP, HopImplementor::new); - //tvfImplementorMap.put(SESSION, SessionImplementor::new); + defineMatch(CLASSIFIER, ClassifierImplementor::new); + //defineMatch(LAST, LastImplementor::new); - return populateIgnite(); + //defineTvf(TUMBLE, TumbleImplementor::new); + //defineTvf(HOP, HopImplementor::new); + //defineTvf(SESSION, SessionImplementor::new); } - Builder populateIgnite() { + void populateIgnite() { IgniteSystemFunctionImplementor systemFunctionImplementor = new IgniteSystemFunctionImplementor(); defineMethod(IgniteSqlOperatorTable.RAND_UUID, RAND_UUID.method(), NullPolicy.NONE); defineMethod(IgniteSqlOperatorTable.GREATEST2, GREATEST2.method(), NullPolicy.NONE); - defineMethod(IgniteSqlOperatorTable.RAND_UUID, RAND_UUID.method(), NullPolicy.NONE); defineMethod(IS_NOT_DISTINCT_FROM, IgniteMethod.IS_NOT_DISTINCT_FROM.method(), NullPolicy.NONE); defineMethod(IgniteSqlOperatorTable.LEAST2, LEAST2.method(), NullPolicy.NONE); defineMethod(IgniteSqlOperatorTable.LENGTH, LENGTH.method(), NullPolicy.STRICT); @@ -1127,8 +1335,11 @@ Builder populateIgnite() { defineMethod(TRUNCATE, IgniteMethod.TRUNCATE.method(), NullPolicy.STRICT); defineMethod(IgniteSqlOperatorTable.DECIMAL_DIVIDE, IgniteMethod.DECIMAL_DIVIDE.method(), NullPolicy.ARG0); - map.put(TYPEOF, systemFunctionImplementor); - return this; + define(LN, new LogImplementor()); + define(LOG, new LogImplementor()); + define(LOG10, new LogImplementor()); + + define(TYPEOF, systemFunctionImplementor); } private static class IgniteSystemFunctionImplementor @@ -1217,36 +1428,65 @@ private static Supplier constructorSupplier(Class klass) { } }; } + } - private void defineMethod(SqlOperator operator, Method method, - NullPolicy nullPolicy) { - map.put(operator, new MethodImplementor(method, nullPolicy, false)); + /** Holds intermediate state from which a RexImpTable can be constructed. */ + private static class Builder extends AbstractBuilder { + private final Map> map = + new HashMap<>(); + private final Map> aggMap = + new HashMap<>(); + private final Map> winAggMap = + new HashMap<>(); + private final Map> matchMap = + new HashMap<>(); + private final Map> + tvfImplementorMap = new HashMap<>(); + + @Override protected RexCallImplementor get(SqlOperator operator) { + final PairList implementors = + requireNonNull(map.get(operator)); + if (implementors.size() == 1) { + return implementors.get(0).getValue(); + } else { + for (Map.Entry entry : implementors) { + if (operator == entry.getKey()) { + return entry.getValue(); + } + } + throw new NullPointerException(); + } } - private ReflectiveImplementor defineReflective(SqlOperator operator, - Method... methods) { - final ReflectiveImplementor implementor = - new ReflectiveImplementor(ImmutableList.copyOf(methods)); - map.put(operator, implementor); + @Override T define(SqlOperator operator, + T implementor) { + if (map.containsKey(operator)) { + map.get(operator).add(operator, implementor); + } else { + map.put(operator, PairList.of(operator, implementor)); + } return implementor; } - private void defineUnary(SqlOperator operator, ExpressionType expressionType, - NullPolicy nullPolicy, @Nullable String backupMethodName) { - map.put(operator, new UnaryImplementor(expressionType, nullPolicy, backupMethodName)); + @Override void defineAgg(SqlAggFunction operator, + Supplier implementorSupplier) { + aggMap.put(operator, implementorSupplier); } - private void defineBinary(SqlOperator operator, ExpressionType expressionType, - NullPolicy nullPolicy, String backupMethodName) { - map.put(operator, - new BinaryImplementor(nullPolicy, true, expressionType, - backupMethodName)); + @Override protected void defineWinAgg(SqlAggFunction operator, + Supplier implementorSupplier) { + winAggMap.put(operator, implementorSupplier); } -/* private void defineQuantify(SqlQuantifyOperator operator, SqlBinaryOperator binaryOperator) { - final RexCallImplementor binaryImplementor = requireNonNull(map.get(binaryOperator)); - map.put(operator, new QuantifyCollectionImplementor(binaryOperator, binaryImplementor)); - }*/ + @Override protected void defineMatch(SqlMatchFunction operator, + Supplier implementorSupplier) { + matchMap.put(operator, implementorSupplier); + } + + @Override protected void defineTvf(SqlFunction operator, + Supplier implementorSupplier) { + tvfImplementorMap.put(operator, implementorSupplier); + } } public static CallImplementor createImplementor( @@ -1299,9 +1539,27 @@ private static RexCallImplementor wrapAsRexCallImplementor( ((ImplementableFunction) udf).getImplementor(); return wrapAsRexCallImplementor(implementor); } else if (operator instanceof SqlTypeConstructorFunction) { - return map.get(SqlStdOperatorTable.ROW); + final PairList implementors = + map.get(SqlStdOperatorTable.ROW); + if (implementors != null && implementors.size() == 1) { + return implementors.get(0).getValue(); + } + } else { + final PairList implementors = + map.get(operator); + if (implementors != null) { + if (implementors.size() == 1) { + return implementors.get(0).getValue(); + } else { + for (Map.Entry entry : implementors) { + if (operator == entry.getKey()) { + return entry.getValue(); + } + } + } + } } - return map.get(operator); + return null; } public @Nullable AggImplementor get(final SqlAggFunction aggregation, @@ -1533,7 +1791,7 @@ static class CountWinImplementor extends StrictWinAggImplementor { break; } } - if (!hasNullable) { + if (!hasNullable && info.getExclude() == RexWindowExclusion.EXCLUDE_NO_OTHER) { justFrameRowCount = true; return Collections.emptyList(); } @@ -2105,7 +2363,7 @@ static class RankImplementor extends StrictWinAggImplementor { WinAggAddContext add) { Expression acc = add.accumulator().get(0); // This is an example of the generated code - if (false) { // NOPMD + if (false) { new Object() { int curentPosition; // position in for-win-agg-loop int startIndex; // index of start of window @@ -2113,8 +2371,8 @@ static class RankImplementor extends StrictWinAggImplementor { @SuppressWarnings("nullness") void sample() { if (curentPosition > startIndex) { - if (rows[curentPosition - 1].compareTo(rows[curentPosition]) // NOPMD - > 0) { + if (rows[curentPosition - 1].compareTo(rows[curentPosition]) + > 0) { // update rank } } @@ -2202,25 +2460,25 @@ protected FirstLastValueImplementor(SeekType seekType) { .translate(winResult.rexArguments().get(0), info.returnType()), getDefaultValue(info.returnType())); } - }*/ + } - /** Implementor for the {@code FIRST_VALUE} windowed aggregate function. */ -/* static class FirstValueImplementor extends FirstLastValueImplementor { + *//** Implementor for the {@code FIRST_VALUE} windowed aggregate function. *//* + static class FirstValueImplementor extends FirstLastValueImplementor { protected FirstValueImplementor() { super(SeekType.START); } - }*/ + } - /** Implementor for the {@code LAST_VALUE} windowed aggregate function. */ -/* static class LastValueImplementor extends FirstLastValueImplementor { + *//** Implementor for the {@code LAST_VALUE} windowed aggregate function. *//* + static class LastValueImplementor extends FirstLastValueImplementor { protected LastValueImplementor() { super(SeekType.END); } - }*/ + } - /** Implementor for the {@code NTH_VALUE} - * windowed aggregate function. */ -/* static class NthValueImplementor implements WinAggImplementor { + *//** Implementor for the {@code NTH_VALUE} + * windowed aggregate function. *//* + static class NthValueImplementor implements WinAggImplementor { @Override public List getStateType(AggContext info) { return Collections.emptyList(); } @@ -2274,11 +2532,11 @@ protected LastValueImplementor() { Expressions.statement(Expressions.assign(res, defaultValue)))); return res; } - }*/ + } - /** Implementor for the {@code LEAD} and {@code LAG} windowed - * aggregate functions. */ -/* static class LeadLagImplementor implements WinAggImplementor { + *//** Implementor for the {@code LEAD} and {@code LAG} windowed + * aggregate functions. *//* + static class LeadLagImplementor implements WinAggImplementor { private final boolean isLead; protected LeadLagImplementor(boolean isLead) { @@ -2345,24 +2603,24 @@ protected LeadLagImplementor(boolean isLead) { Expressions.statement(Expressions.assign(res, defaultValue)))); return res; } - }*/ + } - /** Implementor for the {@code LEAD} windowed aggregate function. */ -/* public static class LeadImplementor extends LeadLagImplementor { + *//** Implementor for the {@code LEAD} windowed aggregate function. *//* + public static class LeadImplementor extends LeadLagImplementor { protected LeadImplementor() { super(true); } - }*/ + } - /** Implementor for the {@code LAG} windowed aggregate function. */ -/* public static class LagImplementor extends LeadLagImplementor { + *//** Implementor for the {@code LAG} windowed aggregate function. *//* + public static class LagImplementor extends LeadLagImplementor { protected LagImplementor() { super(false); } - }*/ + } - /** Implementor for the {@code NTILE} windowed aggregate function. */ -/* static class NtileImplementor implements WinAggImplementor { + *//** Implementor for the {@code NTILE} windowed aggregate function. *//* + static class NtileImplementor implements WinAggImplementor { @Override public List getStateType(AggContext info) { return Collections.emptyList(); } @@ -2570,37 +2828,6 @@ private static class ContainsSubstrImplementor extends AbstractRexCallImplemento } } - /** Implementor for the {@code REGEXP_REPLACE} function. */ - private static class RegexpReplaceImplementor extends AbstractRexCallImplementor { - RegexpReplaceImplementor() { - super("regexp_replace", NullPolicy.STRICT, false); - } - - @Override Expression implementSafe(final RexToLixTranslator translator, - final RexCall call, final List argValueList) { - // Boolean indicating if dialect uses default $-based indexing for - // regex capturing group (false means double-backslash-based indexing) - final boolean dollarIndexed = - translator.conformance.isRegexReplaceCaptureGroupDollarIndexed(); - - // Standard REGEXP_REPLACE implementation for default indexing. - if (dollarIndexed) { - final ReflectiveImplementor implementor = - new ReflectiveImplementor( - ImmutableList.of(BuiltInMethod.REGEXP_REPLACE3.method, - BuiltInMethod.REGEXP_REPLACE4.method, - BuiltInMethod.REGEXP_REPLACE5.method, - BuiltInMethod.REGEXP_REPLACE6.method)); - return implementor.implementSafe(translator, call, argValueList); - } - - // Custom regexp replace method to preprocess double-backslashes into $-based indices. - return Expressions.call(Expressions.new_(SqlFunctions.RegexFunction.class), - "regexpReplaceNonDollarIndexed", - argValueList); - } - } - /** Implementor for the {@code MONTHNAME} and {@code DAYNAME} functions. * Each takes a {@link java.util.Locale} argument. */ private static class PeriodNameImplementor extends AbstractRexCallImplementor { @@ -2998,7 +3225,35 @@ private static class JsonValueImplementor extends MethodImplementor { newOperands.add(errorBehavior); newOperands.add(defaultValueOnError); List argValueList0 = - ConverterUtils.fromInternal(method.getParameterTypes(), newOperands); + ConverterUtils.fromInternal(method.getParameterTypes(), newOperands); + final Expression target = + Expressions.new_(method.getDeclaringClass()); + return Expressions.call(target, method, argValueList0); + } + } + + /** + * Implementor for JSON_QUERY function. Passes the jsonize flag depending on the output type. + */ + private static class JsonQueryImplementor extends MethodImplementor { + JsonQueryImplementor(Method method) { + super(method, NullPolicy.ARG0, false); + } + + @Override Expression implementSafe(RexToLixTranslator translator, + RexCall call, List argValueList) { + final List newOperands = new ArrayList<>(argValueList); + + final Expression jsonize; + if (SqlTypeUtil.inCharFamily(call.getType())) { + jsonize = TRUE_EXPR; + } else { + jsonize = FALSE_EXPR; + } + newOperands.add(jsonize); + + List argValueList0 = + ConverterUtils.fromInternal(method.getParameterTypes(), newOperands); final Expression target = Expressions.new_(method.getDeclaringClass()); return Expressions.call(target, method, argValueList0); @@ -3189,8 +3444,18 @@ private static class ExtractImplementor extends AbstractRexCallImplementor { @Override Expression implementSafe(final RexToLixTranslator translator, final RexCall call, final List argValueList) { - final TimeUnitRange timeUnitRange = - (TimeUnitRange) translator.getLiteralValue(argValueList.get(0)); + // May need to convert the first argument from a String to a TimeUnitRange + final Object timeUnitRangeObj = translator.getLiteralValue(argValueList.get(0)); + final TimeUnitRange timeUnitRange; + if (timeUnitRangeObj instanceof String) { + timeUnitRange = + TimeUnitRange.of( + SqlIntervalQualifier.stringToDatePartTimeUnit((String) timeUnitRangeObj), + null); + } else { + timeUnitRange = (TimeUnitRange) timeUnitRangeObj; + } + final TimeUnit unit = requireNonNull(timeUnitRange, "timeUnitRange").startUnit; Expression operand = argValueList.get(1); boolean isIntervalType = SqlTypeUtil.isInterval(call.operands.get(1).getType()); @@ -3721,6 +3986,40 @@ static AbstractRexCallImplementor of(AbstractRexCallImplementor implementor) { } } + /** Implementor for the {@code NOT JSON} operator. */ + private static class NotJsonImplementor extends AbstractRexCallImplementor { + private final AbstractRexCallImplementor implementor; + + private NotJsonImplementor(AbstractRexCallImplementor implementor) { + super("not_json", implementor.nullPolicy, false); + this.implementor = implementor; + } + + static AbstractRexCallImplementor of(AbstractRexCallImplementor implementor) { + return new NotJsonImplementor(implementor); + } + + @Override Expression implementSafe(final RexToLixTranslator translator, + final RexCall call, final List argValueList) { + // E.g., "final Boolean resultValue = (callValue == null) ? null : !callValue" + final Expression expression = + implementor.implementSafe(translator, call, argValueList); + final ParameterExpression callValue = + Expressions.parameter(expression.getType()); + translator.getBlockBuilder().add( + Expressions.declare(Modifier.FINAL, callValue, expression)); + final Expression valueExpression = + Expressions.condition( + Expressions.equal(callValue, NULL_EXPR), + NULL_EXPR, + Expressions.not(callValue)); + final ParameterExpression resultValue = Expressions.parameter(expression.getType()); + translator.getBlockBuilder().add( + Expressions.declare(Modifier.FINAL, resultValue, valueExpression)); + return resultValue; + } + } + /** Implementor for various datetime arithmetic. */ private static class DatetimeArithmeticImplementor extends AbstractRexCallImplementor { @@ -3771,6 +4070,7 @@ private static class DatetimeArithmeticImplementor } break; case TIME: + trop1 = normalize(typeName, trop1); trop1 = Expressions.convert_(trop1, int.class); break; default: @@ -4278,7 +4578,7 @@ private static class LogImplementor extends AbstractRexCallImplementor { @Override Expression implementSafe(final RexToLixTranslator translator, final RexCall call, final List argValueList) { - return Expressions.call(BuiltInMethod.LOG.method, args(call, argValueList)); + return Expressions.call(IgniteMethod.LOG.method(), args(call, argValueList)); } private static List args(RexCall call, @@ -4371,7 +4671,7 @@ private static class ReflectiveImplementor extends AbstractRexCallImplementor { protected MethodCallExpression implementSafe(Method method, List argValueList) { List argValueList0 = - ConverterUtils.fromInternal(method.getParameterTypes(), + ConverterUtils.fromInternal(method.getParameterTypes(), argValueList); if (isStatic(method)) { return Expressions.call(method, argValueList0); @@ -4620,7 +4920,7 @@ private static class QuantifyCollectionImplementor extends AbstractRexCallImplem final ParameterExpression lambdaArg = Expressions.parameter(translator.typeFactory.getJavaClass(rightComponentType), "el"); final RexCall binaryImplementorRexCall = - (RexCall) translator.builder.makeCall(binaryOperator, leftRex, + (RexCall) translator.builder.makeCall(call.getParserPosition(), binaryOperator, leftRex, translator.builder.makeDynamicParam(rightComponentType, 0)); final List binaryImplementorArgs = ImmutableList.of( @@ -4678,6 +4978,43 @@ private static class SessionImplementor implements TableFunctionCallImplementor keyColIndexExpr, gapInterval)); } + } + + *//** Implementor for the {@code TO_CHAR} function for PostgreSQL. *//* + private static class ToCharPgImplementor extends AbstractRexCallImplementor { + ToCharPgImplementor() { + super("toChar", NullPolicy.STRICT, false); + } + + @Override Expression implementSafe(RexToLixTranslator translator, RexCall call, + List argValueList) { + final Expression target = + Expressions.new_(BuiltInMethod.TO_CHAR_PG.method.getDeclaringClass(), + new ParameterExpression(0, DataContext.class, "root")); + final Expression operand0 = argValueList.get(0); + final Expression operand1 = argValueList.get(1); + return Expressions.call(target, BuiltInMethod.TO_CHAR_PG.method, operand0, operand1); + } + } + + *//** Implementor for the {@code TO_DATE} or {@code TO_TIMESTAMP} functions for PostgreSQL. *//* + private static class ToTimestampPgImplementor extends AbstractRexCallImplementor { + private final Method method; + + ToTimestampPgImplementor(String name, Method method) { + super(name, NullPolicy.STRICT, false); + this.method = method; + } + + @Override Expression implementSafe(RexToLixTranslator translator, RexCall call, + List argValueList) { + final Expression target = + Expressions.new_(method.getDeclaringClass(), + new ParameterExpression(0, DataContext.class, "root")); + final Expression operand0 = argValueList.get(0); + final Expression operand1 = argValueList.get(1); + return Expressions.call(target, method, operand0, operand1); + } }*/ } //CHECKSTYLE:ON diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java index c31ce20f5df..1ed54e57eee 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java @@ -20,6 +20,7 @@ //CHECKSTYLE:OFF import org.apache.calcite.DataContext; +import org.apache.calcite.adapter.enumerable.EnumUtils; import org.apache.calcite.adapter.enumerable.PhysType; import org.apache.calcite.adapter.java.JavaTypeFactory; import org.apache.calcite.avatica.util.ByteString; @@ -60,14 +61,17 @@ import org.apache.calcite.schema.FunctionContext; import org.apache.calcite.sql.SqlIntervalQualifier; import org.apache.calcite.sql.SqlOperator; +import org.apache.calcite.sql.SqlWindowTableFunction; import org.apache.calcite.sql.fun.SqlStdOperatorTable; import org.apache.calcite.sql.parser.SqlParserPos; import org.apache.calcite.sql.type.SqlTypeFamily; +import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.sql.type.SqlTypeUtil; import org.apache.calcite.sql.validate.SqlConformance; import org.apache.calcite.util.BuiltInMethod; import org.apache.calcite.util.ControlFlowException; import org.apache.calcite.util.Pair; +import org.apache.calcite.util.Util; import com.google.common.base.CaseFormat; import com.google.common.collect.ImmutableList; @@ -84,16 +88,19 @@ import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.math.BigDecimal; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; +import static org.apache.calcite.linq4j.tree.Expressions.constant; import static org.apache.calcite.sql.fun.SqlLibraryOperators.TRANSLATE3; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CASE; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHAR_LENGTH; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OCTET_LENGTH; +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.PREV; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SEARCH; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBSTRING; import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UPPER; @@ -294,22 +301,29 @@ Expression translate(RexNode expr, RexImpTable.NullAs nullAs, /** * Used for safe operators that return null if an exception is thrown. */ - private static Expression expressionHandlingSafe(Expression body, boolean safe) { - return safe ? safeExpression(body) : body; + private Expression expressionHandlingSafe( + Expression body, boolean safe, RelDataType targetType) { + return safe ? safeExpression(body, targetType) : body; } - private static Expression safeExpression(Expression body) { + private Expression safeExpression(Expression body, RelDataType targetType) { final ParameterExpression e_ = Expressions.parameter(Exception.class, new BlockBuilder().newName("e")); - return Expressions.call( - Expressions.lambda( - Expressions.block( - Expressions.tryCatch( - Expressions.return_(null, body), - Expressions.catch_(e_, - Expressions.return_(null, Expressions.constant(null)))))), - BuiltInMethod.FUNCTION0_APPLY.method); + // The type received for the targetType is never nullable. + // But safe casts may return null + RelDataType nullableTargetType = typeFactory.createTypeWithNullability(targetType, true); + Expression result = + Expressions.call( + Expressions.lambda( + Expressions.block( + Expressions.tryCatch( + Expressions.return_(null, body), + Expressions.catch_(e_, + Expressions.return_(null, constant(null)))))), + BuiltInMethod.FUNCTION0_APPLY.method); + // FUNCTION0 always returns Object, so we need a cast to the target type + return ConverterUtils.convert(result, nullableTargetType); } Expression translateCast( @@ -320,7 +334,7 @@ Expression translateCast( ConstantExpression format) { Expression convert = getConvertExpression(sourceType, targetType, operand, format); Expression convert2 = checkExpressionPadTruncate(convert, sourceType, targetType, operand); - Expression convert3 = expressionHandlingSafe(convert2, safe); + Expression convert3 = expressionHandlingSafe(convert2, safe, targetType); return scaleValue(sourceType, targetType, convert3); } @@ -471,9 +485,9 @@ private Expression getConvertExpression( operand)); case BINARY: case VARBINARY: - return RexImpTable.optimize2( - operand, - Expressions.call(IgniteMethod.BYTESTRING_TO_STRING.method(), operand)); + return RexImpTable.optimize2( + operand, + Expressions.call(IgniteMethod.BYTESTRING_TO_STRING.method(), operand)); default: return defaultExpression.get(); @@ -910,18 +924,10 @@ public static Expression translateLiteral( return Expressions.constant(bd, javaClass); } assert javaClass == BigDecimal.class; - return Expressions.call( - IgniteSqlFunctions.class, - "toBigDecimal", - /* - The ConstantExpression class, when converting from BigDecimal to Bigdecimal, - removes trailing zeros from the original object, regardless of the original scale value. - Therefore, BigDecimal must be converted to a string to avoid this. - */ - Expressions.constant(bd.toString()), - Expressions.constant(type.getPrecision()), - Expressions.constant(type.getScale()) - ); + return Expressions.new_(BigDecimal.class, + Expressions.constant( + requireNonNull(bd, + () -> "value for " + literal).toString())); case TIMESTAMP_WITH_LOCAL_TIME_ZONE: Object val = literal.getValueAs(Long.class); @@ -1123,7 +1129,9 @@ public Expression getRoot() { /** If an expression is a {@code NUMERIC} derived from an {@code INTERVAL}, * scales it appropriately; returns the operand unchanged if the conversion - * is not from {@code INTERVAL} to {@code NUMERIC}. */ + * is not from {@code INTERVAL} to {@code NUMERIC}. + * Does not scale values of type DECIMAL, these are expected + * to be already scaled. */ private static Expression scaleValue( RelDataType sourceType, RelDataType targetType, @@ -1131,6 +1139,9 @@ private static Expression scaleValue( final SqlTypeFamily targetFamily = targetType.getSqlTypeName().getFamily(); final SqlTypeFamily sourceFamily = sourceType.getSqlTypeName().getFamily(); if (targetFamily == SqlTypeFamily.NUMERIC + // multiplyDivide cannot handle DECIMALs, but for DECIMAL + // destination types the result is already scaled. + && targetType.getSqlTypeName() != SqlTypeName.DECIMAL && (sourceFamily == SqlTypeFamily.INTERVAL_YEAR_MONTH || sourceFamily == SqlTypeFamily.INTERVAL_DAY_TIME)) { // Scale to the given field. @@ -1508,12 +1519,32 @@ private Result toInnerStorageType(Result result, Type storageType) { if (rexWithStorageTypeResultMap.containsKey(key)) { return rexWithStorageTypeResultMap.get(key); } + // Calcite implementation is not applicable + // SELECT CAST(? AS DECIMAL(1, 2)) with dyn param: new BigDecimal("0.12"), need to fail +/* final Type storageType = currentStorageType != null + ? currentStorageType : typeFactory.getJavaClass(dynamicParam.getType()); + + final boolean isNumeric = SqlTypeFamily.NUMERIC.contains(dynamicParam.getType()); + + // For numeric types, use java.lang.Number to prevent cast exception + // when the parameter type differs from the target type + + final Expression valueExpression = isNumeric + ? EnumUtils.convert( + EnumUtils.convert( + Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, + Expressions.constant("?" + dynamicParam.getIndex())), + java.lang.Number.class), + storageType) + : EnumUtils.convert( + Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, + Expressions.constant("?" + dynamicParam.getIndex())), + storageType);*/ final Type paramType = ((IgniteTypeFactory) typeFactory).getResultClass(dynamicParam.getType()); - final Expression ctxGet = Expressions.call(root, IgniteMethod.CONTEXT_GET_PARAMETER_VALUE.method(), - Expressions.constant("?" + dynamicParam.getIndex()), Expressions.constant(paramType)); - + Expressions.constant("?" + dynamicParam.getIndex()), Expressions.constant(paramType)); final Expression valueExpression = ConverterUtils.convert(ctxGet, dynamicParam.getType()); + final ParameterExpression valueVariable = Expressions.parameter(valueExpression.getType(), list.newName("value_dynamic_param")); diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/externalize/RelJson.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/externalize/RelJson.java index f2e414ec591..d4bc44a203e 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/externalize/RelJson.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/externalize/RelJson.java @@ -40,6 +40,7 @@ import java.util.Map; import java.util.Set; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; import org.apache.calcite.avatica.AvaticaUtils; import org.apache.calcite.avatica.util.ByteString; @@ -590,6 +591,10 @@ private Object toJson(SqlOperator operator) { map.put("name", operator.getName()); map.put("kind", toJson(operator.kind)); map.put("syntax", toJson(operator.getSyntax())); + + if (operator.getOperandTypeChecker() != null && operator.getAllowedSignatures() != null) { + map.put("signature", toJson(operator.getAllowedSignatures())); + } return map; } @@ -876,6 +881,12 @@ RexNode toRex(RelInput relInput, Object o) { literal = new BigDecimal(((Number) literal).longValue()); } + // Stub, it need to be fixed https://issues.apache.org/jira/browse/IGNITE-23873 + if (type.getSqlTypeName() == SqlTypeName.DOUBLE && literal instanceof String + && Double.isNaN(Double.parseDouble(literal.toString()))) { + literal = Double.NaN; + } + if (literal instanceof BigInteger) { // If the literal is a BigInteger, RexBuilder assumes it represents a long value // within the valid range and converts it without checking the bounds. If the @@ -920,6 +931,8 @@ SqlOperator toOp(Map map) { String name = map.get("name").toString(); SqlKind sqlKind = toEnum(map.get("kind")); SqlSyntax sqlSyntax = toEnum(map.get("syntax")); + String sig = (String) map.get("signature"); + Predicate signature = s -> sig == null || sig.equals(s); List operators = new ArrayList<>(); FRAMEWORK_CONFIG.getOperatorTable().lookupOperatorOverloads( @@ -930,11 +943,20 @@ SqlOperator toOp(Map map) { SqlNameMatchers.liberal() ); + for (SqlOperator operator : operators) { + if (operator.kind == sqlKind && (operator.getOperandTypeChecker() == null || signature.test(operator.getAllowedSignatures()))) { + return operator; + } + } + + // Fallback still need for IgniteSqlOperatorTable.EQUALS and so on operators, can be removed + // after operandTypeChecker will be aligned for (SqlOperator operator : operators) { if (operator.kind == sqlKind) { return operator; } } + String cls = (String) map.get("class"); if (cls != null) { return AvaticaUtils.instantiatePlugin(SqlOperator.class, cls); diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlToRelConvertor.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlToRelConvertor.java index 2b6e480ba4c..0220e52aa28 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlToRelConvertor.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlToRelConvertor.java @@ -46,8 +46,6 @@ import org.apache.calcite.sql.SqlUpdate; import org.apache.calcite.sql.util.SqlShuttle; import org.apache.calcite.sql.validate.SqlValidator; -import org.apache.calcite.sql.validate.SqlValidatorImpl; -import org.apache.calcite.sql.validate.SqlValidatorNamespace; import org.apache.calcite.sql.validate.SqlValidatorScope; import org.apache.calcite.sql.validate.SqlValidatorUtil; import org.apache.calcite.sql2rel.InitializerContext; @@ -303,44 +301,8 @@ private RelNode convertMerge(SqlMerge call) { targetColumnNameList, null, false); } - // ========================================================= - // = BEGIN OF COPY-PASTE = - // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - // TODO: https://issues.apache.org/jira/browse/IGNITE-22755 remove this section - - // Section below is copy-pasted from original SqlToRelConverter. - // The only difference is that invocations of requireNonNull() - // replaced with similar one but accepting lamda instead of - // plain string. @Override public RelOptTable getTargetTable(SqlNode call) { - final SqlValidatorNamespace targetNs = getNamespace(call); - SqlValidatorNamespace namespace; - if (targetNs.isWrapperFor(SqlValidatorImpl.DmlNamespace.class)) { - namespace = targetNs.unwrap(SqlValidatorImpl.DmlNamespace.class); - } else { - namespace = targetNs.resolve(); - } - RelOptTable table = SqlValidatorUtil.getRelOptTable(namespace, catalogReader, null, null); - return requireNonNull(table, () -> "no table found for " + call); - } - - private T getNamespace(SqlNode node) { - //noinspection unchecked - return (T) requireNonNull( - getNamespaceOrNull(node), - () -> "Namespace is not found for " + node); + return super.getTargetTable(call); } - - private @Nullable T getNamespaceOrNull(SqlNode node) { - return (@Nullable T) validator().getNamespace(node); - } - - private SqlValidator validator() { - return requireNonNull(validator, "validator"); - } - - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - // = END OF COPY-PASTE = - // ========================================================= } diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java index 9dd47f807d9..83d557a5140 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java @@ -542,8 +542,12 @@ public void validateLiteral(SqlLiteral literal) { } @Override - protected RelDataType createTargetRowType(SqlValidatorTable table, - @Nullable SqlNodeList targetColumnList, boolean append) { + protected RelDataType createTargetRowType( + SqlValidatorTable table, + SqlNodeList targetColumnList, + boolean append, + SqlIdentifier targetTableAlias + ) { RelDataType baseRowType = table.unwrap(IgniteTable.class).rowTypeForInsert((IgniteTypeFactory) typeFactory); if (targetColumnList == null) { return baseRowType; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rex/IgniteRexBuilder.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rex/IgniteRexBuilder.java index 4188d50efcb..4d9ec1ba9fc 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rex/IgniteRexBuilder.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rex/IgniteRexBuilder.java @@ -56,6 +56,15 @@ public RexNode makeLiteral(@Nullable Object value, RelDataType type, boolean all assert value instanceof Comparable : "Not comparable IgniteCustomType:" + type + ". value: " + value; return makeLiteral((Comparable) value, type, type.getSqlTypeName()); } else if (value != null && type.getSqlTypeName() == SqlTypeName.CHAR) { + if (type.isNullable()) { + RelDataType typeNotNull = + typeFactory.createTypeWithNullability(type, false); + if (allowCast) { + RexNode literalNotNull = makeLiteral(value, typeNotNull, allowCast); + return makeAbstractCast(type, literalNotNull, false); + } + } + NlsString string; if (value instanceof NlsString) { string = (NlsString) value; @@ -64,13 +73,7 @@ public RexNode makeLiteral(@Nullable Object value, RelDataType type, boolean all string = new NlsString((String) value, type.getCharset().name(), type.getCollation()); } - RexNode literal = makeCharLiteral(string); - - if (allowCast) { - return makeCast(type, literal); - } else { - return literal; - } + return makeCharLiteral(string); } else { return super.makeLiteral(value, type, allowCast, trim); } diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java index 7e14873ae62..b87c2742568 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.sql.engine.sql.fun; +import com.google.common.collect.ImmutableList; import java.util.List; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeFactory; @@ -26,6 +27,7 @@ import org.apache.calcite.sql.SqlFunction; import org.apache.calcite.sql.SqlFunctionCategory; import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlOperator; import org.apache.calcite.sql.SqlOperatorBinding; import org.apache.calcite.sql.fun.SqlInternalOperators; import org.apache.calcite.sql.fun.SqlLibraryOperators; @@ -461,271 +463,283 @@ public boolean isDeterministic() { * Default constructor. */ public IgniteSqlOperatorTable() { + init0(); + } + + private void init0() { + ImmutableList.Builder definedOperatorsBuilder = + ImmutableList.builder(); // Set operators. - register(SqlStdOperatorTable.UNION); - register(SqlStdOperatorTable.UNION_ALL); - register(SqlStdOperatorTable.EXCEPT); - register(SqlStdOperatorTable.EXCEPT_ALL); - register(SqlStdOperatorTable.INTERSECT); - register(SqlStdOperatorTable.INTERSECT_ALL); + definedOperatorsBuilder.add(SqlStdOperatorTable.UNION); + definedOperatorsBuilder.add(SqlStdOperatorTable.UNION_ALL); + definedOperatorsBuilder.add(SqlStdOperatorTable.EXCEPT); + definedOperatorsBuilder.add(SqlStdOperatorTable.EXCEPT_ALL); + definedOperatorsBuilder.add(SqlStdOperatorTable.INTERSECT); + definedOperatorsBuilder.add(SqlStdOperatorTable.INTERSECT_ALL); // Logical. - register(SqlStdOperatorTable.AND); - register(SqlStdOperatorTable.OR); - register(SqlStdOperatorTable.NOT); + definedOperatorsBuilder.add(SqlStdOperatorTable.AND); + definedOperatorsBuilder.add(SqlStdOperatorTable.OR); + definedOperatorsBuilder.add(SqlStdOperatorTable.NOT); // Comparisons. - register(LESS_THAN); - register(LESS_THAN_OR_EQUAL); - register(GREATER_THAN); - register(GREATER_THAN_OR_EQUAL); - register(EQUALS); - register(NOT_EQUALS); - register(SqlStdOperatorTable.BETWEEN); - register(SqlStdOperatorTable.NOT_BETWEEN); + definedOperatorsBuilder.add(LESS_THAN); + definedOperatorsBuilder.add(LESS_THAN_OR_EQUAL); + definedOperatorsBuilder.add(GREATER_THAN); + definedOperatorsBuilder.add(GREATER_THAN_OR_EQUAL); + definedOperatorsBuilder.add(EQUALS); + definedOperatorsBuilder.add(NOT_EQUALS); + definedOperatorsBuilder.add(SqlStdOperatorTable.BETWEEN); + definedOperatorsBuilder.add(SqlStdOperatorTable.NOT_BETWEEN); // Arithmetic. - register(PLUS); - register(MINUS); - register(MULTIPLY); - register(DIVIDE); - register(SqlStdOperatorTable.DIVIDE_INTEGER); // Used internally. - register(PERCENT_REMAINDER); - register(SqlStdOperatorTable.UNARY_MINUS); - register(SqlStdOperatorTable.UNARY_PLUS); + definedOperatorsBuilder.add(PLUS); + definedOperatorsBuilder.add(MINUS); + definedOperatorsBuilder.add(MULTIPLY); + definedOperatorsBuilder.add(DIVIDE); + definedOperatorsBuilder.add(SqlStdOperatorTable.DIVIDE_INTEGER); // Used internally. + definedOperatorsBuilder.add(PERCENT_REMAINDER); + definedOperatorsBuilder.add(SqlStdOperatorTable.UNARY_MINUS); + definedOperatorsBuilder.add(SqlStdOperatorTable.UNARY_PLUS); // Aggregates. - register(SqlStdOperatorTable.COUNT); - register(SqlStdOperatorTable.SUM); - register(SqlStdOperatorTable.SUM0); - register(SqlStdOperatorTable.AVG); - register(DECIMAL_DIVIDE); - register(SqlStdOperatorTable.MIN); - register(SqlStdOperatorTable.MAX); - register(SqlStdOperatorTable.ANY_VALUE); - register(SqlStdOperatorTable.SINGLE_VALUE); - register(SqlStdOperatorTable.FILTER); - - register(EVERY); - register(SOME); + definedOperatorsBuilder.add(SqlStdOperatorTable.COUNT); + definedOperatorsBuilder.add(SqlStdOperatorTable.SUM); + definedOperatorsBuilder.add(SqlStdOperatorTable.SUM0); + definedOperatorsBuilder.add(SqlStdOperatorTable.AVG); + definedOperatorsBuilder.add(DECIMAL_DIVIDE); + definedOperatorsBuilder.add(SqlStdOperatorTable.MIN); + definedOperatorsBuilder.add(SqlStdOperatorTable.MAX); + definedOperatorsBuilder.add(SqlStdOperatorTable.ANY_VALUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.SINGLE_VALUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.FILTER); + + definedOperatorsBuilder.add(EVERY); + definedOperatorsBuilder.add(SOME); // IS ... operator. - register(SqlStdOperatorTable.IS_NULL); - register(SqlStdOperatorTable.IS_NOT_NULL); - register(SqlStdOperatorTable.IS_TRUE); - register(SqlStdOperatorTable.IS_NOT_TRUE); - register(SqlStdOperatorTable.IS_FALSE); - register(SqlStdOperatorTable.IS_NOT_FALSE); - register(IS_DISTINCT_FROM); - register(IS_NOT_DISTINCT_FROM); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NULL); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_NULL); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_TRUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_TRUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_FALSE); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_FALSE); + definedOperatorsBuilder.add(IS_DISTINCT_FROM); + definedOperatorsBuilder.add(IS_NOT_DISTINCT_FROM); // LIKE and SIMILAR. - register(SqlStdOperatorTable.LIKE); - register(SqlStdOperatorTable.NOT_LIKE); - register(SqlStdOperatorTable.SIMILAR_TO); - register(SqlStdOperatorTable.NOT_SIMILAR_TO); + definedOperatorsBuilder.add(SqlStdOperatorTable.LIKE); + definedOperatorsBuilder.add(SqlStdOperatorTable.NOT_LIKE); + definedOperatorsBuilder.add(SqlStdOperatorTable.SIMILAR_TO); + definedOperatorsBuilder.add(SqlStdOperatorTable.NOT_SIMILAR_TO); // NULLS ordering. - register(SqlStdOperatorTable.NULLS_FIRST); - register(SqlStdOperatorTable.NULLS_LAST); - register(SqlStdOperatorTable.DESC); + definedOperatorsBuilder.add(SqlStdOperatorTable.NULLS_FIRST); + definedOperatorsBuilder.add(SqlStdOperatorTable.NULLS_LAST); + definedOperatorsBuilder.add(SqlStdOperatorTable.DESC); // Exists. - register(SqlStdOperatorTable.EXISTS); + definedOperatorsBuilder.add(SqlStdOperatorTable.EXISTS); // String functions. - register(SqlStdOperatorTable.UPPER); - register(SqlStdOperatorTable.LOWER); - register(SqlStdOperatorTable.INITCAP); - register(SqlLibraryOperators.TO_BASE64); - register(SqlLibraryOperators.FROM_BASE64); - register(SqlLibraryOperators.MD5); - register(SqlLibraryOperators.SHA1); - register(SqlStdOperatorTable.SUBSTRING); - register(SqlLibraryOperators.LEFT); - register(SqlLibraryOperators.RIGHT); - register(SqlStdOperatorTable.REPLACE); - register(SqlLibraryOperators.TRANSLATE3); - register(SqlLibraryOperators.CHR); - register(SqlStdOperatorTable.CHAR_LENGTH); - register(SqlStdOperatorTable.CHARACTER_LENGTH); - register(SqlStdOperatorTable.CONCAT); - register(SqlLibraryOperators.CONCAT_FUNCTION); - register(SqlStdOperatorTable.OVERLAY); - register(SqlStdOperatorTable.POSITION); - register(SqlStdOperatorTable.ASCII); - register(SqlLibraryOperators.REPEAT); - register(SqlLibraryOperators.SPACE); - register(SqlLibraryOperators.STRCMP); - register(SqlLibraryOperators.SOUNDEX); - register(SqlLibraryOperators.DIFFERENCE); - register(SqlLibraryOperators.REVERSE); - register(SqlStdOperatorTable.TRIM); - register(SqlLibraryOperators.LTRIM); - register(SqlLibraryOperators.RTRIM); - register(SUBSTR); + definedOperatorsBuilder.add(SqlStdOperatorTable.UPPER); + definedOperatorsBuilder.add(SqlStdOperatorTable.LOWER); + definedOperatorsBuilder.add(SqlStdOperatorTable.INITCAP); + definedOperatorsBuilder.add(SqlLibraryOperators.TO_BASE64); + definedOperatorsBuilder.add(SqlLibraryOperators.FROM_BASE64); + definedOperatorsBuilder.add(SqlLibraryOperators.MD5); + definedOperatorsBuilder.add(SqlLibraryOperators.SHA1); + definedOperatorsBuilder.add(SqlStdOperatorTable.SUBSTRING); + definedOperatorsBuilder.add(SqlLibraryOperators.LEFT); + definedOperatorsBuilder.add(SqlLibraryOperators.RIGHT); + definedOperatorsBuilder.add(SqlStdOperatorTable.REPLACE); + definedOperatorsBuilder.add(SqlLibraryOperators.TRANSLATE3); + definedOperatorsBuilder.add(SqlLibraryOperators.CHR); + definedOperatorsBuilder.add(SqlStdOperatorTable.CHAR_LENGTH); + definedOperatorsBuilder.add(SqlStdOperatorTable.CHARACTER_LENGTH); + definedOperatorsBuilder.add(SqlStdOperatorTable.CONCAT); + definedOperatorsBuilder.add(SqlLibraryOperators.CONCAT_FUNCTION); + definedOperatorsBuilder.add(SqlStdOperatorTable.OVERLAY); + definedOperatorsBuilder.add(SqlStdOperatorTable.POSITION); + definedOperatorsBuilder.add(SqlStdOperatorTable.ASCII); + definedOperatorsBuilder.add(SqlLibraryOperators.REPEAT); + definedOperatorsBuilder.add(SqlLibraryOperators.SPACE); + definedOperatorsBuilder.add(SqlLibraryOperators.STRCMP); + definedOperatorsBuilder.add(SqlLibraryOperators.SOUNDEX); + definedOperatorsBuilder.add(SqlLibraryOperators.DIFFERENCE); + definedOperatorsBuilder.add(SqlLibraryOperators.REVERSE); + definedOperatorsBuilder.add(SqlStdOperatorTable.TRIM); + definedOperatorsBuilder.add(SqlLibraryOperators.LTRIM); + definedOperatorsBuilder.add(SqlLibraryOperators.RTRIM); + definedOperatorsBuilder.add(SUBSTR); // Math functions. - register(SqlStdOperatorTable.MOD); // Arithmetic remainder. - register(SqlStdOperatorTable.EXP); // Euler's number e raised to the power of a value. - register(SqlStdOperatorTable.POWER); - register(SqlStdOperatorTable.LN); // Natural logarithm. - register(SqlStdOperatorTable.LOG10); // The base 10 logarithm. - register(SqlStdOperatorTable.ABS); // Absolute value. - register(SqlStdOperatorTable.RAND); // Random. - register(SqlStdOperatorTable.RAND_INTEGER); // Integer random. - register(SqlStdOperatorTable.ACOS); // Arc cosine. - register(SqlStdOperatorTable.ASIN); // Arc sine. - register(SqlStdOperatorTable.ATAN); // Arc tangent. - register(SqlStdOperatorTable.ATAN2); // Angle from coordinates. - register(SqlStdOperatorTable.SQRT); // Square root. - register(SqlStdOperatorTable.CBRT); // Cube root. - register(SqlStdOperatorTable.COS); // Cosine - register(SqlLibraryOperators.COSH); // Hyperbolic cosine. - register(SqlStdOperatorTable.COT); // Cotangent. - register(SqlStdOperatorTable.DEGREES); // Radians to degrees. - register(SqlStdOperatorTable.RADIANS); // Degrees to radians. - register(ROUND); // Fixes return type scale. - register(SqlStdOperatorTable.SIGN); - register(SqlStdOperatorTable.SIN); // Sine. - register(SqlLibraryOperators.SINH); // Hyperbolic sine. - register(SqlStdOperatorTable.TAN); // Tangent. - register(SqlLibraryOperators.TANH); // Hyperbolic tangent. - register(TRUNCATE); // Fixes return type scale. - register(SqlStdOperatorTable.PI); + definedOperatorsBuilder.add(SqlStdOperatorTable.MOD); // Arithmetic remainder. + definedOperatorsBuilder.add(SqlStdOperatorTable.EXP); // Euler's number e raised to the power of a value. + definedOperatorsBuilder.add(SqlStdOperatorTable.POWER); + definedOperatorsBuilder.add(SqlStdOperatorTable.LN); // Natural logarithm. + definedOperatorsBuilder.add(SqlStdOperatorTable.LOG10); // The base 10 logarithm. + definedOperatorsBuilder.add(SqlStdOperatorTable.ABS); // Absolute value. + definedOperatorsBuilder.add(SqlStdOperatorTable.RAND); // Random. + definedOperatorsBuilder.add(SqlStdOperatorTable.RAND_INTEGER); // Integer random. + definedOperatorsBuilder.add(SqlStdOperatorTable.ACOS); // Arc cosine. + definedOperatorsBuilder.add(SqlStdOperatorTable.ASIN); // Arc sine. + definedOperatorsBuilder.add(SqlStdOperatorTable.ATAN); // Arc tangent. + definedOperatorsBuilder.add(SqlStdOperatorTable.ATAN2); // Angle from coordinates. + definedOperatorsBuilder.add(SqlStdOperatorTable.SQRT); // Square root. + definedOperatorsBuilder.add(SqlStdOperatorTable.CBRT); // Cube root. + definedOperatorsBuilder.add(SqlStdOperatorTable.COS); // Cosine + definedOperatorsBuilder.add(SqlLibraryOperators.COSH); // Hyperbolic cosine. + definedOperatorsBuilder.add(SqlStdOperatorTable.COT); // Cotangent. + definedOperatorsBuilder.add(SqlStdOperatorTable.DEGREES); // Radians to degrees. + definedOperatorsBuilder.add(SqlStdOperatorTable.RADIANS); // Degrees to radians. + definedOperatorsBuilder.add(ROUND); // Fixes return type scale. + definedOperatorsBuilder.add(SqlStdOperatorTable.SIGN); + definedOperatorsBuilder.add(SqlStdOperatorTable.SIN); // Sine. + definedOperatorsBuilder.add(SqlLibraryOperators.SINH); // Hyperbolic sine. + definedOperatorsBuilder.add(SqlStdOperatorTable.TAN); // Tangent. + definedOperatorsBuilder.add(SqlLibraryOperators.TANH); // Hyperbolic tangent. + definedOperatorsBuilder.add(TRUNCATE); // Fixes return type scale. + definedOperatorsBuilder.add(SqlStdOperatorTable.PI); // Date and time. - register(SqlStdOperatorTable.DATETIME_PLUS); - register(SqlStdOperatorTable.MINUS_DATE); - register(SqlStdOperatorTable.EXTRACT); - register(SqlStdOperatorTable.FLOOR); - register(SqlStdOperatorTable.CEIL); - register(SqlStdOperatorTable.TIMESTAMP_ADD); - register(SqlStdOperatorTable.TIMESTAMP_DIFF); - register(SqlStdOperatorTable.LAST_DAY); - register(SqlLibraryOperators.DAYNAME); - register(SqlLibraryOperators.MONTHNAME); - register(SqlStdOperatorTable.DAYOFMONTH); - register(SqlStdOperatorTable.DAYOFWEEK); - register(SqlStdOperatorTable.DAYOFYEAR); - register(SqlStdOperatorTable.YEAR); - register(SqlStdOperatorTable.QUARTER); - register(SqlStdOperatorTable.MONTH); - register(SqlStdOperatorTable.WEEK); - register(SqlStdOperatorTable.HOUR); - register(SqlStdOperatorTable.MINUTE); - register(SqlStdOperatorTable.SECOND); - register(SqlLibraryOperators.TIMESTAMP_SECONDS); // Seconds since 1970-01-01 to timestamp. - register(SqlLibraryOperators.TIMESTAMP_MILLIS); // Milliseconds since 1970-01-01 to timestamp. - register(SqlLibraryOperators.TIMESTAMP_MICROS); // Microseconds since 1970-01-01 to timestamp. - register(SqlLibraryOperators.UNIX_SECONDS); // Timestamp to seconds since 1970-01-01. - register(SqlLibraryOperators.UNIX_MILLIS); // Timestamp to milliseconds since 1970-01-01. - register(SqlLibraryOperators.UNIX_MICROS); // Timestamp to microseconds since 1970-01-01. - register(SqlLibraryOperators.UNIX_DATE); // Date to days since 1970-01-01. - register(SqlLibraryOperators.DATE_FROM_UNIX_DATE); // Days since 1970-01-01 to date. - register(SqlLibraryOperators.DATE); // String to date. + definedOperatorsBuilder.add(SqlStdOperatorTable.DATETIME_PLUS); + definedOperatorsBuilder.add(SqlStdOperatorTable.MINUS_DATE); + definedOperatorsBuilder.add(SqlStdOperatorTable.EXTRACT); + definedOperatorsBuilder.add(SqlStdOperatorTable.FLOOR); + definedOperatorsBuilder.add(SqlStdOperatorTable.CEIL); + definedOperatorsBuilder.add(SqlStdOperatorTable.TIMESTAMP_ADD); + definedOperatorsBuilder.add(SqlStdOperatorTable.TIMESTAMP_DIFF); + definedOperatorsBuilder.add(SqlStdOperatorTable.LAST_DAY); + definedOperatorsBuilder.add(SqlLibraryOperators.DAYNAME); + definedOperatorsBuilder.add(SqlLibraryOperators.MONTHNAME); + definedOperatorsBuilder.add(SqlStdOperatorTable.DAYOFMONTH); + definedOperatorsBuilder.add(SqlStdOperatorTable.DAYOFWEEK); + definedOperatorsBuilder.add(SqlStdOperatorTable.DAYOFYEAR); + definedOperatorsBuilder.add(SqlStdOperatorTable.YEAR); + definedOperatorsBuilder.add(SqlStdOperatorTable.QUARTER); + definedOperatorsBuilder.add(SqlStdOperatorTable.MONTH); + definedOperatorsBuilder.add(SqlStdOperatorTable.WEEK); + definedOperatorsBuilder.add(SqlStdOperatorTable.HOUR); + definedOperatorsBuilder.add(SqlStdOperatorTable.MINUTE); + definedOperatorsBuilder.add(SqlStdOperatorTable.SECOND); + definedOperatorsBuilder.add(SqlLibraryOperators.TIMESTAMP_SECONDS); // Seconds since 1970-01-01 to timestamp. + definedOperatorsBuilder.add(SqlLibraryOperators.TIMESTAMP_MILLIS); // Milliseconds since 1970-01-01 to timestamp. + definedOperatorsBuilder.add(SqlLibraryOperators.TIMESTAMP_MICROS); // Microseconds since 1970-01-01 to timestamp. + definedOperatorsBuilder.add(SqlLibraryOperators.UNIX_SECONDS); // Timestamp to seconds since 1970-01-01. + definedOperatorsBuilder.add(SqlLibraryOperators.UNIX_MILLIS); // Timestamp to milliseconds since 1970-01-01. + definedOperatorsBuilder.add(SqlLibraryOperators.UNIX_MICROS); // Timestamp to microseconds since 1970-01-01. + definedOperatorsBuilder.add(SqlLibraryOperators.UNIX_DATE); // Date to days since 1970-01-01. + definedOperatorsBuilder.add(SqlLibraryOperators.DATE_FROM_UNIX_DATE); // Days since 1970-01-01 to date. + definedOperatorsBuilder.add(SqlLibraryOperators.DATE); // String to date. // POSIX REGEX. - register(SqlStdOperatorTable.POSIX_REGEX_CASE_INSENSITIVE); - register(SqlStdOperatorTable.POSIX_REGEX_CASE_SENSITIVE); - register(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_INSENSITIVE); - register(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_SENSITIVE); - register(SqlLibraryOperators.REGEXP_REPLACE); + definedOperatorsBuilder.add(SqlStdOperatorTable.POSIX_REGEX_CASE_INSENSITIVE); + definedOperatorsBuilder.add(SqlStdOperatorTable.POSIX_REGEX_CASE_SENSITIVE); + definedOperatorsBuilder.add(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_INSENSITIVE); + definedOperatorsBuilder.add(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_SENSITIVE); + definedOperatorsBuilder.add(SqlLibraryOperators.REGEXP_REPLACE_2); + definedOperatorsBuilder.add(SqlLibraryOperators.REGEXP_REPLACE_3); + definedOperatorsBuilder.add(SqlLibraryOperators.REGEXP_REPLACE_4); + definedOperatorsBuilder.add(SqlLibraryOperators.REGEXP_REPLACE_5); + definedOperatorsBuilder.add(SqlLibraryOperators.REGEXP_REPLACE_6); // Collections. - register(SqlStdOperatorTable.MAP_VALUE_CONSTRUCTOR); - register(SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR); - register(SqlStdOperatorTable.ITEM); - register(SqlStdOperatorTable.CARDINALITY); - register(SqlStdOperatorTable.IS_EMPTY); - register(SqlStdOperatorTable.IS_NOT_EMPTY); + definedOperatorsBuilder.add(SqlStdOperatorTable.MAP_VALUE_CONSTRUCTOR); + definedOperatorsBuilder.add(SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR); + definedOperatorsBuilder.add(SqlStdOperatorTable.ITEM); + definedOperatorsBuilder.add(SqlStdOperatorTable.CARDINALITY); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_EMPTY); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_EMPTY); // TODO https://issues.apache.org/jira/browse/IGNITE-19332 - // register(SqlStdOperatorTable.MAP_QUERY); - // register(SqlStdOperatorTable.ARRAY_QUERY); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MAP_QUERY); + // definedOperatorsBuilder.add(SqlStdOperatorTable.ARRAY_QUERY); // Multiset. // TODO https://issues.apache.org/jira/browse/IGNITE-15551 - // register(SqlStdOperatorTable.MULTISET_VALUE); - // register(SqlStdOperatorTable.MULTISET_QUERY); - // register(SqlStdOperatorTable.SLICE); - // register(SqlStdOperatorTable.ELEMENT); - // register(SqlStdOperatorTable.STRUCT_ACCESS); - // register(SqlStdOperatorTable.MEMBER_OF); - // register(SqlStdOperatorTable.IS_A_SET); - // register(SqlStdOperatorTable.IS_NOT_A_SET); - // register(SqlStdOperatorTable.MULTISET_INTERSECT_DISTINCT); - // register(SqlStdOperatorTable.MULTISET_INTERSECT); - // register(SqlStdOperatorTable.MULTISET_EXCEPT_DISTINCT); - // register(SqlStdOperatorTable.MULTISET_EXCEPT); - // register(SqlStdOperatorTable.MULTISET_UNION_DISTINCT); - // register(SqlStdOperatorTable.MULTISET_UNION); - // register(SqlStdOperatorTable.SUBMULTISET_OF); - // register(SqlStdOperatorTable.NOT_SUBMULTISET_OF); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_VALUE); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_QUERY); + // definedOperatorsBuilder.add(SqlStdOperatorTable.SLICE); + // definedOperatorsBuilder.add(SqlStdOperatorTable.ELEMENT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.STRUCT_ACCESS); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MEMBER_OF); + // definedOperatorsBuilder.add(SqlStdOperatorTable.IS_A_SET); + // definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_A_SET); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_INTERSECT_DISTINCT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_INTERSECT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_EXCEPT_DISTINCT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_EXCEPT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_UNION_DISTINCT); + // definedOperatorsBuilder.add(SqlStdOperatorTable.MULTISET_UNION); + // definedOperatorsBuilder.add(SqlStdOperatorTable.SUBMULTISET_OF); + // definedOperatorsBuilder.add(SqlStdOperatorTable.NOT_SUBMULTISET_OF); // Other functions and operators. - register(SqlStdOperatorTable.ROW); - register(SqlStdOperatorTable.CAST); - register(SqlLibraryOperators.INFIX_CAST); - register(SqlStdOperatorTable.COALESCE); - register(SqlLibraryOperators.NVL); - register(SqlStdOperatorTable.NULLIF); - register(SqlStdOperatorTable.CASE); - register(SqlLibraryOperators.DECODE); - register(SqlLibraryOperators.LEAST); - register(SqlLibraryOperators.GREATEST); - register(SqlLibraryOperators.COMPRESS); - register(OCTET_LENGTH); - register(SqlStdOperatorTable.DEFAULT); - register(SqlStdOperatorTable.REINTERPRET); + definedOperatorsBuilder.add(SqlStdOperatorTable.ROW); + definedOperatorsBuilder.add(SqlStdOperatorTable.CAST); + definedOperatorsBuilder.add(SqlLibraryOperators.INFIX_CAST); + definedOperatorsBuilder.add(SqlStdOperatorTable.COALESCE); + definedOperatorsBuilder.add(SqlLibraryOperators.NVL); + definedOperatorsBuilder.add(SqlStdOperatorTable.NULLIF); + definedOperatorsBuilder.add(SqlStdOperatorTable.CASE); + definedOperatorsBuilder.add(SqlLibraryOperators.DECODE); + definedOperatorsBuilder.add(SqlLibraryOperators.LEAST); + definedOperatorsBuilder.add(SqlLibraryOperators.GREATEST); + definedOperatorsBuilder.add(SqlLibraryOperators.COMPRESS); + definedOperatorsBuilder.add(OCTET_LENGTH); + definedOperatorsBuilder.add(SqlStdOperatorTable.DEFAULT); + definedOperatorsBuilder.add(SqlStdOperatorTable.REINTERPRET); // XML Operators. - register(SqlLibraryOperators.EXTRACT_VALUE); - register(SqlLibraryOperators.XML_TRANSFORM); - register(SqlLibraryOperators.EXTRACT_XML); - register(SqlLibraryOperators.EXISTS_NODE); + definedOperatorsBuilder.add(SqlLibraryOperators.EXTRACT_VALUE); + definedOperatorsBuilder.add(SqlLibraryOperators.XML_TRANSFORM); + definedOperatorsBuilder.add(SqlLibraryOperators.EXTRACT_XML); + definedOperatorsBuilder.add(SqlLibraryOperators.EXISTS_NODE); // JSON Operators - register(SqlStdOperatorTable.JSON_TYPE_OPERATOR); - register(SqlStdOperatorTable.JSON_VALUE_EXPRESSION); - register(SqlStdOperatorTable.JSON_VALUE); - register(SqlStdOperatorTable.JSON_QUERY); - register(SqlLibraryOperators.JSON_TYPE); - register(SqlStdOperatorTable.JSON_EXISTS); - register(SqlLibraryOperators.JSON_DEPTH); - register(SqlLibraryOperators.JSON_KEYS); - register(SqlLibraryOperators.JSON_PRETTY); - register(SqlLibraryOperators.JSON_LENGTH); - register(SqlLibraryOperators.JSON_REMOVE); - register(SqlLibraryOperators.JSON_STORAGE_SIZE); - register(SqlStdOperatorTable.JSON_OBJECT); - register(SqlStdOperatorTable.JSON_ARRAY); - register(SqlStdOperatorTable.IS_JSON_VALUE); - register(SqlStdOperatorTable.IS_JSON_OBJECT); - register(SqlStdOperatorTable.IS_JSON_ARRAY); - register(SqlStdOperatorTable.IS_JSON_SCALAR); - register(SqlStdOperatorTable.IS_NOT_JSON_VALUE); - register(SqlStdOperatorTable.IS_NOT_JSON_OBJECT); - register(SqlStdOperatorTable.IS_NOT_JSON_ARRAY); - register(SqlStdOperatorTable.IS_NOT_JSON_SCALAR); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_TYPE_OPERATOR); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_VALUE_EXPRESSION); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_VALUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_QUERY); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_TYPE); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_EXISTS); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_DEPTH); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_KEYS); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_PRETTY); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_LENGTH); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_REMOVE); + definedOperatorsBuilder.add(SqlLibraryOperators.JSON_STORAGE_SIZE); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_OBJECT); + definedOperatorsBuilder.add(SqlStdOperatorTable.JSON_ARRAY); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_JSON_VALUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_JSON_OBJECT); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_JSON_ARRAY); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_JSON_SCALAR); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_JSON_VALUE); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_JSON_OBJECT); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_JSON_ARRAY); + definedOperatorsBuilder.add(SqlStdOperatorTable.IS_NOT_JSON_SCALAR); // Aggregate functions. - register(SqlInternalOperators.LITERAL_AGG); + definedOperatorsBuilder.add(SqlInternalOperators.LITERAL_AGG); // Current time functions. - register(SqlStdOperatorTable.CURRENT_TIME); - register(SqlStdOperatorTable.CURRENT_TIMESTAMP); - register(SqlStdOperatorTable.CURRENT_DATE); - register(SqlStdOperatorTable.LOCALTIME); - register(SqlStdOperatorTable.LOCALTIMESTAMP); + definedOperatorsBuilder.add(SqlStdOperatorTable.CURRENT_TIME); + definedOperatorsBuilder.add(SqlStdOperatorTable.CURRENT_TIMESTAMP); + definedOperatorsBuilder.add(SqlStdOperatorTable.CURRENT_DATE); + definedOperatorsBuilder.add(SqlStdOperatorTable.LOCALTIME); + definedOperatorsBuilder.add(SqlStdOperatorTable.LOCALTIMESTAMP); // Ignite specific operators - register(LENGTH); - register(SYSTEM_RANGE); - register(TYPEOF); - register(LEAST2); - register(GREATEST2); - register(RAND_UUID); + definedOperatorsBuilder.add(LENGTH); + definedOperatorsBuilder.add(SYSTEM_RANGE); + definedOperatorsBuilder.add(TYPEOF); + definedOperatorsBuilder.add(LEAST2); + definedOperatorsBuilder.add(GREATEST2); + definedOperatorsBuilder.add(RAND_UUID); + + setOperators(buildIndex(definedOperatorsBuilder.build())); } /** Sets scale to {@code 0} for single argument variants of ROUND/TRUNCATE operators. */ diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java index 1b1a3628304..ce3b42770ec 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java @@ -20,11 +20,13 @@ import java.math.BigDecimal; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeFactory; +import org.apache.calcite.rel.type.RelDataTypeFactoryImpl; import org.apache.calcite.rel.type.RelDataTypeSystemImpl; import org.apache.calcite.sql.type.BasicSqlType; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.sql.type.SqlTypeUtil; import org.apache.ignite.internal.catalog.commands.CatalogUtils; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Ignite type system. @@ -181,4 +183,57 @@ public RelDataType deriveAvgAggType(RelDataTypeFactory typeFactory, RelDataType return super.deriveAvgAggType(typeFactory, argumentType); } + + /** Copy from calcite 1.37 implementation. */ + @Override + public @Nullable RelDataType deriveDecimalDivideType(RelDataTypeFactory typeFactory, + RelDataType type1, RelDataType type2) { + + if (SqlTypeUtil.isExactNumeric(type1) + && SqlTypeUtil.isExactNumeric(type2)) { + if (SqlTypeUtil.isDecimal(type1) + || SqlTypeUtil.isDecimal(type2)) { + // Java numeric will always have invalid precision/scale, + // use its default decimal precision/scale instead. + type1 = RelDataTypeFactoryImpl.isJavaType(type1) + ? typeFactory.decimalOf(type1) + : type1; + type2 = RelDataTypeFactoryImpl.isJavaType(type2) + ? typeFactory.decimalOf(type2) + : type2; + int p1 = type1.getPrecision(); + int p2 = type2.getPrecision(); + int s1 = type1.getScale(); + int s2 = type2.getScale(); + + final int maxNumericPrecision = getMaxNumericPrecision(); + int dout = + Math.min( + p1 - s1 + s2, + maxNumericPrecision); + + int scale = Math.max(6, s1 + p2 + 1); + scale = + Math.min( + scale, + maxNumericPrecision - dout); + scale = Math.min(scale, getMaxNumericScale()); + + int precision = dout + scale; + assert precision <= maxNumericPrecision; + assert precision > 0; + + RelDataType ret; + ret = typeFactory + .createSqlType( + SqlTypeName.DECIMAL, + precision, + scale); + + return ret; + } + } + + return null; + } } diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMath.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMath.java index b1edf426abe..75a108c22b6 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMath.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMath.java @@ -44,8 +44,8 @@ public class IgniteMath { private static final BigDecimal UPPER_FLOAT_BIG_DECIMAL = new BigDecimal(String.valueOf(Float.MAX_VALUE)); private static final BigDecimal LOWER_FLOAT_BIG_DECIMAL = UPPER_FLOAT_BIG_DECIMAL.negate(); - private static final double UPPER_FLOAT_DOUBLE = Float.MAX_VALUE; - private static final double LOWER_FLOAT_DOUBLE = -Float.MAX_VALUE; + private static final double UPPER_FLOAT_DOUBLE = Double.parseDouble("" + Float.MAX_VALUE); + private static final double LOWER_FLOAT_DOUBLE = Double.parseDouble("" + (-Float.MAX_VALUE)); /** Decimal rounding mode. */ public static final RoundingMode ROUNDING_MODE = RoundingMode.HALF_UP; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java index ab20fcc849d..9de198e48e4 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java @@ -116,6 +116,10 @@ public enum IgniteMethod { */ TRUNCATE(IgniteSqlFunctions.class, "struncate", true), + LN(IgniteSqlFunctions.class, "log", true), + LOG(IgniteSqlFunctions.class, "log", true), + LOG10(IgniteSqlFunctions.class, "log", true), + /** * Decimal division as well as division operator used by REDUCE phase of AVG aggregate. * See {@link IgniteMath#decimalDivide(BigDecimal, BigDecimal, int, int)}. diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java index 6808b836d16..651cb5b9cc0 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java @@ -739,9 +739,9 @@ public void testRowSource(ColumnType columnType, boolean literalsOnly) { Object expected; if (columnType == ColumnType.FLOAT) { - expected = ((BigDecimal) ((RexLiteral) expr1).getValue4()).floatValue(); + expected = ((Number) ((RexLiteral) expr1).getValue4()).floatValue(); } else if (columnType == ColumnType.DOUBLE) { - expected = ((BigDecimal) ((RexLiteral) expr1).getValue4()).doubleValue(); + expected = ((Number) ((RexLiteral) expr1).getValue4()).doubleValue(); } else { expected = val == null ? null : TypeUtils.toInternal(val, val.getClass()); } @@ -846,18 +846,18 @@ private static Stream numericLiterals() { // REAL Arguments.of(makeLit.apply(BigDecimal.ONE, realType), realType, 1.0f, false), - Arguments.of(makeLit.apply(realMax, realType), realType, null, true), - Arguments.of(makeLit.apply(realMin, realType), realType, null, true), + Arguments.of(makeLit.apply(realMax, realType), realType, (float) realMax.doubleValue(), false), + Arguments.of(makeLit.apply(realMin, realType), realType, (float) ((BigDecimal) realMin).doubleValue(), false), // FLOAT Arguments.of(makeLit.apply(BigDecimal.ONE, floatType), floatType, 1.0f, false), - Arguments.of(makeLit.apply(floatMax, floatType), floatType, null, true), - Arguments.of(makeLit.apply(floatMin, floatType), floatType, null, true), + Arguments.of(makeLit.apply(floatMax, floatType), floatType, (float) realMax.doubleValue(), false), + Arguments.of(makeLit.apply(floatMin, floatType), floatType, (float) ((BigDecimal) realMin).doubleValue(), false), // DOUBLE Arguments.of(makeLit.apply(BigDecimal.ONE, doubleType), doubleType, 1.0d, false), - Arguments.of(makeLit.apply(doubleMax, doubleType), doubleType, null, true), - Arguments.of(makeLit.apply(doubleMin, doubleType), doubleType, null, true), + Arguments.of(makeLit.apply(doubleMax, doubleType), doubleType, doubleMax.doubleValue(), false), + Arguments.of(makeLit.apply(doubleMin, doubleType), doubleType, ((BigDecimal) doubleMin).doubleValue(), false), // DECIMAL Arguments.of(makeLit.apply(new BigDecimal("1"), decimal5), decimal5, new BigDecimal("1"), false), diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/DynamicParametersTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/DynamicParametersTest.java index 6f5b590d7df..c3e81ce48a1 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/DynamicParametersTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/DynamicParametersTest.java @@ -243,32 +243,27 @@ public Stream testStandalone() { checkStatement() .sql("SELECT CAST(? AS INTEGER)", 1) .parameterTypes(nullable(NativeTypes.INT32)) - // We are going to cast at runtime. - .project("?0"), + .project("CAST(?0):INTEGER"), checkStatement() .sql("SELECT CAST(? AS DECIMAL(60, 30))", BigDecimal.ONE) .parameterTypes(nullable(NativeTypes.decimalOf(60, 30))) - // We are going to cast at runtime. - .project("?0"), + .project("CAST(?0):DECIMAL(60, 30)"), checkStatement() .sql("SELECT ?::DECIMAL(60, 30)", BigDecimal.ONE) .parameterTypes(nullable(NativeTypes.decimalOf(60, 30))) - // We are going to cast at runtime. - .project("?0"), + .project("CAST(?0):DECIMAL(60, 30)"), checkStatement() .sql("SELECT CAST(? AS INTEGER)", "1") .parameterTypes(nullable(NativeTypes.STRING)) - // We are going to cast at runtime. .project("CAST(?0):INTEGER"), checkStatement() .sql("SELECT CAST(? AS INTEGER)", Unspecified.UNKNOWN) .parameterTypes(nullable(NativeTypes.INT32)) - // We are going to cast at runtime. - .project("?0"), + .project("CAST(?0):INTEGER"), checkStatement() .sql("SELECT -?", 1) @@ -381,7 +376,7 @@ public Stream testBetween() { .ok(), sql("SELECT 1 BETWEEN ? AND ?", Unspecified.UNKNOWN, 10L) - .parameterTypes(nullable(NativeTypes.INT32), nullable(NativeTypes.INT64)) + .parameterTypes(nullable(NativeTypes.INT64), nullable(NativeTypes.INT64)) .ok(), sql("SELECT ? BETWEEN ? AND ?", Unspecified.UNKNOWN, 1, 10) @@ -445,7 +440,7 @@ public Stream testNullIf() { checkStatement() .sql("SELECT NULLIF(CAST(? AS INTEGER), 1)", Unspecified.UNKNOWN) .parameterTypes(nullable(NativeTypes.INT32)) - .project("CASE(=(?0, 1), null:INTEGER, ?0)") + .project("CASE(=(CAST(?0):INTEGER, 1), null:INTEGER, CAST(?0):INTEGER)") ); } diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/ImplicitCastsTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/ImplicitCastsTest.java index 4a887ab7777..4fe59a63288 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/ImplicitCastsTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/ImplicitCastsTest.java @@ -303,7 +303,7 @@ public Stream testInExpression() { checkStatement() .table("t", "int_col", NativeTypes.INT32, "str_col", NativeTypes.stringOf(4), "bigint_col", NativeTypes.INT64) .sql("SELECT int_col IN ('c'::REAL, 1) FROM t") - .project("OR(=(CAST($t0):REAL, CAST(_UTF-8'c'):REAL NOT NULL), =(CAST($t0):REAL, 1))"), + .project("OR(=(CAST($t0):REAL, CAST(_UTF-8'c'):REAL NOT NULL), =(CAST($t0):REAL, 1.0E0))"), checkStatement() .table("t", "int_col", NativeTypes.INT32, "str_col", NativeTypes.stringOf(4), "bigint_col", NativeTypes.INT64) diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/IndexSearchBoundsPlannerTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/IndexSearchBoundsPlannerTest.java index 387ef39762f..211edd187e8 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/IndexSearchBoundsPlannerTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/IndexSearchBoundsPlannerTest.java @@ -420,7 +420,7 @@ public void testBoundsComplex() throws Exception { assertBounds("SELECT * FROM TEST WHERE C1 = 1 AND C2 > SUBSTRING(?::VARCHAR, 1, 2) || '3'", List.of("1"), publicSchema, exact(1), - range("||(SUBSTRING(?0, 1, 2), _UTF-8'3')", "null", false, false) + range("||(SUBSTRING(CAST(?0):VARCHAR CHARACTER SET \"UTF-8\", 1, 2), _UTF-8'3')", "null", false, false) ); assertBounds("SELECT * FROM TEST WHERE C1 = 1 AND C2 > SUBSTRING(C3::VARCHAR, 1, 2) || '3'", @@ -563,8 +563,8 @@ private static Stream numericsInBounds() { arguments(sqlType(SqlTypeName.BIGINT), "CAST(42 AS INTEGER)", "42:BIGINT", sqlType(SqlTypeName.BIGINT)), arguments(sqlType(SqlTypeName.BIGINT), "CAST(42 AS BIGINT)", "42:BIGINT", sqlType(SqlTypeName.BIGINT)), - arguments(sqlType(SqlTypeName.REAL), "42", "42:REAL", sqlType(SqlTypeName.REAL)), - arguments(sqlType(SqlTypeName.DOUBLE), "42", "42:DOUBLE", sqlType(SqlTypeName.DOUBLE)) + arguments(sqlType(SqlTypeName.REAL), "42", "42.0E0:REAL", sqlType(SqlTypeName.REAL)), + arguments(sqlType(SqlTypeName.DOUBLE), "42", "42.0E0:DOUBLE", sqlType(SqlTypeName.DOUBLE)) // TODO https://issues.apache.org/jira/browse/IGNITE-19881 uncomment after this issue is fixed // The optimizer selects TableScan instead of a IndexScan (Real/double columns) diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PartitionPruningMetadataTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PartitionPruningMetadataTest.java index a1cd300c1ba..0816a751978 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PartitionPruningMetadataTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PartitionPruningMetadataTest.java @@ -158,12 +158,14 @@ enum TestCaseBasicInsert { // meta is compiled partially from Project rel and partially from single tuple Values rel CASE_5l("t SELECT 10, x, x FROM (VALUES (1)) as s(x)", TABLE_C1_C2, "[c1=10, c2=1]"), // supposed to be similar, but because of explicit cast all expressions are taken from Project rel - CASE_5dp("t SELECT ?, x, x FROM (VALUES (?::INT)) as s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]"), + // https://issues.apache.org/jira/browse/IGNITE-23859 Investigate possibility to remove cast + // CASE_5dp("t SELECT ?, x, x FROM (VALUES (?::INT)) as s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]"), // meta is compiled partially from Project rel and partially from multi-tuple Values rel CASE_6l("t SELECT 10, x, x FROM (VALUES (1), (2)) as s(x)", TABLE_C1_C2, "[c1=10, c2=1]", "[c1=10, c2=2]"), // supposed to be similar, but because of explicit cast all expressions are taken from Project rel. Also plan contains UnionAll rel - CASE_6dp("t SELECT ?, x, x FROM (VALUES (?::INT), (?::INT)) as s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]", "[c1=?0, c2=?2]"), + // https://issues.apache.org/jira/browse/IGNITE-23859 Investigate possibility to remove cast + // CASE_6dp("t SELECT ?, x, x FROM (VALUES (?::INT), (?::INT)) as s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]", "[c1=?0, c2=?2]"), // simple plan with explicit UnionAll rel CASE_7l("t SELECT 1, 10 UNION ALL SELECT 2, 20", TABLE_C1, "[c1=1]", "[c1=2]"), @@ -172,16 +174,19 @@ enum TestCaseBasicInsert { // UnionAll rel with project on top. Meta is compiled partially from project on top, partially from every input of UnionAll rel CASE_8l("t SELECT 10, x, x FROM (SELECT 1 UNION ALL SELECT 2) s(x)", TABLE_C1_C2, "[c1=10, c2=1]", "[c1=10, c2=2]"), // supposed to be similar, but because of explicit cast all expressions are taken from Project rel - CASE_8dp("t SELECT ?, x, x FROM (SELECT ?::INT UNION ALL SELECT ?::INT) s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]", "[c1=?0, c2=?2]"), + // https://issues.apache.org/jira/browse/IGNITE-23859 Investigate possibility to remove cast + // CASE_8dp("t SELECT ?, x, x FROM (SELECT ?::INT UNION ALL SELECT ?::INT) s(x)", TABLE_C1_C2, "[c1=?0, c2=?1]", "[c1=?0, c2=?2]"), // mixed case, where only one branch contains additional projection - CASE_9l_dp("t SELECT ?, x, x FROM (SELECT 1 UNION ALL SELECT ?::INT) s(x)", TABLE_C1_C2, "[c1=?0, c2=1]", "[c1=?0, c2=?1]"), + // https://issues.apache.org/jira/browse/IGNITE-23859 Investigate possibility to remove cast + // CASE_9l_dp("t SELECT ?, x, x FROM (SELECT 1 UNION ALL SELECT ?::INT) s(x)", TABLE_C1_C2, "[c1=?0, c2=1]", "[c1=?0, c2=?1]"), // one of the UnionAll branches contains ALWAYS FALSE predicate, thus must be ignored CASE_10l("t SELECT x, x FROM (SELECT 1 UNION ALL SELECT 2 FROM (VALUES (0)) WHERE FALSE UNION ALL SELECT 3) s(x)", TABLE_C1, "[c1=1]", "[c1=3]"), - CASE_10dp("t SELECT x, x FROM (SELECT ?::INT UNION ALL SELECT ?::INT FROM (VALUES (0)) WHERE FALSE UNION ALL SELECT ?::INT) s(x)", - TABLE_C1, "[c1=?0]", "[c1=?2]"), + // https://issues.apache.org/jira/browse/IGNITE-23859 Investigate possibility to remove cast + // CASE_10dp("t SELECT x, x FROM (SELECT ?::INT UNION ALL SELECT ?::INT FROM (VALUES (0)) WHERE FALSE UNION ALL " + // + "SELECT ?::INT) s(x)", TABLE_C1, "[c1=?0]", "[c1=?2]"), // single tuple insert with explicit cast CASE_12("t VALUES ('1'::smallint, 10)", TABLE_C1, "[c1=1]"), diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInTypeCoercionTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInTypeCoercionTest.java index 2231b64d7d8..339580ca7b0 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInTypeCoercionTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInTypeCoercionTest.java @@ -106,74 +106,546 @@ private static Stream lhsNonDecimal() { Arguments.of( NumericPair.TINYINT_DECIMAL_1_0, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0) ), Arguments.of( NumericPair.TINYINT_DECIMAL_2_0, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0), + castTo(Types.DECIMAL_3_0) ), Arguments.of( NumericPair.TINYINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1), + castTo(Types.DECIMAL_4_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3) ), Arguments.of( NumericPair.TINYINT_DECIMAL_5_0, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + ofTypeWithoutCast(Types.DECIMAL_5_0) ), Arguments.of( NumericPair.TINYINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3), + castTo(Types.DECIMAL_6_3) ), Arguments.of( NumericPair.TINYINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_8_3, + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) + ), + + // SMALLINT + + Arguments.of( + NumericPair.SMALLINT_SMALLINT, + ofTypeWithoutCast(NativeTypes.INT16), + ofTypeWithoutCast(NativeTypes.INT16), + ofTypeWithoutCast(NativeTypes.INT16), + ofTypeWithoutCast(NativeTypes.INT16) + ), + + Arguments.of( + NumericPair.SMALLINT_INT, + castTo(NativeTypes.INT32), + castTo(NativeTypes.INT32), + castTo(NativeTypes.INT32), + ofTypeWithoutCast(NativeTypes.INT32) + ), + + Arguments.of( + NumericPair.SMALLINT_REAL, + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT) + ), + + Arguments.of( + NumericPair.SMALLINT_DOUBLE, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ), + + Arguments.of( + NumericPair.SMALLINT_BIGINT, + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_1_0, + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_2_0, + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_2_1, + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_3_1, + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_4_3, + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_5_0, + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + ofTypeWithoutCast(Types.DECIMAL_5_0) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_5_3, + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_6_1, + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + ofTypeWithoutCast(Types.DECIMAL_6_1) + ), + + Arguments.of( + NumericPair.SMALLINT_DECIMAL_8_3, + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) + ), + + // INT + + Arguments.of( + NumericPair.INT_INT, + ofTypeWithoutCast(NativeTypes.INT32), + ofTypeWithoutCast(NativeTypes.INT32), + ofTypeWithoutCast(NativeTypes.INT32), + ofTypeWithoutCast(NativeTypes.INT32) + ), + + Arguments.of( + NumericPair.INT_REAL, + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT) + ), + + Arguments.of( + NumericPair.INT_DOUBLE, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ), + + Arguments.of( + NumericPair.INT_BIGINT, + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_1_0, + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_2_0, + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_2_1, + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_3_1, + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_4_3, + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_5_0, + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0), + castTo(Types.DECIMAL_10_0) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_5_3, + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_6_1, + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1), + castTo(Types.DECIMAL_11_1) + ), + + Arguments.of( + NumericPair.INT_DECIMAL_8_3, + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3), + castTo(Types.DECIMAL_13_3) + ), + + // BIGINT + + Arguments.of( + NumericPair.BIGINT_REAL, + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT) + ), + + Arguments.of( + NumericPair.BIGINT_DOUBLE, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ), + + Arguments.of( + NumericPair.BIGINT_BIGINT, + ofTypeWithoutCast(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_1_0, + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_2_0, + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_2_1, + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_3_1, + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_4_3, + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_5_0, + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0), + castTo(Types.DECIMAL_19_0) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_5_3, + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_6_1, + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1), + castTo(Types.DECIMAL_20_1) + ), + + Arguments.of( + NumericPair.BIGINT_DECIMAL_8_3, + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3), + castTo(Types.DECIMAL_22_3) + ), + + // REAL + + Arguments.of( + NumericPair.REAL_REAL, + ofTypeWithoutCast(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT) + ), + + Arguments.of( + NumericPair.REAL_DOUBLE, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ), + + // DOUBLE + + Arguments.of( + NumericPair.DOUBLE_DOUBLE, + ofTypeWithoutCast(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ) + + ); + } + + private static Stream rhsNonDecimal() { + return Stream.of( + // TINYINT + + Arguments.of( + NumericPair.TINYINT_TINYINT, ofTypeWithoutCast(NativeTypes.INT8), ofTypeWithoutCast(NativeTypes.INT8), ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + ofTypeWithoutCast(NativeTypes.INT8) + ), + Arguments.of( + NumericPair.TINYINT_SMALLINT, + castTo(NativeTypes.INT16), + castTo(NativeTypes.INT16), + castTo(NativeTypes.INT16), + ofTypeWithoutCast(NativeTypes.INT16) + ), + + Arguments.of( + NumericPair.TINYINT_INT, + castTo(NativeTypes.INT32), + castTo(NativeTypes.INT32), + castTo(NativeTypes.INT32), + ofTypeWithoutCast(NativeTypes.INT32) + ), + + Arguments.of( + NumericPair.TINYINT_REAL, + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + castTo(NativeTypes.FLOAT), + ofTypeWithoutCast(NativeTypes.FLOAT) + ), + + Arguments.of( + NumericPair.TINYINT_DOUBLE, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) + ), + + Arguments.of( + NumericPair.TINYINT_BIGINT, + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + castTo(NativeTypes.INT64), + ofTypeWithoutCast(NativeTypes.INT64) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_1_0, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_2_0, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_2_1, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_3_1, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_4_3, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_5_0, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_5_3, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_6_1, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) + ), + + Arguments.of( + NumericPair.TINYINT_DECIMAL_8_3, + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), // SMALLINT @@ -220,74 +692,74 @@ private static Stream lhsNonDecimal() { Arguments.of( NumericPair.SMALLINT_DECIMAL_1_0, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_2_0, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_5_0, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), // INT @@ -326,74 +798,74 @@ private static Stream lhsNonDecimal() { Arguments.of( NumericPair.INT_DECIMAL_1_0, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_2_0, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_5_0, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.INT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32), - castTo(NativeTypes.INT32) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), // BIGINT @@ -424,74 +896,74 @@ private static Stream lhsNonDecimal() { Arguments.of( NumericPair.BIGINT_DECIMAL_1_0, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_2_0, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_5_0, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.BIGINT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64), - castTo(NativeTypes.INT64) + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + castTo(DECIMAL_DYN_PARAM_DEFAULT), + ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), // REAL @@ -521,7 +993,6 @@ private static Stream lhsNonDecimal() { ofTypeWithoutCast(NativeTypes.DOUBLE), ofTypeWithoutCast(NativeTypes.DOUBLE) ) - ); } @@ -534,18 +1005,18 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_1_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -558,65 +1029,65 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_2_0), ofTypeWithoutCast(Types.DECIMAL_2_0) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_2_1), ofTypeWithoutCast(Types.DECIMAL_2_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_4_3), ofTypeWithoutCast(Types.DECIMAL_4_3) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), ofTypeWithoutCast(Types.DECIMAL_5_0) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -624,18 +1095,18 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_2_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -648,41 +1119,41 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_5_0), ofTypeWithoutCast(Types.DECIMAL_5_0) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -690,26 +1161,26 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_2_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1) ), Arguments.of( @@ -722,49 +1193,49 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_4_3), ofTypeWithoutCast(Types.DECIMAL_4_3) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -772,34 +1243,34 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_4_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3) ), Arguments.of( @@ -812,52 +1283,52 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), // DECIMAL (3, 1) Arguments.of( - NumericPair.DECIMAL_3_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + NumericPair.DECIMAL_3_1_REAL, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -870,33 +1341,33 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -904,18 +1375,18 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_5_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -928,17 +1399,17 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -946,26 +1417,26 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_5_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) ), Arguments.of( @@ -978,17 +1449,17 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -996,18 +1467,18 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_6_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -1020,9 +1491,9 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -1030,18 +1501,18 @@ private static Stream inOperandsAllColumns() { Arguments.of( NumericPair.DECIMAL_8_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -1096,89 +1567,89 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_1_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_1_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1186,65 +1657,65 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_2_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1252,81 +1723,81 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_2_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1334,73 +1805,73 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_4_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1408,57 +1879,57 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_3_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1466,41 +1937,41 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_5_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1508,49 +1979,49 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_5_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1558,33 +2029,33 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_6_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ), @@ -1592,31 +2063,31 @@ private static Stream inOperandsDynamicParamsRhs() { Arguments.of( NumericPair.DECIMAL_8_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_8_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT) ) ); return Stream.concat( - lhsNonDecimal(), + rhsNonDecimal(), decimals ); } @@ -1663,522 +2134,522 @@ private static Stream inOperandsDynamicParamLhs() { Arguments.of( NumericPair.DECIMAL_1_0_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_1_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_3_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_4_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (2, 0) Arguments.of( NumericPair.DECIMAL_2_0_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_2_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_3_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (2,1) Arguments.of( NumericPair.DECIMAL_2_1_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_3_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_4_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (3,1) Arguments.of( NumericPair.DECIMAL_3_1_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_3_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (4,3) Arguments.of( NumericPair.DECIMAL_4_3_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_2_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_3_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_4_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (5,0) - Arguments.of( - NumericPair.DECIMAL_5_0_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + Arguments.of( + NumericPair.DECIMAL_5_0_REAL, + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (5,3) Arguments.of( NumericPair.DECIMAL_5_3_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_0, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (6,1) Arguments.of( NumericPair.DECIMAL_6_1_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_6_1, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ), // DECIMAL (8,3) Arguments.of( NumericPair.DECIMAL_8_3_REAL, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DOUBLE, - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), - ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - castTo(DECIMAL_DYN_PARAM_DEFAULT) + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DECIMAL_8_3, ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3), + castTo(DECIMAL_DYN_PARAM_DEFAULT), ofTypeWithoutCast(DECIMAL_DYN_PARAM_DEFAULT), - ofTypeWithoutCast(Types.DECIMAL_8_3) + castTo(DECIMAL_DYN_PARAM_DEFAULT) ) ); return Stream.concat( @@ -2311,20 +2782,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.TINYINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8) + castTo(Types.DECIMAL_3_1), + ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8) + castTo(Types.DECIMAL_3_1), + ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8) + castTo(Types.DECIMAL_4_3), + ofTypeWithoutCast(Types.DECIMAL_4_3) ), Arguments.of( @@ -2335,20 +2806,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.TINYINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT8), - ofTypeWithoutCast(NativeTypes.INT8) + castTo(Types.DECIMAL_5_3), + ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.TINYINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_6_1), + ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.TINYINT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT8), - castTo(NativeTypes.INT8) + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) ), // SMALLINT @@ -2397,20 +2868,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.SMALLINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16) + castTo(Types.DECIMAL_5_1), + ofTypeWithoutCast(Types.DECIMAL_5_1) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16) + castTo(Types.DECIMAL_5_1), + ofTypeWithoutCast(Types.DECIMAL_5_1) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16) + castTo(Types.DECIMAL_5_3), + ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( @@ -2421,20 +2892,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.SMALLINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT16), - ofTypeWithoutCast(NativeTypes.INT16) + castTo(Types.DECIMAL_5_3), + ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(Types.DECIMAL_6_1), + ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.SMALLINT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT16), - castTo(NativeTypes.INT16) + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) ), // INT @@ -2477,20 +2948,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.INT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( NumericPair.INT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( NumericPair.INT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), Arguments.of( @@ -2501,20 +2972,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.INT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), Arguments.of( NumericPair.INT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( NumericPair.INT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT32), - ofTypeWithoutCast(NativeTypes.INT32) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), // BIGINT @@ -2551,20 +3022,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.BIGINT_DECIMAL_2_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_1), + ofTypeWithoutCast(Types.DECIMAL_19_1) ), Arguments.of( NumericPair.BIGINT_DECIMAL_3_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_1), + ofTypeWithoutCast(Types.DECIMAL_19_1) ), Arguments.of( NumericPair.BIGINT_DECIMAL_4_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_3), + ofTypeWithoutCast(Types.DECIMAL_19_3) ), Arguments.of( @@ -2575,20 +3046,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.BIGINT_DECIMAL_5_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_3), + ofTypeWithoutCast(Types.DECIMAL_19_3) ), Arguments.of( NumericPair.BIGINT_DECIMAL_6_1, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_1), + ofTypeWithoutCast(Types.DECIMAL_19_1) ), Arguments.of( NumericPair.BIGINT_DECIMAL_8_3, - ofTypeWithoutCast(NativeTypes.INT64), - ofTypeWithoutCast(NativeTypes.INT64) + castTo(Types.DECIMAL_19_3), + ofTypeWithoutCast(Types.DECIMAL_19_3) ), // REAL @@ -2617,67 +3088,67 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_1_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_1_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), - ofTypeWithoutCast(Types.DECIMAL_1_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_2_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_2_1), ofTypeWithoutCast(Types.DECIMAL_2_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_4_3), ofTypeWithoutCast(Types.DECIMAL_4_3) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_1_0), - castTo(Types.DECIMAL_1_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_1_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_1_0), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2685,49 +3156,49 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_2_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_2_0), - ofTypeWithoutCast(Types.DECIMAL_2_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_0), - castTo(Types.DECIMAL_2_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_2_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_0), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2735,20 +3206,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_2_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( @@ -2759,37 +3230,37 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_3_1), ofTypeWithoutCast(Types.DECIMAL_3_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_4_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_4_3), ofTypeWithoutCast(Types.DECIMAL_4_3) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_2_1), - castTo(Types.DECIMAL_2_1) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_2_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_2_1), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2797,14 +3268,14 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_3_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_3_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -2815,25 +3286,25 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_3_1), - castTo(Types.DECIMAL_3_1) + castTo(Types.DECIMAL_10_1), + ofTypeWithoutCast(Types.DECIMAL_10_1) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_3_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_3_1), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2841,26 +3312,26 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_4_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_2_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_3_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_3_1) + castTo(Types.DECIMAL_5_3), + ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( @@ -2871,25 +3342,25 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_4_3), - castTo(Types.DECIMAL_4_3) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_5_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_5_3), ofTypeWithoutCast(Types.DECIMAL_5_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_4_3), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) ), Arguments.of( NumericPair.DECIMAL_4_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_4_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2897,31 +3368,31 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_5_0_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_0), - castTo(Types.DECIMAL_5_0) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_5_0), - ofTypeWithoutCast(Types.DECIMAL_5_0) + castTo(Types.DECIMAL_10_0), + ofTypeWithoutCast(Types.DECIMAL_10_0) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_6_1), ofTypeWithoutCast(Types.DECIMAL_6_1) ), Arguments.of( NumericPair.DECIMAL_5_0_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_0), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2929,20 +3400,20 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_5_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_5_0, - ofTypeWithoutCast(Types.DECIMAL_5_3), - castTo(Types.DECIMAL_5_3) + castTo(Types.DECIMAL_10_3), + ofTypeWithoutCast(Types.DECIMAL_10_3) ), Arguments.of( @@ -2953,13 +3424,13 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_6_1, - ofTypeWithoutCast(Types.DECIMAL_5_3), - ofTypeWithoutCast(Types.DECIMAL_6_1) + castTo(Types.DECIMAL_8_3), + ofTypeWithoutCast(Types.DECIMAL_8_3) ), Arguments.of( NumericPair.DECIMAL_5_3_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_5_3), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2967,14 +3438,14 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_6_1_REAL, - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_6_1_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_6_1), - castTo(Types.DECIMAL_6_1) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( @@ -2985,7 +3456,7 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_6_1_DECIMAL_8_3, - ofTypeWithoutCast(Types.DECIMAL_6_1), + castTo(Types.DECIMAL_8_3), ofTypeWithoutCast(Types.DECIMAL_8_3) ), @@ -2993,14 +3464,14 @@ private static Stream inOperandsLiterals() { Arguments.of( NumericPair.DECIMAL_8_3_REAL, - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( NumericPair.DECIMAL_8_3_DOUBLE, - ofTypeWithoutCast(Types.DECIMAL_8_3), - castTo(Types.DECIMAL_8_3) + castTo(NativeTypes.DOUBLE), + ofTypeWithoutCast(NativeTypes.DOUBLE) ), Arguments.of( diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInsertSourcesCoercionTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInsertSourcesCoercionTest.java index 8e175e6bbd2..01f62a7161a 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInsertSourcesCoercionTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInsertSourcesCoercionTest.java @@ -276,10 +276,10 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), + .opMatches(castTo(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_4_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), + .opMatches(castTo(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_0) .opMatches(castTo(Types.DECIMAL_1_0)), @@ -309,7 +309,7 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_1)), forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_4_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_1)), + .opMatches(castTo(Types.DECIMAL_2_1)), forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_2_0) .opMatches(castTo(Types.DECIMAL_2_1)), @@ -366,10 +366,10 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_3_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), + .opMatches(castTo(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), + .opMatches(castTo(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_0) .opMatches(castTo(Types.DECIMAL_2_0)), @@ -390,7 +390,7 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_3_1)), forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_3_1)), + .opMatches(castTo(Types.DECIMAL_3_1)), forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_0) .opMatches(castTo(Types.DECIMAL_3_1)), @@ -429,10 +429,10 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_6_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), + .opMatches(castTo(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_8_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), + .opMatches(castTo(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_REAL) .opMatches(castTo(Types.DECIMAL_5_0)), @@ -444,7 +444,7 @@ private static Stream args() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_6_1)), forTypePair(NumericPair.DECIMAL_6_1_DECIMAL_8_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_6_1)), + .opMatches(castTo(Types.DECIMAL_6_1)), forTypePair(NumericPair.DECIMAL_6_1_REAL) .opMatches(castTo(Types.DECIMAL_6_1)), diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericUpdateSourcesCoercionTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericUpdateSourcesCoercionTest.java index b1af01cb973..1e84ba4ec5e 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericUpdateSourcesCoercionTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericUpdateSourcesCoercionTest.java @@ -287,10 +287,10 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), + .opMatches(castTo(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_4_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)), + .opMatches(castTo(Types.DECIMAL_1_0)), forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_0) .opMatches(castTo(Types.DECIMAL_1_0)), @@ -320,7 +320,7 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_1)), forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_4_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_1)), + .opMatches(castTo(Types.DECIMAL_2_1)), forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_2_0) .opMatches(castTo(Types.DECIMAL_2_1)), @@ -377,10 +377,10 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_3_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), + .opMatches(castTo(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)), + .opMatches(castTo(Types.DECIMAL_2_0)), forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_0) .opMatches(castTo(Types.DECIMAL_2_0)), @@ -401,7 +401,7 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_3_1)), forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_3_1)), + .opMatches(castTo(Types.DECIMAL_3_1)), forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_0) .opMatches(castTo(Types.DECIMAL_3_1)), @@ -440,10 +440,10 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_6_1) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), + .opMatches(castTo(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_8_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)), + .opMatches(castTo(Types.DECIMAL_5_0)), forTypePair(NumericPair.DECIMAL_5_0_REAL) .opMatches(castTo(Types.DECIMAL_5_0)), @@ -455,7 +455,7 @@ private static Stream argsForUpdateWithLiteralValue() { .opMatches(ofTypeWithoutCast(Types.DECIMAL_6_1)), forTypePair(NumericPair.DECIMAL_6_1_DECIMAL_8_3) - .opMatches(ofTypeWithoutCast(Types.DECIMAL_6_1)), + .opMatches(castTo(Types.DECIMAL_6_1)), forTypePair(NumericPair.DECIMAL_6_1_REAL) .opMatches(castTo(Types.DECIMAL_6_1)), diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/Types.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/Types.java index 45f0907f01b..6452f4a51e8 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/Types.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/Types.java @@ -74,6 +74,7 @@ public final class Types { public static final NativeType DECIMAL_9_7 = NativeTypes.decimalOf(9, 7); public static final NativeType DECIMAL_10_0 = NativeTypes.decimalOf(10, 0); + public static final NativeType DECIMAL_10_1 = NativeTypes.decimalOf(10, 1); public static final NativeType DECIMAL_10_3 = NativeTypes.decimalOf(10, 3); public static final NativeType DECIMAL_10_4 = NativeTypes.decimalOf(10, 4); public static final NativeType DECIMAL_10_6 = NativeTypes.decimalOf(10, 6); @@ -135,6 +136,8 @@ public final class Types { public static final NativeType DECIMAL_18_16 = NativeTypes.decimalOf(18, 16); public static final NativeType DECIMAL_19_0 = NativeTypes.decimalOf(19, 0); + public static final NativeType DECIMAL_19_1 = NativeTypes.decimalOf(19, 1); + public static final NativeType DECIMAL_19_3 = NativeTypes.decimalOf(19, 3); public static final NativeType DECIMAL_19_6 = NativeTypes.decimalOf(19, 6); public static final NativeType DECIMAL_19_16 = NativeTypes.decimalOf(19, 16); diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/SqlReservedWordsTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/SqlReservedWordsTest.java index 11c022afed7..5f0f36c5505 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/SqlReservedWordsTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/SqlReservedWordsTest.java @@ -40,6 +40,7 @@ public class SqlReservedWordsTest extends AbstractParserTest { "ARRAY", "ARRAY_MAX_CARDINALITY", "AS", + "ASOF", "ASYMMETRIC", // BETWEEN ASYMMETRIC .. AND .. "AVG", "BETWEEN", @@ -133,8 +134,10 @@ public class SqlReservedWordsTest extends AbstractParserTest { "LOCALTIME", "LOCALTIMESTAMP", "LOWER", + "MATCH_CONDITION", "MATCH_RECOGNIZE", "MAX", + "MEASURE", "MERGE", "MIN", "MINUS",