Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
yujun777 committed Dec 24, 2024
1 parent d11af3e commit 9a53aa9
Showing 1 changed file with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,6 @@ void testDoubleLiteral() {
assertRewrite(new LessThanEqual(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(12.3f)),
new LessThanEqual(tinyIntSlot, new TinyIntLiteral((byte) 12)));

// tiny int, literal exceeds data type limit
assertRewrite(new EqualTo(new Cast(tinyIntSlot, FloatType.INSTANCE), new FloatLiteral(200.0f)),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new EqualTo(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.0f)),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new EqualTo(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new NullSafeEqual(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
BooleanLiteral.FALSE);
assertRewrite(new GreaterThan(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new GreaterThanEqual(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new LessThan(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
ExpressionUtils.trueOrNull(tinyIntSlot));
assertRewrite(new LessThanEqual(new Cast(tinyIntSlot, DoubleType.INSTANCE), new DoubleLiteral(200.3f)),
ExpressionUtils.trueOrNull(tinyIntSlot));

// small int
assertRewrite(new EqualTo(new Cast(smallIntSlot, FloatType.INSTANCE), new FloatLiteral(12.0f)),
new EqualTo(smallIntSlot, new SmallIntLiteral((short) 12)));
Expand Down Expand Up @@ -416,22 +398,6 @@ void testIntCmpDecimalV3Literal() {
assertRewrite(new LessThanEqual(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(3, 1)), new DecimalV3Literal(new BigDecimal("12.3"))),
new LessThanEqual(tinyIntSlot, new TinyIntLiteral((byte) 12)));

// tiny int, literal exceeds data type limit
assertRewrite(new EqualTo(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.0"))),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new EqualTo(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new NullSafeEqual(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
BooleanLiteral.FALSE);
assertRewrite(new GreaterThan(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new GreaterThanEqual(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
ExpressionUtils.falseOrNull(tinyIntSlot));
assertRewrite(new LessThan(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
ExpressionUtils.trueOrNull(tinyIntSlot));
assertRewrite(new LessThanEqual(new Cast(tinyIntSlot, DecimalV3Type.createDecimalV3Type(4, 1)), new DecimalV3Literal(new BigDecimal("200.3"))),
ExpressionUtils.trueOrNull(tinyIntSlot));

// small int
assertRewrite(new EqualTo(new Cast(smallIntSlot, DecimalV3Type.createDecimalV3Type(3, 1)), new DecimalV3Literal(new BigDecimal("12.0"))),
new EqualTo(smallIntSlot, new SmallIntLiteral((short) 12)));
Expand Down

0 comments on commit 9a53aa9

Please sign in to comment.