@@ -592,15 +592,15 @@ class CastSuite extends CastSuiteBase {
592
592
val e1 = intercept[ArithmeticException ] {
593
593
Cast (Literal (Byte .MaxValue + 1 ), ByteType ).eval()
594
594
}.getMessage
595
- assert(e1.contains(" Casting 128 to TINYINT causes overflow" ))
595
+ assert(e1.contains(" Casting 128 to \" TINYINT\" causes overflow" ))
596
596
val e2 = intercept[ArithmeticException ] {
597
597
Cast (Literal (Short .MaxValue + 1 ), ShortType ).eval()
598
598
}.getMessage
599
- assert(e2.contains(" Casting 32768 to SMALLINT causes overflow" ))
599
+ assert(e2.contains(" Casting 32768 to \" SMALLINT\" causes overflow" ))
600
600
val e3 = intercept[ArithmeticException ] {
601
601
Cast (Literal (Int .MaxValue + 1L ), IntegerType ).eval()
602
602
}.getMessage
603
- assert(e3.contains(" Casting 2147483648L to INT causes overflow" ))
603
+ assert(e3.contains(" Casting 2147483648L to \" INT\" causes overflow" ))
604
604
}
605
605
}
606
606
@@ -642,15 +642,15 @@ class CastSuite extends CastSuiteBase {
642
642
checkEvaluation(cast(v2, LongType ), 25L )
643
643
case MINUTE =>
644
644
checkExceptionInExpression[ArithmeticException ](cast(v2, ByteType ),
645
- s " Casting $v2 to TINYINT causes overflow " )
645
+ s """ Casting $v2 to " TINYINT" causes overflow "" " )
646
646
checkEvaluation(cast(v2, ShortType ), (MINUTES_PER_HOUR * 25 + 1 ).toShort)
647
647
checkEvaluation(cast(v2, IntegerType ), (MINUTES_PER_HOUR * 25 + 1 ).toInt)
648
648
checkEvaluation(cast(v2, LongType ), MINUTES_PER_HOUR * 25 + 1 )
649
649
case SECOND =>
650
650
checkExceptionInExpression[ArithmeticException ](cast(v2, ByteType ),
651
- s " Casting $v2 to TINYINT causes overflow " )
651
+ s """ Casting $v2 to " TINYINT" causes overflow "" " )
652
652
checkExceptionInExpression[ArithmeticException ](cast(v2, ShortType ),
653
- s " Casting $v2 to SMALLINT causes overflow " )
653
+ s """ Casting $v2 to " SMALLINT" causes overflow "" " )
654
654
checkEvaluation(cast(v2, IntegerType ), num.toInt)
655
655
checkEvaluation(cast(v2, LongType ), num)
656
656
}
@@ -659,69 +659,69 @@ class CastSuite extends CastSuiteBase {
659
659
dt.endField match {
660
660
case DAY =>
661
661
checkExceptionInExpression[ArithmeticException ](cast(v3, ByteType ),
662
- s " Casting $v3 to TINYINT causes overflow " )
662
+ s """ Casting $v3 to " TINYINT" causes overflow "" " )
663
663
checkExceptionInExpression[ArithmeticException ](cast(v3, ShortType ),
664
- s " Casting $v3 to SMALLINT causes overflow " )
664
+ s """ Casting $v3 to " SMALLINT" causes overflow "" " )
665
665
checkEvaluation(cast(v3, IntegerType ), (Long .MaxValue / MICROS_PER_DAY ).toInt)
666
666
checkEvaluation(cast(v3, LongType ), Long .MaxValue / MICROS_PER_DAY )
667
667
case HOUR =>
668
668
checkExceptionInExpression[ArithmeticException ](cast(v3, ByteType ),
669
- s " Casting $v3 to TINYINT causes overflow " )
669
+ s """ Casting $v3 to " TINYINT" causes overflow "" " )
670
670
checkExceptionInExpression[ArithmeticException ](cast(v3, ShortType ),
671
- s " Casting $v3 to SMALLINT causes overflow " )
671
+ s """ Casting $v3 to " SMALLINT" causes overflow "" " )
672
672
checkExceptionInExpression[ArithmeticException ](cast(v3, IntegerType ),
673
- s " Casting $v3 to INT causes overflow " )
673
+ s """ Casting $v3 to " INT" causes overflow "" " )
674
674
checkEvaluation(cast(v3, LongType ), Long .MaxValue / MICROS_PER_HOUR )
675
675
case MINUTE =>
676
676
checkExceptionInExpression[ArithmeticException ](cast(v3, ByteType ),
677
- s " Casting $v3 to TINYINT causes overflow " )
677
+ s """ Casting $v3 to " TINYINT" causes overflow "" " )
678
678
checkExceptionInExpression[ArithmeticException ](cast(v3, ShortType ),
679
- s " Casting $v3 to SMALLINT causes overflow " )
679
+ s """ Casting $v3 to " SMALLINT" causes overflow "" " )
680
680
checkExceptionInExpression[ArithmeticException ](cast(v3, IntegerType ),
681
- s " Casting $v3 to INT causes overflow " )
681
+ s """ Casting $v3 to " INT" causes overflow "" " )
682
682
checkEvaluation(cast(v3, LongType ), Long .MaxValue / MICROS_PER_MINUTE )
683
683
case SECOND =>
684
684
checkExceptionInExpression[ArithmeticException ](cast(v3, ByteType ),
685
- s " Casting $v3 to TINYINT causes overflow " )
685
+ s """ Casting $v3 to " TINYINT" causes overflow "" " )
686
686
checkExceptionInExpression[ArithmeticException ](cast(v3, ShortType ),
687
- s " Casting $v3 to SMALLINT causes overflow " )
687
+ s """ Casting $v3 to " SMALLINT" causes overflow "" " )
688
688
checkExceptionInExpression[ArithmeticException ](cast(v3, IntegerType ),
689
- s " Casting $v3 to INT causes overflow " )
689
+ s """ Casting $v3 to " INT" causes overflow "" " )
690
690
checkEvaluation(cast(v3, LongType ), Long .MaxValue / MICROS_PER_SECOND )
691
691
}
692
692
693
693
val v4 = Literal .create(Duration .of(Long .MinValue , ChronoUnit .MICROS ), dt)
694
694
dt.endField match {
695
695
case DAY =>
696
696
checkExceptionInExpression[ArithmeticException ](cast(v4, ByteType ),
697
- s " Casting $v4 to TINYINT causes overflow " )
697
+ s """ Casting $v4 to " TINYINT" causes overflow "" " )
698
698
checkExceptionInExpression[ArithmeticException ](cast(v4, ShortType ),
699
- s " Casting $v4 to SMALLINT causes overflow " )
699
+ s """ Casting $v4 to " SMALLINT" causes overflow "" " )
700
700
checkEvaluation(cast(v4, IntegerType ), (Long .MinValue / MICROS_PER_DAY ).toInt)
701
701
checkEvaluation(cast(v4, LongType ), Long .MinValue / MICROS_PER_DAY )
702
702
case HOUR =>
703
703
checkExceptionInExpression[ArithmeticException ](cast(v4, ByteType ),
704
- s " Casting $v4 to TINYINT causes overflow " )
704
+ s """ Casting $v4 to " TINYINT" causes overflow "" " )
705
705
checkExceptionInExpression[ArithmeticException ](cast(v4, ShortType ),
706
- s " Casting $v4 to SMALLINT causes overflow " )
706
+ s """ Casting $v4 to " SMALLINT" causes overflow "" " )
707
707
checkExceptionInExpression[ArithmeticException ](cast(v4, IntegerType ),
708
- s " Casting $v4 to INT causes overflow " )
708
+ s """ Casting $v4 to " INT" causes overflow "" " )
709
709
checkEvaluation(cast(v4, LongType ), Long .MinValue / MICROS_PER_HOUR )
710
710
case MINUTE =>
711
711
checkExceptionInExpression[ArithmeticException ](cast(v4, ByteType ),
712
- s " Casting $v4 to TINYINT causes overflow " )
712
+ s """ Casting $v4 to " TINYINT" causes overflow "" " )
713
713
checkExceptionInExpression[ArithmeticException ](cast(v4, ShortType ),
714
- s " Casting $v4 to SMALLINT causes overflow " )
714
+ s """ Casting $v4 to " SMALLINT" causes overflow "" " )
715
715
checkExceptionInExpression[ArithmeticException ](cast(v4, IntegerType ),
716
- s " Casting $v4 to INT causes overflow " )
716
+ s """ Casting $v4 to " INT" causes overflow "" " )
717
717
checkEvaluation(cast(v4, LongType ), Long .MinValue / MICROS_PER_MINUTE )
718
718
case SECOND =>
719
719
checkExceptionInExpression[ArithmeticException ](cast(v4, ByteType ),
720
- s " Casting $v4 to TINYINT causes overflow " )
720
+ s """ Casting $v4 to " TINYINT" causes overflow "" " )
721
721
checkExceptionInExpression[ArithmeticException ](cast(v4, ShortType ),
722
- s " Casting $v4 to SMALLINT causes overflow " )
722
+ s """ Casting $v4 to " SMALLINT" causes overflow "" " )
723
723
checkExceptionInExpression[ArithmeticException ](cast(v4, IntegerType ),
724
- s " Casting $v4 to INT causes overflow " )
724
+ s """ Casting $v4 to " INT" causes overflow "" " )
725
725
checkEvaluation(cast(v4, LongType ), Long .MinValue / MICROS_PER_SECOND )
726
726
}
727
727
}
@@ -777,7 +777,7 @@ class CastSuite extends CastSuiteBase {
777
777
).foreach {
778
778
case (v, toType) =>
779
779
checkExceptionInExpression[ArithmeticException ](cast(v, toType),
780
- s " Casting $v to ${toType.sql} causes overflow " )
780
+ s """ Casting $v to " ${toType.sql}" causes overflow"" " )
781
781
}
782
782
783
783
Seq (
@@ -792,7 +792,7 @@ class CastSuite extends CastSuiteBase {
792
792
).foreach {
793
793
case (v, toType) =>
794
794
checkExceptionInExpression[ArithmeticException ](cast(v, toType),
795
- s " Casting ${v}L to ${toType.sql} causes overflow " )
795
+ s """ Casting ${v}L to " ${toType.sql}" causes overflow"" " )
796
796
}
797
797
}
798
798
@@ -829,7 +829,7 @@ class CastSuite extends CastSuiteBase {
829
829
case (v, dt, toType) =>
830
830
val value = Literal .create(v, dt)
831
831
checkExceptionInExpression[ArithmeticException ](cast(value, toType),
832
- s " Casting $value to ${toType.sql} causes overflow " )
832
+ s """ Casting $value to " ${toType.sql}" causes overflow"" " )
833
833
}
834
834
835
835
Seq (
@@ -887,7 +887,7 @@ class CastSuite extends CastSuiteBase {
887
887
).foreach {
888
888
case (v, toType) =>
889
889
checkExceptionInExpression[ArithmeticException ](cast(v, toType),
890
- s " Casting $v to ${toType.sql} causes overflow " )
890
+ s """ Casting $v to " ${toType.sql}" causes overflow"" " )
891
891
}
892
892
893
893
Seq (
@@ -898,7 +898,7 @@ class CastSuite extends CastSuiteBase {
898
898
).foreach {
899
899
case (v, toType) =>
900
900
checkExceptionInExpression[ArithmeticException ](cast(v, toType),
901
- s " Casting ${v}L to ${toType.sql} causes overflow " )
901
+ s """ Casting ${v}L to " ${toType.sql}" causes overflow"" " )
902
902
}
903
903
}
904
904
}
0 commit comments