[improve](Nereids)make some DataType's constructor's access level to private (#12143)
include these types: - NullType - BooleanType - TinyIntType - SmallIntType - IntegerType - BigIntType - LargeIntType - FloatType - DoubleType - DateType - DateTimeType - StringType
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -27,6 +27,9 @@ public class DateTimeType extends PrimitiveType {
|
||||
|
||||
public static DateTimeType INSTANCE = new DateTimeType();
|
||||
|
||||
private DateTimeType() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type toCatalogDataType() {
|
||||
return Type.DATETIME;
|
||||
|
||||
@ -27,6 +27,9 @@ public class DateType extends PrimitiveType {
|
||||
|
||||
public static DateType INSTANCE = new DateType();
|
||||
|
||||
private DateType() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type toCatalogDataType() {
|
||||
return Type.DATE;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -27,7 +27,7 @@ public class StringType extends CharacterType {
|
||||
|
||||
public static StringType INSTANCE = new StringType();
|
||||
|
||||
public StringType() {
|
||||
private StringType() {
|
||||
super(-1);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<LogicalOlapScan, LogicalOlapScan> join = new LogicalJoin<>(
|
||||
JoinType.INNER_JOIN, Lists.newArrayList(onCondition),
|
||||
Optional.empty(), scan1, scan2);
|
||||
|
||||
@ -56,16 +56,16 @@ public class PlanEqualsTest {
|
||||
@Test
|
||||
public void testLogicalAggregate(@Mocked Plan child) {
|
||||
LogicalAggregate<Plan> 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<Plan> 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<Plan> 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<Plan, Plan> 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<Plan, Plan> 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<Plan, Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<NamedExpression> 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<Plan> actual = new PhysicalAggregate<>(Lists.newArrayList(), outputExpressionList,
|
||||
Lists.newArrayList(), AggPhase.LOCAL, true, logicalProperties, child);
|
||||
|
||||
List<NamedExpression> 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<Plan> expected = new PhysicalAggregate<>(Lists.newArrayList(),
|
||||
outputExpressionList1,
|
||||
Lists.newArrayList(), AggPhase.LOCAL, true, logicalProperties, child);
|
||||
Assertions.assertEquals(expected, actual);
|
||||
|
||||
List<NamedExpression> 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<Plan> 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<Plan, Plan> 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<Plan, Plan> 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<Plan, Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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<Plan> 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);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -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"))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user