diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BigIntType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BigIntType.java index 4dae2b79b8..fa1d0ada50 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BigIntType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BigIntType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.IntegralType; public class BigIntType extends IntegralType { public static BigIntType INSTANCE = new BigIntType(); + private BigIntType() { + } + @Override public Type toCatalogDataType() { return Type.BIGINT; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BooleanType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BooleanType.java index 2e381cc117..80670edf7e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BooleanType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/BooleanType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.PrimitiveType; public class BooleanType extends PrimitiveType { public static BooleanType INSTANCE = new BooleanType(); + private BooleanType() { + } + @Override public Type toCatalogDataType() { return Type.BOOLEAN; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeType.java index 90d77ae4b4..b7ae478dda 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeType.java @@ -27,6 +27,9 @@ public class DateTimeType extends PrimitiveType { public static DateTimeType INSTANCE = new DateTimeType(); + private DateTimeType() { + } + @Override public Type toCatalogDataType() { return Type.DATETIME; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateType.java index 4eddbc4520..9de50bf1cf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateType.java @@ -27,6 +27,9 @@ public class DateType extends PrimitiveType { public static DateType INSTANCE = new DateType(); + private DateType() { + } + @Override public Type toCatalogDataType() { return Type.DATE; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DoubleType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DoubleType.java index 3017c1792c..1bf28dc35c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DoubleType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DoubleType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.FractionalType; public class DoubleType extends FractionalType { public static DoubleType INSTANCE = new DoubleType(); + private DoubleType() { + } + @Override public Type toCatalogDataType() { return Type.DOUBLE; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/FloatType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/FloatType.java index de2e54166f..77836cc6a2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/FloatType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/FloatType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.FractionalType; public class FloatType extends FractionalType { public static FloatType INSTANCE = new FloatType(); + private FloatType() { + } + @Override public Type toCatalogDataType() { return Type.FLOAT; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/IntegerType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/IntegerType.java index e9a6385346..1c354f9f39 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/IntegerType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/IntegerType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.IntegralType; public class IntegerType extends IntegralType { public static IntegerType INSTANCE = new IntegerType(); + private IntegerType() { + } + @Override public Type toCatalogDataType() { return Type.INT; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/LargeIntType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/LargeIntType.java index 238c6d287a..b835b4788b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/LargeIntType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/LargeIntType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.IntegralType; public class LargeIntType extends IntegralType { public static LargeIntType INSTANCE = new LargeIntType(); + private LargeIntType() { + } + @Override public Type toCatalogDataType() { return Type.LARGEINT; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/NullType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/NullType.java index 52e4d0b4ed..5015b5e250 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/NullType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/NullType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.PrimitiveType; public class NullType extends PrimitiveType { public static NullType INSTANCE = new NullType(); + private NullType() { + } + @Override public Type toCatalogDataType() { return Type.NULL; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/SmallIntType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/SmallIntType.java index c0cc52d6a6..a4dea4c247 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/SmallIntType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/SmallIntType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.IntegralType; public class SmallIntType extends IntegralType { public static SmallIntType INSTANCE = new SmallIntType(); + private SmallIntType() { + } + @Override public Type toCatalogDataType() { return Type.SMALLINT; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/StringType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/StringType.java index 62e13a952a..77adb2c757 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/StringType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/StringType.java @@ -27,7 +27,7 @@ public class StringType extends CharacterType { public static StringType INSTANCE = new StringType(); - public StringType() { + private StringType() { super(-1); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/TinyIntType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/TinyIntType.java index 62ec486fe7..7632b61ed7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/TinyIntType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/TinyIntType.java @@ -26,6 +26,9 @@ import org.apache.doris.nereids.types.coercion.IntegralType; public class TinyIntType extends IntegralType { public static TinyIntType INSTANCE = new TinyIntType(); + private TinyIntType() { + } + @Override public Type toCatalogDataType() { return Type.TINYINT; diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java index 3a815ea47e..27f7cbeae7 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java @@ -45,8 +45,8 @@ public class JoinCommuteTest { LogicalOlapScan scan2 = PlanConstructor.newLogicalOlapScan(1, "t2", 0); Expression onCondition = new EqualTo( - new SlotReference("id", new BigIntType(), true, ImmutableList.of("table1")), - new SlotReference("id", new BigIntType(), true, ImmutableList.of("table2"))); + new SlotReference("id", BigIntType.INSTANCE, true, ImmutableList.of("table1")), + new SlotReference("id", BigIntType.INSTANCE, true, ImmutableList.of("table2"))); LogicalJoin join = new LogicalJoin<>( JoinType.INNER_JOIN, Lists.newArrayList(onCondition), Optional.empty(), scan1, scan2); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java index 3a03741f98..a9e9c6c094 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java @@ -56,16 +56,16 @@ public class PlanEqualsTest { @Test public void testLogicalAggregate(@Mocked Plan child) { LogicalAggregate actual = new LogicalAggregate<>(Lists.newArrayList(), ImmutableList.of( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), child); LogicalAggregate expected = new LogicalAggregate<>(Lists.newArrayList(), ImmutableList.of( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), child); Assertions.assertEquals(expected, actual); LogicalAggregate unexpected = new LogicalAggregate<>(Lists.newArrayList(), ImmutableList.of( - new SlotReference(new ExprId(0), "b", new BigIntType(), true, Lists.newArrayList())), + new SlotReference(new ExprId(0), "b", BigIntType.INSTANCE, true, Lists.newArrayList())), child); Assertions.assertNotEquals(unexpected, actual); } @@ -84,19 +84,19 @@ public class PlanEqualsTest { @Test public void testLogicalJoin(@Mocked Plan left, @Mocked Plan right) { LogicalJoin actual = new LogicalJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList()), - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), left, right); LogicalJoin expected = new LogicalJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList()), - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), left, right); Assertions.assertEquals(expected, actual); LogicalJoin unexpected = new LogicalJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference("a", new BigIntType(), false, Lists.newArrayList()), - new SlotReference("b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference("a", BigIntType.INSTANCE, false, Lists.newArrayList()), + new SlotReference("b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), left, right); Assertions.assertNotEquals(unexpected, actual); } @@ -115,21 +115,21 @@ public class PlanEqualsTest { @Test public void testLogicalProject(@Mocked Plan child) { LogicalProject actual = new LogicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), child); LogicalProject expected = new LogicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), child); Assertions.assertEquals(expected, actual); LogicalProject unexpected1 = new LogicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(1), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(1), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), child); Assertions.assertNotEquals(unexpected1, actual); LogicalProject unexpected2 = new LogicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList())), child); Assertions.assertNotEquals(unexpected2, actual); } @@ -138,20 +138,20 @@ public class PlanEqualsTest { public void testLogicalSort(@Mocked Plan child) { LogicalSort actual = new LogicalSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), child); LogicalSort expected = new LogicalSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), child); Assertions.assertEquals(expected, actual); LogicalSort unexpected = new LogicalSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "a", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), child); Assertions.assertNotEquals(unexpected, actual); @@ -161,19 +161,19 @@ public class PlanEqualsTest { @Test public void testPhysicalAggregate(@Mocked Plan child, @Mocked LogicalProperties logicalProperties) { List outputExpressionList = ImmutableList.of( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())); + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())); PhysicalAggregate actual = new PhysicalAggregate<>(Lists.newArrayList(), outputExpressionList, Lists.newArrayList(), AggPhase.LOCAL, true, logicalProperties, child); List outputExpressionList1 = ImmutableList.of( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())); + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())); PhysicalAggregate expected = new PhysicalAggregate<>(Lists.newArrayList(), outputExpressionList1, Lists.newArrayList(), AggPhase.LOCAL, true, logicalProperties, child); Assertions.assertEquals(expected, actual); List outputExpressionList2 = ImmutableList.of( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())); + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())); PhysicalAggregate unexpected = new PhysicalAggregate<>(Lists.newArrayList(), outputExpressionList2, Lists.newArrayList(), AggPhase.LOCAL, false, logicalProperties, child); @@ -198,21 +198,21 @@ public class PlanEqualsTest { public void testPhysicalJoin(@Mocked Plan left, @Mocked Plan right, @Mocked LogicalProperties logicalProperties) { PhysicalHashJoin actual = new PhysicalHashJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList()), - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), logicalProperties, left, right); PhysicalHashJoin expected = new PhysicalHashJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList()), - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), logicalProperties, left, right); Assertions.assertEquals(expected, actual); PhysicalHashJoin unexpected = new PhysicalHashJoin<>(JoinType.INNER_JOIN, Lists.newArrayList(new EqualTo( - new SlotReference("a", new BigIntType(), false, Lists.newArrayList()), - new SlotReference("b", new BigIntType(), true, Lists.newArrayList()))), + new SlotReference("a", BigIntType.INSTANCE, false, Lists.newArrayList()), + new SlotReference("b", BigIntType.INSTANCE, true, Lists.newArrayList()))), Optional.empty(), logicalProperties, left, right); Assertions.assertNotEquals(unexpected, actual); } @@ -245,24 +245,24 @@ public class PlanEqualsTest { @Test public void testPhysicalProject(@Mocked Plan child, @Mocked LogicalProperties logicalProperties) { PhysicalProject actual = new PhysicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), logicalProperties, child); PhysicalProject expected = new PhysicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(0), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), logicalProperties, child); Assertions.assertEquals(expected, actual); PhysicalProject unexpected1 = new PhysicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(1), "a", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(1), "a", BigIntType.INSTANCE, true, Lists.newArrayList())), logicalProperties, child); Assertions.assertNotEquals(unexpected1, actual); PhysicalProject unexpected2 = new PhysicalProject<>( - ImmutableList.of(new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList())), + ImmutableList.of(new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList())), logicalProperties, child); Assertions.assertNotEquals(unexpected2, actual); @@ -273,14 +273,14 @@ public class PlanEqualsTest { PhysicalQuickSort actual = new PhysicalQuickSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), logicalProperties, child); PhysicalQuickSort expected = new PhysicalQuickSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "b", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), logicalProperties, child); @@ -288,7 +288,7 @@ public class PlanEqualsTest { PhysicalQuickSort unexpected = new PhysicalQuickSort<>( ImmutableList.of(new OrderKey( - new SlotReference(new ExprId(1), "a", new BigIntType(), true, Lists.newArrayList()), true, + new SlotReference(new ExprId(1), "a", BigIntType.INSTANCE, true, Lists.newArrayList()), true, true)), logicalProperties, child); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java index 3afad0deb2..fa3cd2bbde 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java @@ -24,51 +24,6 @@ import org.junit.jupiter.api.Test; public class DataTypeTest { @Test public void testDataTypeEquals() { - NullType nullType1 = new NullType(); - NullType nullType2 = new NullType(); - Assertions.assertEquals(nullType1, nullType2); - Assertions.assertEquals(nullType1.hashCode(), nullType2.hashCode()); - - BooleanType booleanType1 = new BooleanType(); - BooleanType booleanType2 = new BooleanType(); - Assertions.assertEquals(booleanType1, booleanType2); - Assertions.assertEquals(booleanType1.hashCode(), booleanType2.hashCode()); - - TinyIntType tinyIntType1 = new TinyIntType(); - TinyIntType tinyIntType2 = new TinyIntType(); - Assertions.assertEquals(tinyIntType1, tinyIntType2); - Assertions.assertEquals(tinyIntType1.hashCode(), tinyIntType2.hashCode()); - - SmallIntType smallIntType1 = new SmallIntType(); - SmallIntType smallIntType2 = new SmallIntType(); - Assertions.assertEquals(smallIntType1, smallIntType2); - Assertions.assertEquals(smallIntType1.hashCode(), smallIntType2.hashCode()); - - IntegerType integerType1 = new IntegerType(); - IntegerType integerType2 = new IntegerType(); - Assertions.assertEquals(integerType1, integerType2); - Assertions.assertEquals(integerType1.hashCode(), integerType2.hashCode()); - - BigIntType bigIntType1 = new BigIntType(); - BigIntType bigIntType2 = new BigIntType(); - Assertions.assertEquals(bigIntType1, bigIntType2); - Assertions.assertEquals(bigIntType1.hashCode(), bigIntType2.hashCode()); - - LargeIntType largeIntType1 = new LargeIntType(); - LargeIntType largeIntType2 = new LargeIntType(); - Assertions.assertEquals(largeIntType1, largeIntType2); - Assertions.assertEquals(largeIntType1.hashCode(), largeIntType2.hashCode()); - - FloatType floatType1 = new FloatType(); - FloatType floatType2 = new FloatType(); - Assertions.assertEquals(floatType1, floatType2); - Assertions.assertEquals(floatType1.hashCode(), floatType2.hashCode()); - - DoubleType doubleType1 = new DoubleType(); - DoubleType doubleType2 = new DoubleType(); - Assertions.assertEquals(doubleType1, doubleType2); - Assertions.assertEquals(doubleType1.hashCode(), doubleType2.hashCode()); - DecimalType decimalType1 = new DecimalType(27, 9); DecimalType decimalType2 = new DecimalType(27, 9); DecimalType decimalType3 = new DecimalType(28, 9); @@ -95,20 +50,5 @@ public class DataTypeTest { Assertions.assertEquals(varcharType1.hashCode(), varcharType2.hashCode()); Assertions.assertNotEquals(varcharType1, varcharType3); Assertions.assertNotEquals(varcharType1.hashCode(), varcharType3.hashCode()); - - StringType stringType1 = new StringType(); - StringType stringType2 = new StringType(); - Assertions.assertEquals(stringType1, stringType2); - Assertions.assertEquals(stringType1.hashCode(), stringType2.hashCode()); - - DateType dateType1 = new DateType(); - DateType dateType2 = new DateType(); - Assertions.assertEquals(dateType1, dateType2); - Assertions.assertEquals(dateType1.hashCode(), dateType2.hashCode()); - - DateTimeType dateTimeType1 = new DateTimeType(); - DateTimeType dateTimeType2 = new DateTimeType(); - Assertions.assertEquals(dateTimeType1, dateTimeType2); - Assertions.assertEquals(dateTimeType1.hashCode(), dateTimeType2.hashCode()); } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/AnalyzeSubQueryTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/AnalyzeSubQueryTest.java index 7b5a016d1a..1f000a924e 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/AnalyzeSubQueryTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/AnalyzeSubQueryTest.java @@ -108,12 +108,12 @@ public class AnalyzeSubQueryTest extends TestWithFeService implements PatternMat logicalProject( logicalOlapScan().when(o -> true) ).when(FieldChecker.check("projects", ImmutableList.of( - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("T")), - new SlotReference(new ExprId(1), "score", new BigIntType(), true, ImmutableList.of("T")))) + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("T")), + new SlotReference(new ExprId(1), "score", BigIntType.INSTANCE, true, ImmutableList.of("T")))) ) ).when(FieldChecker.check("projects", ImmutableList.of( - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("T2")), - new SlotReference(new ExprId(1), "score", new BigIntType(), true, ImmutableList.of("T2")))) + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("T2")), + new SlotReference(new ExprId(1), "score", BigIntType.INSTANCE, true, ImmutableList.of("T2")))) ) ); } @@ -130,21 +130,21 @@ public class AnalyzeSubQueryTest extends TestWithFeService implements PatternMat logicalProject( logicalOlapScan() ).when(FieldChecker.check("projects", ImmutableList.of( - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("TT2")), - new SlotReference(new ExprId(1), "score", new BigIntType(), true, ImmutableList.of("TT2")))) + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("TT2")), + new SlotReference(new ExprId(1), "score", BigIntType.INSTANCE, true, ImmutableList.of("TT2")))) ) ) .when(FieldChecker.check("joinType", JoinType.INNER_JOIN)) .when(FieldChecker.check("otherJoinCondition", Optional.of(new EqualTo( - new SlotReference(new ExprId(2), "id", new BigIntType(), true, ImmutableList.of("TT1")), - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("T"))))) + new SlotReference(new ExprId(2), "id", BigIntType.INSTANCE, true, ImmutableList.of("TT1")), + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("T"))))) ) ).when(FieldChecker.check("projects", ImmutableList.of( - new SlotReference(new ExprId(2), "id", new BigIntType(), true, ImmutableList.of("TT1")), - new SlotReference(new ExprId(3), "score", new BigIntType(), true, ImmutableList.of("TT1")), - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("T")), - new SlotReference(new ExprId(1), "score", new BigIntType(), true, ImmutableList.of("T")))) + new SlotReference(new ExprId(2), "id", BigIntType.INSTANCE, true, ImmutableList.of("TT1")), + new SlotReference(new ExprId(3), "score", BigIntType.INSTANCE, true, ImmutableList.of("TT1")), + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("T")), + new SlotReference(new ExprId(1), "score", BigIntType.INSTANCE, true, ImmutableList.of("T")))) ) ); } @@ -162,14 +162,14 @@ public class AnalyzeSubQueryTest extends TestWithFeService implements PatternMat ) .when(FieldChecker.check("joinType", JoinType.INNER_JOIN)) .when(FieldChecker.check("otherJoinCondition", Optional.of(new EqualTo( - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("default_cluster:test", "T1")), - new SlotReference(new ExprId(2), "id", new BigIntType(), true, ImmutableList.of("T2"))))) + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("default_cluster:test", "T1")), + new SlotReference(new ExprId(2), "id", BigIntType.INSTANCE, true, ImmutableList.of("T2"))))) ) ).when(FieldChecker.check("projects", ImmutableList.of( - new SlotReference(new ExprId(0), "id", new BigIntType(), true, ImmutableList.of("default_cluster:test", "T1")), - new SlotReference(new ExprId(1), "score", new BigIntType(), true, ImmutableList.of("default_cluster:test", "T1")), - new SlotReference(new ExprId(2), "id", new BigIntType(), true, ImmutableList.of("T2")), - new SlotReference(new ExprId(3), "score", new BigIntType(), true, ImmutableList.of("T2")))) + new SlotReference(new ExprId(0), "id", BigIntType.INSTANCE, true, ImmutableList.of("default_cluster:test", "T1")), + new SlotReference(new ExprId(1), "score", BigIntType.INSTANCE, true, ImmutableList.of("default_cluster:test", "T1")), + new SlotReference(new ExprId(2), "id", BigIntType.INSTANCE, true, ImmutableList.of("T2")), + new SlotReference(new ExprId(3), "score", BigIntType.INSTANCE, true, ImmutableList.of("T2")))) ) ); }