This is an automated email from the ASF dual-hosted git repository.

zstan pushed a commit to branch ignite-22580
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit bd412c89561d1bea922c4ad9e857b91d21dd14d8
Author: zstan <[email protected]>
AuthorDate: Wed Jul 24 18:05:07 2024 +0300

    fix
---
 .../sql/engine/planner/AbstractPlannerTest.java    |   2 +-
 .../planner/datatypes/BaseTypeCoercionTest.java    |   1 +
 .../NumericBinaryOperationsTypeCoercionTest.java   |  38 +-
 .../datatypes/NumericCaseTypeCoercionTest.java     | 968 +++++++++++++++++++++
 4 files changed, 1007 insertions(+), 2 deletions(-)

diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
index cda82a9994..ab0e98045f 100644
--- 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
@@ -501,7 +501,7 @@ public abstract class AbstractPlannerTest extends 
IgniteAbstractTest {
         String planString = RelOptUtil.dumpPlan("", plan, 
SqlExplainFormat.TEXT, DEFAULT_EXPLAIN_LEVEL);
         log.info("statement: {}\n{}", sql, planString);
 
-        checkSplitAndSerialization(plan, schemas);
+        //checkSplitAndSerialization(plan, schemas);
 
         try {
             if (predicate.test((T) plan)) {
diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/BaseTypeCoercionTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/BaseTypeCoercionTest.java
index cd4f4baf47..f05fe40d66 100644
--- 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/BaseTypeCoercionTest.java
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/BaseTypeCoercionTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.instanceOf;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.stream.Stream;
 import org.apache.calcite.rel.type.RelDataType;
diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericBinaryOperationsTypeCoercionTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericBinaryOperationsTypeCoercionTest.java
index 1de4596f56..65dc202f62 100644
--- 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericBinaryOperationsTypeCoercionTest.java
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericBinaryOperationsTypeCoercionTest.java
@@ -17,13 +17,21 @@
 
 package org.apache.ignite.internal.sql.engine.planner.datatypes;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
 import java.util.List;
 import java.util.stream.Stream;
+import org.apache.calcite.rex.RexCall;
 import org.apache.calcite.rex.RexNode;
 import 
org.apache.ignite.internal.sql.engine.planner.datatypes.utils.NumericPair;
 import org.apache.ignite.internal.sql.engine.planner.datatypes.utils.TypePair;
 import org.apache.ignite.internal.sql.engine.planner.datatypes.utils.Types;
+import org.apache.ignite.internal.sql.engine.rel.IgniteRel;
+import 
org.apache.ignite.internal.sql.engine.rel.ProjectableFilterableTableScan;
 import org.apache.ignite.internal.sql.engine.schema.IgniteSchema;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -59,7 +67,35 @@ public class NumericBinaryOperationsTypeCoercionTest extends 
BaseTypeCoercionTes
         Matcher<RexNode> first = ofTypeWithoutCast(pair.first());
         Matcher<RexNode> second = ofTypeWithoutCast(pair.second());
 
-        assertPlan("SELECT CASE WHEN c1>(SELECT avg(c1) FROM t) THEN c1 ELSE 
c2 END FROM t", schema, operandMatcher(first, second)::matches, List.of());
+        //assertPlan("SELECT CASE WHEN c1>(SELECT avg(c1) FROM t) THEN c1 ELSE 
c2 END FROM t", schema, operandMatcher(first, second)::matches, List.of());
+        //assertPlan("SELECT CASE WHEN EXISTS(SELECT c1 FROM t) THEN c1 ELSE 
c2 END FROM t", schema, operandMatcher(first, second)::matches, List.of());
+        assertPlan("SELECT CASE WHEN RAND_UUID() != RAND_UUID() THEN c1 ELSE 
c2 END FROM t", schema, operandCaseMatcher(first, second)::matches, List.of());
+    }
+
+    static Matcher<IgniteRel> operandCaseMatcher(Matcher<RexNode> first, 
Matcher<RexNode> second) {
+        return new BaseMatcher<>() {
+            @Override
+            public boolean matches(Object actual) {
+                RexNode comparison = ((ProjectableFilterableTableScan) 
actual).projects().get(0);
+
+                assertThat(comparison, instanceOf(RexCall.class));
+
+                RexCall comparisonCall = (RexCall) comparison;
+
+                RexNode leftOperand = comparisonCall.getOperands().get(1);
+                RexNode rightOperand = comparisonCall.getOperands().get(2);
+
+                assertThat(leftOperand, first);
+                assertThat(rightOperand, second);
+
+                return true;
+            }
+
+            @Override
+            public void describeTo(Description description) {
+
+            }
+        };
     }
 
     // No any type changes for `subtraction` operation from planner 
perspective.
diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericCaseTypeCoercionTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericCaseTypeCoercionTest.java
new file mode 100644
index 0000000000..067dec05b8
--- /dev/null
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericCaseTypeCoercionTest.java
@@ -0,0 +1,968 @@
+package org.apache.ignite.internal.sql.engine.planner.datatypes;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+import 
org.apache.ignite.internal.sql.engine.planner.datatypes.utils.NumericPair;
+import org.apache.ignite.internal.sql.engine.planner.datatypes.utils.TypePair;
+import org.apache.ignite.internal.sql.engine.planner.datatypes.utils.Types;
+import org.apache.ignite.internal.sql.engine.rel.IgniteRel;
+import 
org.apache.ignite.internal.sql.engine.rel.ProjectableFilterableTableScan;
+import org.apache.ignite.internal.sql.engine.schema.IgniteSchema;
+import org.apache.ignite.internal.sql.engine.util.SqlTestUtils;
+import org.apache.ignite.internal.type.NativeType;
+import org.apache.ignite.internal.type.NativeTypeSpec;
+import org.apache.ignite.internal.type.NativeTypes;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.jetbrains.annotations.Nullable;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class NumericCaseTypeCoercionTest extends BaseTypeCoercionTest {
+    private static final IgniteSchema SCHEMA = 
createSchemaWithTwoColumnTable(NativeTypes.STRING, NativeTypes.STRING);
+
+    @ParameterizedTest
+    @MethodSource("caseArgs")
+    public void numericCoercion(
+            TypePair typePair,
+            Matcher<RexNode> firstOperandMatcher,
+            Matcher<RexNode> secondOperandMatcher
+    ) throws Exception {
+        IgniteSchema schema = createSchemaWithTwoColumnTable(typePair.first(), 
typePair.second());
+
+        assertPlan("SELECT CASE WHEN RAND_UUID() != RAND_UUID() THEN c1 ELSE 
c2 END FROM t", schema,
+                operandCaseMatcher(firstOperandMatcher, 
secondOperandMatcher)::matches, List.of());
+    }
+
+    @ParameterizedTest
+    @MethodSource("caseArgs")
+    public void numericWithDynamicParamsCoercion(
+            TypePair typePair,
+            Matcher<RexNode> firstOperandMatcher,
+            Matcher<RexNode> secondOperandMatcher
+    ) throws Exception {
+        List<Object> params = List.of(
+                
SqlTestUtils.generateValueByType(typePair.first().spec().asColumnType()),
+                
SqlTestUtils.generateValueByType(typePair.second().spec().asColumnType())
+        );
+
+        System.err.println("!!params: " + params.get(0) + " " + params.get(1));
+
+        assertPlan("SELECT CASE WHEN RAND_UUID() != RAND_UUID() THEN ? ELSE ? 
END FROM t", SCHEMA,
+                operandCaseMatcher(firstOperandMatcher, 
secondOperandMatcher)::matches, params);
+    }
+
+    @ParameterizedTest
+    @MethodSource("literalArgs")
+    public void numericWithLiteralsCoercion(
+            TypePair typePair,
+            Matcher<RexNode> firstOperandMatcher,
+            Matcher<RexNode> secondOperandMatcher
+    ) throws Exception {
+        List<Object> params = List.of(
+                
//SqlTestUtils.generateValueByType(typePair.first().spec().asColumnType()),
+                
//SqlTestUtils.generateValueByType(typePair.second().spec().asColumnType())
+                generateValueByType(typePair.first()), 
generateValueByType(typePair.second())
+        );
+
+        System.err.println("!!params: " + params.get(0) + " " + params.get(1));
+
+        assertPlan(format("SELECT CASE WHEN RAND_UUID() != RAND_UUID() THEN {} 
ELSE {} END FROM t", params.get(0), params.get(1)),
+                SCHEMA, operandCaseMatcher(firstOperandMatcher, 
secondOperandMatcher)::matches, List.of());
+    }
+
+    private static @Nullable Object generateValueByType(NativeType type) {
+        if (type.equals(NativeTypes.INT8) || type.equals(NativeTypes.INT16) || 
type.equals(NativeTypes.INT32)
+                || type.equals(NativeTypes.INT64)) {
+            return 
SqlTestUtils.generateValueByType(type.spec().asColumnType());
+        } else if (type.equals(Types.DECIMAL_1_0)) {
+            return 1;
+        } else if (type.equals(Types.DECIMAL_2_1)) {
+            return 2.1;
+        } else if (type.equals(Types.DECIMAL_4_3)) {
+            return 4.321;
+        } else {
+            return 
SqlTestUtils.generateValueByType(type.spec().asColumnType());
+        }
+    }
+
+    static Matcher<IgniteRel> operandCaseMatcher(Matcher<RexNode> first, 
Matcher<RexNode> second) {
+        return new BaseMatcher<>() {
+            @Override
+            public boolean matches(Object actual) {
+                RexNode comparison = ((ProjectableFilterableTableScan) 
actual).projects().get(0);
+
+                assertThat(comparison, instanceOf(RexCall.class));
+
+                RexCall comparisonCall = (RexCall) comparison;
+
+                RexNode firstOperand = comparisonCall.getOperands().get(1);
+                RexNode secondOperand = comparisonCall.getOperands().get(2);
+
+                assertThat("first", firstOperand, first);
+                assertThat("second", secondOperand, second);
+
+                return true;
+            }
+
+            @Override
+            public void describeTo(Description description) {
+
+            }
+        };
+    }
+
+    private static Stream<Arguments> literalArgs() {
+        return Stream.of(
+/*                forTypePair(NumericPair.TINYINT_TINYINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.TINYINT_SMALLINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.TINYINT_INT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_BIGINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_1_0)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_2_1)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_4_3)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.TINYINT_REAL)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        
.secondOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.TINYINT_DOUBLE)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.SMALLINT_SMALLINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.SMALLINT_INT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_BIGINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_1_0)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_2_1)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_4_3)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.SMALLINT_REAL)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        
.secondOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.SMALLINT_DOUBLE)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.INT_INT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.INT_BIGINT)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.INT_DECIMAL_1_0)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.INT32))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT32)),
+
+                forTypePair(NumericPair.INT_DECIMAL_2_1)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.INT_DECIMAL_4_3)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.INT_REAL)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        
.secondOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.INT_DOUBLE)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.BIGINT_BIGINT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_1_0)
+                        .firstOpBeSame()
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.INT64)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_2_1)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_20_1))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_20_1)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_4_3)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_22_3))
+                        
.secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_22_3)),
+
+                forTypePair(NumericPair.BIGINT_REAL)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        
.secondOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.BIGINT_DOUBLE)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),*/
+
+
+                forTypePair(NumericPair.REAL_REAL)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.REAL_DOUBLE)
+                        .firstOpMatches(ofTypeWithoutCast(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DOUBLE_DOUBLE)
+                        .firstOpBeSame()
+                        .secondOpBeSame()
+        );
+    }
+
+    private static Stream<Arguments> caseArgs() {
+        return Stream.of(
+                forTypePair(NumericPair.TINYINT_TINYINT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_SMALLINT)
+                        .firstOpMatches(castTo(NativeTypes.INT16))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_INT)
+                        .firstOpMatches(castTo(NativeTypes.INT32))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_BIGINT)
+                        .firstOpMatches(castTo(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_NUMBER_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_0)),
+
+                forTypePair(NumericPair.TINYINT_NUMBER_2)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_0)),
+
+                forTypePair(NumericPair.TINYINT_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_1_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_0)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_4_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_4_1)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_3)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_0)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_4_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_4_1)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_3)),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.TINYINT_REAL)
+                        .firstOpMatches(castTo(NativeTypes.FLOAT))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.FLOAT)),
+
+                forTypePair(NumericPair.TINYINT_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.SMALLINT_SMALLINT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_INT)
+                        .firstOpMatches(castTo(NativeTypes.INT32))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_BIGINT)
+                        .firstOpMatches(castTo(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_NUMBER_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.SMALLINT_NUMBER_2)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.SMALLINT_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_1_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.SMALLINT_REAL)
+                        .firstOpMatches(castTo(NativeTypes.FLOAT))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.FLOAT)),
+
+                forTypePair(NumericPair.SMALLINT_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.INT_INT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.INT_BIGINT)
+                        .firstOpMatches(castTo(NativeTypes.INT64))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.INT_NUMBER_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_NUMBER_2)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_DECIMAL_1_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_11_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.INT_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_13_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.INT_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_11_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.INT_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_13_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.INT_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_10_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_10_0)),
+
+                forTypePair(NumericPair.INT_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_11_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_11_1)),
+
+                forTypePair(NumericPair.INT_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_13_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_13_3)),
+
+                forTypePair(NumericPair.INT_REAL)
+                        .firstOpMatches(castTo(NativeTypes.FLOAT))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.FLOAT)),
+
+                forTypePair(NumericPair.INT_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.BIGINT_BIGINT)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.BIGINT_NUMBER_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_NUMBER_2)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_1_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_20_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_20_1)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_22_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_22_3)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_20_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_20_1)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_22_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_22_3)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_19_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_19_0)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_20_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_20_1)),
+
+                forTypePair(NumericPair.BIGINT_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_22_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_22_3)),
+
+                forTypePair(NumericPair.BIGINT_REAL)
+                        .firstOpMatches(castTo(NativeTypes.FLOAT))
+                        .secondOpMatches(ofTypeWithoutCast(NativeTypes.FLOAT)),
+
+                forTypePair(NumericPair.BIGINT_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.NUMBER_1_NUMBER_1)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_NUMBER_2)
+                        .firstOpMatches(castTo(Types.DECIMAL_2_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_2_0)),
+
+                forTypePair(NumericPair.NUMBER_1_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_1_0)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_1_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_1_0)),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_2_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_4_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_2_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_1_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.NUMBER_1_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.NUMBER_2_NUMBER_2)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_NUMBER_5)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_1_0)
+                        .firstOpBeSame()
+                        .secondOpMatches(castTo(Types.DECIMAL_2_0)),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_1)),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_3)),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_2_0)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_2_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_2_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.NUMBER_2_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.NUMBER_5_NUMBER_5)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_1_0)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_2_0)
+                        .firstOpMatches(ofTypeWithoutCast(Types.DECIMAL_5_0))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_0)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_5_0)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_5_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.NUMBER_5_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.NUMBER_5_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_1_0)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_2_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_4_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_2_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_1_0_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_1_0_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_2_1)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_4_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_4_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_3_1)),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_1_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_2_1_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_4_3)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_2_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_3)),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_5_3)),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_4_3_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_4_3_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_2_0)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_3_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_3_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_0))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_2_0_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_2_0_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_3_1)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_5_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpMatches(castTo(Types.DECIMAL_6_1)),
+
+                forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_3_1_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_3_1_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_3_1_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_5_3_DECIMAL_5_3)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_5_3_DECIMAL_5_0)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.DECIMAL_5_3_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpMatches(castTo(Types.DECIMAL_8_3)),
+
+                forTypePair(NumericPair.DECIMAL_5_3_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_5_3_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_5_3_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_5_0)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_6_1)
+                        .firstOpMatches(castTo(Types.DECIMAL_6_1))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_5_0_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_5_0_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_5_0_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_6_1_DECIMAL_6_1)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_6_1_DECIMAL_8_3)
+                        .firstOpMatches(castTo(Types.DECIMAL_8_3))
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_6_1_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_6_1_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DECIMAL_8_3_DECIMAL_8_3)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.DECIMAL_8_3_REAL)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpMatches(castTo(NativeTypes.DOUBLE)),
+
+                forTypePair(NumericPair.DECIMAL_8_3_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.REAL_REAL)
+                        .firstOpBeSame()
+                        .secondOpBeSame(),
+
+                forTypePair(NumericPair.REAL_DOUBLE)
+                        .firstOpMatches(castTo(NativeTypes.DOUBLE))
+                        .secondOpBeSame(),
+
+
+                forTypePair(NumericPair.DOUBLE_DOUBLE)
+                        .firstOpBeSame()
+                        .secondOpBeSame()
+        );
+    }
+}

Reply via email to