zstan commented on code in PR #4124:
URL: https://github.com/apache/ignite-3/pull/4124#discussion_r1690996300


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/NumericInTypeCoercionTest.java:
##########
@@ -0,0 +1,3267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.sql.engine.planner.datatypes;
+
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.schema.Table;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.sql.type.SqlTypeUtil;
+import org.apache.ignite.internal.sql.engine.framework.TestBuilders;
+import 
org.apache.ignite.internal.sql.engine.planner.datatypes.utils.NumericPair;
+import org.apache.ignite.internal.sql.engine.planner.datatypes.utils.Types;
+import org.apache.ignite.internal.sql.engine.rel.IgniteTableScan;
+import org.apache.ignite.internal.sql.engine.schema.IgniteSchema;
+import org.apache.ignite.internal.sql.engine.trait.IgniteDistributions;
+import org.apache.ignite.internal.sql.engine.util.Commons;
+import org.apache.ignite.internal.sql.engine.util.SqlTestUtils;
+import org.apache.ignite.internal.type.DecimalNativeType;
+import org.apache.ignite.internal.type.NativeType;
+import org.apache.ignite.internal.type.NativeTypes;
+import org.hamcrest.Matcher;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/**
+ * A set of test to verify behavior of type coercion for IN operator, when 
operands belongs to the NUMERIC type family.
+ *
+ * <p>This tests aim to help to understand in which cases implicit casts are 
added to operands of the IN operator.
+ */
+public class NumericInTypeCoercionTest extends BaseTypeCoercionTest {
+
+    private static final NativeType DECIMAL_DEFAULT = 
NativeTypes.decimalOf(32767, 0);
+
+    private static Stream<Arguments> lhsNonDecimal() {
+        return Stream.of(
+                // TINYINT
+
+                Arguments.of(
+                        NumericPair.TINYINT_TINYINT,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(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_REAL,
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        ofTypeWithoutCast(NativeTypes.FLOAT)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_BIGINT,
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_1_0,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_2_0,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_2_1,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_3_1,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_4_3,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_5_0,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_5_3,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_6_1,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                Arguments.of(
+                        NumericPair.TINYINT_DECIMAL_8_3,
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        ofTypeWithoutCast(NativeTypes.INT8),
+                        castTo(NativeTypes.INT8)
+                ),
+
+                // 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_REAL,
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        ofTypeWithoutCast(NativeTypes.FLOAT)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_BIGINT,
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_1_0,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_2_0,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_2_1,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_3_1,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_4_3,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_5_0,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_5_3,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_6_1,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                Arguments.of(
+                        NumericPair.SMALLINT_DECIMAL_8_3,
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        ofTypeWithoutCast(NativeTypes.INT16),
+                        castTo(NativeTypes.INT16)
+                ),
+
+                // 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_REAL,
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        ofTypeWithoutCast(NativeTypes.FLOAT)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_BIGINT,
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_1_0,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_2_0,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_2_1,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_3_1,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_4_3,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_5_0,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_5_3,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_6_1,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                Arguments.of(
+                        NumericPair.INT_DECIMAL_8_3,
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        ofTypeWithoutCast(NativeTypes.INT32),
+                        castTo(NativeTypes.INT32)
+                ),
+
+                // 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_REAL,
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        castTo(NativeTypes.FLOAT),
+                        ofTypeWithoutCast(NativeTypes.FLOAT)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_BIGINT,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_1_0,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_2_0,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_2_1,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_3_1,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_4_3,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_5_0,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_5_3,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_6_1,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                Arguments.of(
+                        NumericPair.BIGINT_DECIMAL_8_3,
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        ofTypeWithoutCast(NativeTypes.INT64),
+                        castTo(NativeTypes.INT64)
+                ),
+
+                // 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<Arguments> inOperandsAllColumns() {
+        Stream<Arguments> decimals = Stream.of(
+                // a IN (b, c) converted to (a = b OR a = c)
+                // the first 2 matchers used to check (a = b) and the second 
for (a = c)
+
+                // DECIMAL (1, 0)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_1_0,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(Types.DECIMAL_1_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),
+                        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),
+                        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),
+                        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),
+                        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),
+                        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),
+                        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),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (2, 0)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(Types.DECIMAL_2_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),
+                        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),
+                        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),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (2, 1)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_2_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_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),
+                        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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        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),
+                        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),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (4, 3)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_4_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_4_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(Types.DECIMAL_4_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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        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),
+                        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),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (5, 0)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        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),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (5, 3)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (6, 1)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (8, 3)
+
+                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)
+                ),
+
+                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)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_8_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                )
+        );
+
+        return Stream.concat(
+                lhsNonDecimal(),
+                decimals
+        );
+    }
+
+    @ParameterizedTest
+    @MethodSource("inOperandsAllColumns")
+    public void columns(NumericPair typePair,
+            Matcher<RexNode> first,
+            Matcher<RexNode> second,
+            Matcher<RexNode> third,
+            Matcher<RexNode> forth
+    ) throws Exception {
+        IgniteSchema schema = createSchema(
+                TestBuilders.table()
+                        .name("T1")
+                        .distribution(IgniteDistributions.single())
+                        .addColumn("C1", typePair.first())
+                        .addColumn("C2", typePair.first())
+                        .addColumn("C3", typePair.second())
+                        .build()
+        );
+
+        Predicate<IgniteTableScan> matcher = checkPlan(first, second, third, 
forth);
+        assertPlan("SELECT c1 FROM T1 WHERE c1 IN (c2, c3)", schema, matcher);
+    }
+
+    /**
+     * This test ensures that {@link #inOperandsDynamicParamLhs()} doesn't 
miss any type pair from {@link NumericPair}.
+     */
+    @Test
+    void inOperandColumnsIncludeAllPairs() {
+        checkIncludesAllNumericTypePairs(inOperandsAllColumns());
+    }
+
+    private static Stream<Arguments> inOperandsDynamicParamsRhs() {
+
+        Stream<Arguments> decimals = Stream.of(
+                // DECIMAL (1, 0)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        castTo(Types.DECIMAL_1_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        castTo(Types.DECIMAL_1_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_1_0,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_2_1,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_4_3,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (2, 0)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        castTo(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        castTo(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (2, 1)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        castTo(Types.DECIMAL_2_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        castTo(Types.DECIMAL_2_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_2_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_4_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (4, 3)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        castTo(Types.DECIMAL_4_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        castTo(Types.DECIMAL_4_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_2_0,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_4_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_4_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (3, 1)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        castTo(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        castTo(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (5, 0)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        castTo(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        castTo(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_0_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (5, 3)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        castTo(Types.DECIMAL_5_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        castTo(Types.DECIMAL_5_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_5_0,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_5_3,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_5_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (6, 1)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        castTo(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        castTo(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_6_1_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                ),
+
+                // DECIMAL (8, 3)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_8_3_REAL,
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        castTo(Types.DECIMAL_8_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_8_3_DOUBLE,
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        castTo(Types.DECIMAL_8_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_8_3_DECIMAL_8_3,
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3),
+                        ofTypeWithoutCast(DECIMAL_DEFAULT)
+                )
+        );
+
+        return Stream.concat(
+                lhsNonDecimal(),
+                decimals
+        );
+    }
+
+    @ParameterizedTest
+    @MethodSource("inOperandsDynamicParamLhs")
+    public void dynamicParamsLhs(
+            NumericPair typePair,
+            Matcher<RexNode> first,
+            Matcher<RexNode> second,
+            Matcher<RexNode> third,
+            Matcher<RexNode> forth
+    ) throws Exception {
+
+        IgniteSchema schema = createSchema(
+                TestBuilders.table()
+                        .name("T1")
+                        .distribution(IgniteDistributions.single())
+                        .addColumn("C1", typePair.first())
+                        .addColumn("C2", typePair.first())
+                        .addColumn("C3", typePair.second())
+                        .build()
+        );
+
+        List<Object> params = List.of(
+                
SqlTestUtils.generateValueByType(typePair.first().spec().asColumnType())
+        );
+
+        Predicate<IgniteTableScan> matcher = checkPlan(first, second, third, 
forth);
+        assertPlan("SELECT c1 FROM T1 WHERE ? IN (c2, c3)", schema, matcher, 
params);
+    }
+
+    /**
+     * This test ensures that {@link #inOperandsDynamicParamsRhs()} doesn't 
miss any type pair from {@link NumericPair}.
+     */
+    @Test
+    void inOperandsDynamicParamLhsIncludeAllPairs() {
+        checkIncludesAllNumericTypePairs(inOperandsDynamicParamLhs());
+    }
+
+    private static Stream<Arguments> inOperandsDynamicParamLhs() {
+        NativeType defaultDecimal = NativeTypes.decimalOf(32767, 0);
+        Stream<Arguments> decimals = Stream.of(
+                // DECIMAL (1,0)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_REAL,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DOUBLE,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_1_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_2_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_3_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_4_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_5_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_1_0_DECIMAL_8_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_1_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (2, 0)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_REAL,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DOUBLE,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_2_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_3_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_5_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_5_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_6_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_0_DECIMAL_8_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (2,1)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_REAL,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DOUBLE,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_2_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_2_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_4_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_4_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_5_0,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_0)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_5_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_5_3)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_6_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_6_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_2_1_DECIMAL_8_3,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_2_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_8_3)
+                ),
+
+                // DECIMAL (3,1)
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_REAL,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DOUBLE,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        castTo(defaultDecimal)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1),
+                        ofTypeWithoutCast(defaultDecimal),
+                        ofTypeWithoutCast(Types.DECIMAL_3_1)
+                ),
+
+                Arguments.of(
+                        NumericPair.DECIMAL_3_1_DECIMAL_3_1,
+                        ofTypeWithoutCast(defaultDecimal),

Review Comment:
   4 copy-paste initializations near



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

To unsubscribe, e-mail: [email protected]

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


Reply via email to