korlov42 commented on code in PR #5690:
URL: https://github.com/apache/ignite-3/pull/5690#discussion_r2068517027


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/DifferentFamiliesPair.java:
##########
@@ -26,95 +26,95 @@
 public enum DifferentFamiliesPair implements TypePair {
     TINYINT_VARCHAR_128(NativeTypes.INT8, Types.VARCHAR_128),
     TINYINT_DATE(NativeTypes.INT8, NativeTypes.DATE),
-    TINYINT_TIME_3(NativeTypes.INT8, Types.TIME_3),
-    TINYINT_TIMESTAMP_3(NativeTypes.INT8, Types.TIMESTAMP_3),
-    TINYINT_TIMESTAMP_WLTZ_3(NativeTypes.INT8, Types.TIMESTAMP_WLTZ_3),
+    TINYINT_TIME_3(NativeTypes.INT8, Types.TIME_9),

Review Comment:
   let''s adjust name as well (`TINYINT_TIME_3` --> `TINYINT_TIME_9`). Please 
fix all the places



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactorySelfTest.java:
##########
@@ -0,0 +1,170 @@
+/*
+ * 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.type;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Stream;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.ignite.internal.sql.engine.util.Commons;
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/**
+ * Tests for {@link IgniteTypeFactory}.
+ */
+public class IgniteTypeFactorySelfTest extends BaseIgniteAbstractTest {
+
+    private static final IgniteTypeFactory TYPE_FACTORY = 
Commons.typeFactory();
+
+    private final Random random = new Random();
+
+    @BeforeEach
+    public void test() {
+        long seed = System.nanoTime();
+        random.setSeed(seed);
+        log.info("Seed: {}", seed);
+    }
+
+    @ParameterizedTest
+    @MethodSource("types")
+    public void leastRestrictiveTypeBetweenTimestampsTypes(List<RelDataType> 
types, RelDataType expected) {
+        RelDataType actual = TYPE_FACTORY.leastRestrictive(types);
+
+        List<RelDataType> shuffledTypes = new ArrayList<>(types);
+        Collections.shuffle(shuffledTypes, random);
+
+        assertEquals(expected, actual);
+    }
+
+    private static Stream<Arguments> types() {

Review Comment:
   let's add a few test cases on permutation of `timestamp`, `timestampLtz`, 
and `NULL`-literal (`SqlTypeName.NULL`)



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/datatypes/utils/DatetimePair.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * 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.utils;
+
+import org.apache.ignite.internal.type.NativeType;
+
+/**
+ * Enumerates possible datetime type pairs for test purposes.
+ */
+public enum DatetimePair implements TypePair {
+    DATE_DATE(Types.DATE, Types.DATE),
+
+    TIME_0_TIME_0(Types.TIME_0, Types.TIME_0),
+    TIME_0_TIME_3(Types.TIME_0, Types.TIME_3),
+    TIME_0_TIME_6(Types.TIME_0, Types.TIME_6),
+    TIME_0_TIME_9(Types.TIME_0, Types.TIME_9),
+
+    TIME_3_TIME_0(Types.TIME_3, Types.TIME_0),

Review Comment:
   all type pairs introduced so far describe unique-disregard-the-order pairs 
(i.e. there is `TINYINT_SMALLINT` but not `SMALLINT_TINYINT`). Let's follow 
this rule for consistency



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to