@@ -704,15 +704,16 @@ private static Expression castDecimalV3Literal(DecimalV3Literal literal, int pre
704704 */
705705 @ ExecFunction (name = "round" )
706706 public static Expression round (DecimalV3Literal first ) {
707- return castDecimalV3Literal (first .round (0 ), first .getValue (). precision ());
707+ return castDecimalV3Literal (first .round (0 ), (( DecimalV3Type ) first .getDataType ()). getPrecision ());
708708 }
709709
710710 /**
711711 * round
712712 */
713713 @ ExecFunction (name = "round" )
714714 public static Expression round (DecimalV3Literal first , IntegerLiteral second ) {
715- return castDecimalV3Literal (first .round (second .getValue ()), first .getValue ().precision ());
715+ return castDecimalV3Literal (first .round (second .getValue ()),
716+ ((DecimalV3Type ) first .getDataType ()).getPrecision ());
716717 }
717718
718719 /**
@@ -738,15 +739,16 @@ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
738739 */
739740 @ ExecFunction (name = "ceil" )
740741 public static Expression ceil (DecimalV3Literal first ) {
741- return castDecimalV3Literal (first .roundCeiling (0 ), first .getValue (). precision ());
742+ return castDecimalV3Literal (first .roundCeiling (0 ), (( DecimalV3Type ) first .getDataType ()). getPrecision ());
742743 }
743744
744745 /**
745746 * ceil
746747 */
747748 @ ExecFunction (name = "ceil" )
748749 public static Expression ceil (DecimalV3Literal first , IntegerLiteral second ) {
749- return castDecimalV3Literal (first .roundCeiling (second .getValue ()), first .getValue ().precision ());
750+ return castDecimalV3Literal (first .roundCeiling (second .getValue ()),
751+ ((DecimalV3Type ) first .getDataType ()).getPrecision ());
750752 }
751753
752754 /**
@@ -772,15 +774,16 @@ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
772774 */
773775 @ ExecFunction (name = "floor" )
774776 public static Expression floor (DecimalV3Literal first ) {
775- return castDecimalV3Literal (first .roundFloor (0 ), first .getValue (). precision ());
777+ return castDecimalV3Literal (first .roundFloor (0 ), (( DecimalV3Type ) first .getDataType ()). getPrecision ());
776778 }
777779
778780 /**
779781 * floor
780782 */
781783 @ ExecFunction (name = "floor" )
782784 public static Expression floor (DecimalV3Literal first , IntegerLiteral second ) {
783- return castDecimalV3Literal (first .roundFloor (second .getValue ()), first .getValue ().precision ());
785+ return castDecimalV3Literal (first .roundFloor (second .getValue ()),
786+ ((DecimalV3Type ) first .getDataType ()).getPrecision ());
784787 }
785788
786789 /**
@@ -1142,9 +1145,11 @@ public static Expression truncate(DecimalV3Literal first, IntegerLiteral second)
11421145 if (first .getValue ().compareTo (BigDecimal .ZERO ) == 0 ) {
11431146 return first ;
11441147 } else if (first .getValue ().compareTo (BigDecimal .ZERO ) < 0 ) {
1145- return castDecimalV3Literal (first .roundCeiling (second .getValue ()), first .getValue ().precision ());
1148+ return castDecimalV3Literal (first .roundCeiling (second .getValue ()),
1149+ ((DecimalV3Type ) first .getDataType ()).getPrecision ());
11461150 } else {
1147- return castDecimalV3Literal (first .roundFloor (second .getValue ()), first .getValue ().precision ());
1151+ return castDecimalV3Literal (first .roundFloor (second .getValue ()),
1152+ ((DecimalV3Type ) first .getDataType ()).getPrecision ());
11481153 }
11491154 }
11501155
0 commit comments