Commit aed82bf
[Fix](Nereids) fix floor/round/ceil/truncate functions type compute precision problem (#43422)
- Problem
function like ```select floor(300.343, 2)``` precision should be 5 and
scale should be 2, but now is (6, 2) after compute precision, but after
folding const on fe, it changed to (5, 2) but upper level of plan still
expect the output of child to be (6, 2). So it would rise an exception
when executing.
- How it was fixed
fix folding constant precision of floor/round/ceil/truncate functions
from (5, 2) to (6, 2) in upper case
- Notion
when second value is negative and it absolute value >= precision -
value, it can not be expressed in fe which result is zero with decimal
type (3, 0). like 000. So just let it go back and no using folding
constant by fe.
- Related PR: #40744
- Release note
Fix floor/round/ceil functions precision problem in folding constant1 parent fbf81f4 commit aed82bf
File tree
2 files changed
+39
-20
lines changed- fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable
- regression-test/suites/nereids_p0/expression/fold_constant
2 files changed
+39
-20
lines changedLines changed: 14 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
697 | 702 | | |
698 | 703 | | |
699 | 704 | | |
700 | 705 | | |
701 | 706 | | |
702 | | - | |
| 707 | + | |
703 | 708 | | |
704 | 709 | | |
705 | 710 | | |
706 | 711 | | |
707 | 712 | | |
708 | 713 | | |
709 | 714 | | |
710 | | - | |
| 715 | + | |
711 | 716 | | |
712 | 717 | | |
713 | 718 | | |
| |||
733 | 738 | | |
734 | 739 | | |
735 | 740 | | |
736 | | - | |
| 741 | + | |
737 | 742 | | |
738 | 743 | | |
739 | 744 | | |
740 | 745 | | |
741 | 746 | | |
742 | 747 | | |
743 | 748 | | |
744 | | - | |
| 749 | + | |
745 | 750 | | |
746 | 751 | | |
747 | 752 | | |
| |||
767 | 772 | | |
768 | 773 | | |
769 | 774 | | |
770 | | - | |
| 775 | + | |
771 | 776 | | |
772 | 777 | | |
773 | 778 | | |
774 | 779 | | |
775 | 780 | | |
776 | 781 | | |
777 | 782 | | |
778 | | - | |
| 783 | + | |
779 | 784 | | |
780 | 785 | | |
781 | 786 | | |
| |||
1136 | 1141 | | |
1137 | 1142 | | |
1138 | 1143 | | |
| 1144 | + | |
| 1145 | + | |
1139 | 1146 | | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
| 1147 | + | |
1154 | 1148 | | |
1155 | 1149 | | |
1156 | 1150 | | |
| |||
regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
412 | 437 | | |
0 commit comments