You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "LiBinfeng-01 (via GitHub)" <gi...@apache.org> on 2024/09/12 08:56:24 UTC
[PR] [Feat](Nereids) add numeric functions [doris]
LiBinfeng-01 opened a new pull request, #40744:
URL: https://github.com/apache/doris/pull/40744
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2358146988
<details>
<summary>ClickBench: <b>Total hot run time: 32.66 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 4ee347956f142cfd30ea2232d5fd30e153300f76, data reload: false
query1 0.05 0.04 0.04
query2 0.06 0.03 0.02
query3 0.23 0.06 0.06
query4 1.65 0.10 0.10
query5 0.52 0.51 0.52
query6 1.14 0.73 0.72
query7 0.01 0.01 0.02
query8 0.04 0.03 0.03
query9 0.56 0.51 0.49
query10 0.55 0.55 0.55
query11 0.14 0.11 0.10
query12 0.14 0.11 0.11
query13 0.60 0.60 0.60
query14 3.08 2.99 3.15
query15 0.90 0.82 0.81
query16 0.38 0.39 0.41
query17 1.03 1.08 1.07
query18 0.23 0.21 0.20
query19 2.01 1.92 1.99
query20 0.01 0.00 0.01
query21 15.35 0.62 0.56
query22 2.66 1.94 2.02
query23 17.45 0.92 0.86
query24 2.49 0.99 0.58
query25 0.15 0.19 0.05
query26 0.42 0.15 0.13
query27 0.04 0.05 0.03
query28 11.45 1.09 1.07
query29 12.57 3.34 3.28
query30 0.25 0.07 0.06
query31 2.87 0.38 0.38
query32 3.27 0.47 0.45
query33 2.97 3.00 3.08
query34 17.08 4.35 4.38
query35 4.41 4.45 4.43
query36 0.68 0.48 0.48
query37 0.08 0.06 0.05
query38 0.04 0.03 0.03
query39 0.03 0.02 0.02
query40 0.16 0.12 0.12
query41 0.08 0.02 0.02
query42 0.04 0.02 0.02
query43 0.03 0.03 0.03
Total cold run time: 107.9 s
Total hot run time: 32.66 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2359894615
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2360600528
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2346593658
<details>
<summary>TPC-DS: <b>Total hot run time: 195717 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 76a098e407d90eaee4f428c5ca3330c59ba02ee9, data reload: false
query1 923 380 373 373
query2 6511 1844 1835 1835
query3 6665 212 231 212
query4 27070 24186 24092 24092
query5 5449 542 538 538
query6 261 181 201 181
query7 4602 307 308 307
query8 284 247 228 228
query9 8529 2565 2548 2548
query10 491 299 287 287
query11 16435 15669 15785 15669
query12 154 104 99 99
query13 1682 404 390 390
query14 11762 6903 6791 6791
query15 227 166 174 166
query16 7586 492 490 490
query17 1554 580 575 575
query18 1992 304 295 295
query19 196 148 147 147
query20 121 110 112 110
query21 209 108 106 106
query22 4450 4417 4251 4251
query23 34937 33923 33827 33827
query24 9494 3080 3068 3068
query25 677 392 399 392
query26 1591 155 158 155
query27 2861 280 290 280
query28 6846 2089 2073 2073
query29 1047 411 419 411
query30 300 155 147 147
query31 979 783 813 783
query32 109 57 56 56
query33 746 304 295 295
query34 894 495 482 482
query35 869 725 762 725
query36 1026 907 907 907
query37 164 93 84 84
query38 4137 3895 3931 3895
query39 1468 1404 1410 1404
query40 289 115 116 115
query41 48 46 46 46
query42 119 96 96 96
query43 519 447 453 447
query44 1211 795 786 786
query45 194 167 171 167
query46 1102 821 790 790
query47 1903 1776 1819 1776
query48 369 295 295 295
query49 1191 441 442 441
query50 918 432 447 432
query51 7026 7003 6952 6952
query52 110 89 89 89
query53 256 185 184 184
query54 760 461 478 461
query55 79 80 76 76
query56 279 261 267 261
query57 1195 1079 1095 1079
query58 243 249 236 236
query59 2823 2605 2698 2605
query60 300 283 268 268
query61 103 103 108 103
query62 915 673 675 673
query63 234 189 188 188
query64 5187 731 678 678
query65 3265 3197 3172 3172
query66 1398 292 303 292
query67 16035 15580 15566 15566
query68 3157 871 856 856
query69 441 334 328 328
query70 1168 1163 1134 1134
query71 345 346 347 346
query72 5902 3372 3398 3372
query73 595 582 579 579
query74 9309 9220 9070 9070
query75 3164 3016 3036 3016
query76 1856 849 848 848
query77 435 410 409 409
query78 9402 9284 9265 9265
query79 893 909 877 877
query80 851 815 821 815
query81 448 265 263 263
query82 265 266 262 262
query83 190 186 191 186
query84 243 109 108 108
query85 719 422 405 405
query86 318 320 302 302
query87 4313 4348 4496 4348
query88 4219 4131 4119 4119
query89 377 370 370 370
query90 1274 323 319 319
query91 126 131 126 126
query92 78 75 78 75
query93 1033 1024 1019 1019
query94 611 392 381 381
query95 454 426 426 426
query96 476 469 472 469
query97 3120 3132 3159 3132
query98 233 232 240 232
query99 1553 1312 1338 1312
Total cold run time: 280937 ms
Total hot run time: 195717 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764665289
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
Review Comment:
done
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357956359
<details>
<summary>TPC-DS: <b>Total hot run time: 194806 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit efc74eac8a2eb6c04e1005c953f87042ff4bfd8b, data reload: false
query1 939 392 372 372
query2 6503 2010 2020 2010
query3 6701 211 227 211
query4 36844 23447 23375 23375
query5 4357 492 481 481
query6 254 169 158 158
query7 4617 294 299 294
query8 266 222 226 222
query9 9775 2690 2652 2652
query10 473 301 284 284
query11 18123 15291 15265 15265
query12 150 97 104 97
query13 1616 410 392 392
query14 9318 7628 7503 7503
query15 295 183 176 176
query16 8020 426 483 426
query17 1747 582 570 570
query18 2114 312 306 306
query19 361 154 150 150
query20 119 110 115 110
query21 222 107 107 107
query22 4461 4249 4106 4106
query23 34642 34019 33826 33826
query24 11153 2877 2895 2877
query25 653 408 407 407
query26 1209 166 165 165
query27 2708 288 292 288
query28 7941 2472 2432 2432
query29 859 417 433 417
query30 328 170 156 156
query31 1030 787 807 787
query32 105 59 59 59
query33 775 306 294 294
query34 963 487 494 487
query35 868 743 762 743
query36 1082 939 947 939
query37 157 99 82 82
query38 4051 3913 3880 3880
query39 1466 1449 1402 1402
query40 214 98 99 98
query41 52 48 48 48
query42 125 106 100 100
query43 509 480 480 480
query44 1254 822 800 800
query45 198 167 165 165
query46 1142 765 794 765
query47 1890 1788 1846 1788
query48 461 375 367 367
query49 1140 430 410 410
query50 831 406 406 406
query51 6984 7087 6974 6974
query52 100 89 88 88
query53 259 186 183 183
query54 1317 469 473 469
query55 83 79 78 78
query56 304 268 269 268
query57 1213 1081 1100 1081
query58 254 228 241 228
query59 3086 2877 2854 2854
query60 300 294 276 276
query61 131 238 101 101
query62 879 677 678 677
query63 228 211 183 183
query64 5247 643 628 628
query65 3366 3214 3220 3214
query66 1466 333 301 301
query67 16202 15687 15484 15484
query68 3248 691 570 570
query69 437 285 287 285
query70 1213 1086 1128 1086
query71 336 273 269 269
query72 6118 4090 4014 4014
query73 760 326 338 326
query74 9819 9031 8997 8997
query75 3418 2663 2679 2663
query76 1966 931 947 931
query77 416 297 299 297
query78 9960 10473 9317 9317
query79 1085 899 870 870
query80 884 593 588 588
query81 571 256 258 256
query82 575 236 232 232
query83 206 162 177 162
query84 254 107 105 105
query85 816 382 354 354
query86 396 312 330 312
query87 4403 4348 4361 4348
query88 4438 4043 4045 4043
query89 379 371 359 359
query90 2013 315 308 308
query91 165 167 162 162
query92 83 75 75 75
query93 932 915 904 904
query94 1038 363 360 360
query95 483 413 413 413
query96 490 485 484 484
query97 3117 3183 3176 3176
query98 232 248 229 229
query99 1407 1300 1289 1289
Total cold run time: 298158 ms
Total hot run time: 194806 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "englefly (via GitHub)" <gi...@apache.org>.
englefly commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1766087821
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,515 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
Review Comment:
why "coalesce" is numericArithmetic?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2362563898
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2356077222
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1770741553
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,506 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ private static Expression filterNanResult(Literal input) {
+ if (input instanceof DoubleLiteral) {
+ if (((DoubleLiteral) input).getValue().isNaN()) {
+ return new NullLiteral(input.getDataType());
+ }
+ }
+ return input;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.round(0).getDouble()));
Review Comment:
why round need filterNanResult?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,506 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ private static Expression filterNanResult(Literal input) {
+ if (input instanceof DoubleLiteral) {
+ if (((DoubleLiteral) input).getValue().isNaN()) {
+ return new NullLiteral(input.getDataType());
+ }
+ }
+ return input;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.round(0).getDouble()));
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.round(second.getValue()).getDouble()));
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundCeiling(0).getDouble()));
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble()));
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundFloor(0).getDouble()));
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble()));
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return filterNanResult(new DoubleLiteral(Math.exp(first.getValue())));
Review Comment:
only nan input will lead to nan result? so why filter nan here?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,506 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ private static Expression filterNanResult(Literal input) {
+ if (input instanceof DoubleLiteral) {
+ if (((DoubleLiteral) input).getValue().isNaN()) {
+ return new NullLiteral(input.getDataType());
+ }
+ }
+ return input;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.round(0).getDouble()));
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.round(second.getValue()).getDouble()));
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundCeiling(0).getDouble()));
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble()));
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundFloor(0).getDouble()));
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return filterNanResult(new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble()));
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return filterNanResult(new DoubleLiteral(Math.exp(first.getValue())));
+ }
+
+ /**
+ * ln
+ */
+ @ExecFunction(name = "ln")
+ public static Expression ln(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return filterNanResult(new DoubleLiteral(Math.log(first.getValue())));
Review Comment:
same as exp
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -194,7 +248,7 @@ public static Expression addLargeIntLargeInt(LargeIntLiteral first, LargeIntLite
@ExecFunction(name = "add")
public static Expression addDoubleDouble(DoubleLiteral first, DoubleLiteral second) {
double result = first.getValue() + second.getValue();
- return new DoubleLiteral(result);
+ return filterNanResult(new DoubleLiteral(result));
Review Comment:
why add need filterNanResult?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2349200988
<details>
<summary>TPC-H: <b>Total hot run time: 43027 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 4d76abbb137bd2f6863b0153d6f42aa78c3454a6, data reload: false
------ Round 1 ----------------------------------
q1 17574 7272 7219 7219
q2 2031 182 182 182
q3 10465 1280 1423 1280
q4 10486 1011 981 981
q5 7719 3180 3182 3180
q6 242 153 147 147
q7 1044 642 628 628
q8 9475 2038 2036 2036
q9 6865 6325 6339 6325
q10 7029 2524 2510 2510
q11 436 257 252 252
q12 411 232 231 231
q13 17756 3036 3008 3008
q14 295 258 254 254
q15 596 536 531 531
q16 513 428 425 425
q17 980 945 968 945
q18 7313 6832 6822 6822
q19 1389 1239 1234 1234
q20 609 337 335 335
q21 3917 3540 3515 3515
q22 1089 1003 987 987
Total cold run time: 108234 ms
Total hot run time: 43027 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7276 7198 7178 7178
q2 348 245 233 233
q3 3102 3077 3045 3045
q4 2088 2114 2017 2017
q5 5755 5606 5738 5606
q6 241 146 147 146
q7 2179 1803 1763 1763
q8 3404 3412 3405 3405
q9 8821 8880 8751 8751
q10 3474 3574 3573 3573
q11 583 475 488 475
q12 828 627 604 604
q13 9997 3205 3199 3199
q14 325 276 289 276
q15 594 540 541 540
q16 518 464 472 464
q17 1807 1766 1767 1766
q18 8628 7928 8105 7928
q19 1767 1743 1747 1743
q20 2142 1891 1891 1891
q21 5769 5723 5685 5685
q22 1135 1086 1027 1027
Total cold run time: 70781 ms
Total hot run time: 61315 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2350833660
<details>
<summary>TPC-H: <b>Total hot run time: 42953 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 5d902674c20c30ffc2191a8b60de3f9ca7ca4b82, data reload: false
------ Round 1 ----------------------------------
q1 17564 7320 7228 7228
q2 2039 182 182 182
q3 10462 1257 1353 1257
q4 10513 1042 1052 1042
q5 7721 3144 3136 3136
q6 241 154 151 151
q7 1039 638 623 623
q8 9461 1993 2023 1993
q9 6802 6280 6291 6280
q10 7036 2504 2518 2504
q11 447 259 259 259
q12 412 231 228 228
q13 17770 3010 3048 3010
q14 294 244 248 244
q15 598 527 522 522
q16 514 451 429 429
q17 981 945 960 945
q18 7350 6849 6846 6846
q19 1364 1265 1231 1231
q20 599 326 337 326
q21 3939 3542 3544 3542
q22 1086 975 978 975
Total cold run time: 108232 ms
Total hot run time: 42953 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7228 7226 7191 7191
q2 350 255 236 236
q3 3067 3087 3067 3067
q4 2108 2118 2045 2045
q5 5666 5650 5706 5650
q6 242 150 150 150
q7 2156 1792 1797 1792
q8 3352 3458 3405 3405
q9 8833 8890 8778 8778
q10 3458 3577 3588 3577
q11 581 485 479 479
q12 827 626 634 626
q13 8745 3196 3238 3196
q14 308 291 279 279
q15 581 538 538 538
q16 516 472 456 456
q17 1794 1758 1765 1758
q18 8496 8044 7887 7887
q19 1772 1765 1755 1755
q20 2141 1888 1879 1879
q21 5987 5469 5700 5469
q22 1124 1044 1047 1044
Total cold run time: 69332 ms
Total hot run time: 61257 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2346606038
<details>
<summary>ClickBench: <b>Total hot run time: 31.02 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 76a098e407d90eaee4f428c5ca3330c59ba02ee9, data reload: false
query1 0.04 0.05 0.04
query2 0.07 0.04 0.04
query3 0.22 0.04 0.04
query4 1.69 0.06 0.06
query5 0.51 0.50 0.51
query6 1.14 0.74 0.74
query7 0.03 0.02 0.02
query8 0.05 0.04 0.05
query9 0.56 0.53 0.52
query10 0.56 0.57 0.56
query11 0.16 0.12 0.12
query12 0.16 0.13 0.13
query13 0.62 0.60 0.60
query14 1.47 1.46 1.46
query15 0.90 0.88 0.88
query16 0.37 0.36 0.36
query17 1.06 1.06 1.05
query18 0.22 0.20 0.21
query19 1.92 1.81 1.79
query20 0.01 0.02 0.01
query21 15.43 0.66 0.65
query22 4.77 6.93 1.25
query23 18.10 1.28 1.26
query24 2.24 0.23 0.22
query25 0.18 0.08 0.08
query26 0.29 0.18 0.17
query27 0.08 0.08 0.07
query28 13.19 1.11 1.10
query29 12.64 3.35 3.37
query30 0.24 0.05 0.05
query31 2.88 0.41 0.40
query32 3.22 0.49 0.50
query33 3.04 3.00 3.08
query34 15.46 4.33 4.34
query35 4.41 4.34 4.36
query36 0.69 0.49 0.48
query37 0.19 0.16 0.17
query38 0.17 0.15 0.16
query39 0.05 0.05 0.04
query40 0.17 0.14 0.13
query41 0.10 0.05 0.05
query42 0.06 0.05 0.05
query43 0.06 0.04 0.04
Total cold run time: 109.42 s
Total hot run time: 31.02 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2359894576
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764466197
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
Review Comment:
add fe ut test for all functions
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
Review Comment:
same as round, if second > old scale, the result is wrong
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
Review Comment:
same as ceil
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java:
##########
@@ -84,6 +84,12 @@ public DecimalV3Literal roundFloor(int newScale) {
value.setScale(newScale, RoundingMode.FLOOR));
}
+ public DecimalV3Literal round(int newScale) {
+ return new DecimalV3Literal(DecimalV3Type
+ .createDecimalV3Type(((DecimalV3Type) dataType).getPrecision(), newScale),
Review Comment:
what scale should be set if newScale bigger than old scale?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
Review Comment:
what will happen if result of Math.exp is infinity?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357376367
<details>
<summary>TPC-H: <b>Total hot run time: 41979 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 309ada3b88104cc70cee6eda36c1a3144dfc58dd, data reload: false
------ Round 1 ----------------------------------
q1 17810 8006 7355 7355
q2 2058 161 158 158
q3 12239 1151 1146 1146
q4 10417 807 692 692
q5 7750 3127 3081 3081
q6 243 155 147 147
q7 1017 623 623 623
q8 10536 2037 2046 2037
q9 6963 6544 6525 6525
q10 7141 2298 2346 2298
q11 440 256 255 255
q12 415 224 226 224
q13 19262 3046 3066 3046
q14 232 213 269 213
q15 571 523 530 523
q16 1085 640 610 610
q17 1195 858 860 858
q18 8518 6652 6631 6631
q19 1404 1019 1019 1019
q20 574 291 287 287
q21 4002 3341 3243 3243
q22 1111 1022 1008 1008
Total cold run time: 114983 ms
Total hot run time: 41979 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7280 7299 7378 7299
q2 340 236 247 236
q3 3164 2934 2994 2934
q4 2107 1758 1754 1754
q5 5604 5650 5659 5650
q6 227 148 142 142
q7 2192 1807 1802 1802
q8 3322 3395 3407 3395
q9 8873 8760 8687 8687
q10 3475 3507 3500 3500
q11 585 482 489 482
q12 810 627 637 627
q13 12614 3126 3184 3126
q14 325 264 272 264
q15 561 540 528 528
q16 720 686 682 682
q17 1824 1582 1572 1572
q18 8141 7793 7764 7764
q19 1694 1611 1578 1578
q20 2108 1877 1890 1877
q21 5559 5413 5361 5361
q22 1160 1051 1052 1051
Total cold run time: 72685 ms
Total hot run time: 60311 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357483938
run performance
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1766236980
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java:
##########
@@ -84,6 +84,12 @@ public DecimalV3Literal roundFloor(int newScale) {
value.setScale(newScale, RoundingMode.FLOOR));
}
+ public DecimalV3Literal round(int newScale) {
+ return new DecimalV3Literal(DecimalV3Type
+ .createDecimalV3Type(((DecimalV3Type) dataType).getPrecision(), newScale),
Review Comment:
> when new scale is larger than original one, it would throw an Invocationexception when calling create Decimal Type in java with message: precision should not smaller than scale and ExpressionEvaluator would catch this exception and go back to original expression. But actually when new scalar bigger than old one, we can return original one when folding constant. Same as be calculation logic
we should not rely on exception, exception is very expensive, so we should process it without use exception
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
Review Comment:
move if into `roundCeiling`
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,515 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
+ }
+
+ /**
+ * ln
+ */
+ @ExecFunction(name = "ln")
+ public static Expression ln(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()));
+ }
+
+ /**
+ * log
+ */
+ @ExecFunction(name = "log")
+ public static Expression log(DoubleLiteral first, DoubleLiteral second) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()) / Math.log(second.getValue()));
+ }
+
+ /**
+ * log2
+ */
+ @ExecFunction(name = "log2")
+ public static Expression log2(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()) / Math.log(2.0));
+ }
+
+ /**
+ * log10
+ */
+ @ExecFunction(name = "log10")
+ public static Expression log10(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log10(first.getValue()));
+ }
+
+ /**
+ * sqrt
+ */
+ @ExecFunction(name = "sqrt")
+ public static Expression sqrt(DoubleLiteral first) {
+ if (first.getValue() < 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.sqrt(first.getValue()));
+ }
+
+ /**
+ * power
+ */
+ @ExecFunction(name = "power")
+ public static Expression power(DoubleLiteral first, DoubleLiteral second) {
+ return new DoubleLiteral(Math.pow(first.getValue(), second.getValue()));
Review Comment:
pow could return infinity or NaN in many cases, u should process them correctly: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-
please check all function one by one according to java doc
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,515 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
Review Comment:
this `if` statement should move into `DecimalV3Literal#round`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357333205
run performance
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357888381
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2362564010
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2346565876
<details>
<summary>TPC-H: <b>Total hot run time: 43005 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 76a098e407d90eaee4f428c5ca3330c59ba02ee9, data reload: false
------ Round 1 ----------------------------------
q1 17629 7331 7208 7208
q2 2035 188 203 188
q3 10457 1358 1391 1358
q4 10402 1004 1059 1004
q5 8308 3242 3166 3166
q6 241 155 150 150
q7 1049 641 652 641
q8 9469 2017 2004 2004
q9 6758 6297 6362 6297
q10 7029 2527 2551 2527
q11 426 257 258 257
q12 407 232 230 230
q13 17764 3077 3041 3041
q14 290 252 253 252
q15 601 542 539 539
q16 513 423 434 423
q17 999 940 946 940
q18 7604 6731 6872 6731
q19 1380 1234 1228 1228
q20 606 358 333 333
q21 3886 3533 3491 3491
q22 1085 997 1030 997
Total cold run time: 108938 ms
Total hot run time: 43005 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7193 7196 7144 7144
q2 337 232 232 232
q3 2902 2921 2920 2920
q4 1950 1938 1949 1938
q5 5462 5436 5438 5436
q6 234 143 142 142
q7 2030 1692 1662 1662
q8 3235 3305 3341 3305
q9 8451 8404 8409 8404
q10 3428 3462 3483 3462
q11 582 472 469 469
q12 771 591 562 562
q13 9835 3060 3086 3060
q14 298 274 275 274
q15 563 520 517 517
q16 485 453 452 452
q17 1755 1699 1669 1669
q18 8039 7518 7711 7518
q19 1713 1689 1690 1689
q20 2021 1801 1805 1801
q21 5581 5406 5563 5406
q22 1124 1020 997 997
Total cold run time: 67989 ms
Total hot run time: 59059 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1766090782
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,515 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
Review Comment:
actually it is not only numeric arithmetic, but it is hard to well classify, so I put it here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2345686587
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764531179
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
Review Comment:
It should return null literal, in java it would return infinite value when it is infinity, would return NaN when the input is Invalid like acos(-2) which input should between [-1, 1]. In sql behavior, it should return NULL, when it is NaN or infinity(positive, negative is same logic). Let me add some boundary check in some functions
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
Review Comment:
get
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357929545
<details>
<summary>TPC-H: <b>Total hot run time: 41728 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit efc74eac8a2eb6c04e1005c953f87042ff4bfd8b, data reload: false
------ Round 1 ----------------------------------
q1 17957 7476 7315 7315
q2 2379 164 154 154
q3 11390 1165 1253 1165
q4 10298 822 749 749
q5 7763 3098 3120 3098
q6 238 151 150 150
q7 1021 628 630 628
q8 9539 2044 2063 2044
q9 6869 6387 6368 6368
q10 7004 2273 2283 2273
q11 446 260 252 252
q12 412 213 213 213
q13 17768 2998 2988 2988
q14 245 224 223 223
q15 584 535 510 510
q16 691 604 604 604
q17 973 839 770 770
q18 7354 6708 6800 6708
q19 1393 1049 1001 1001
q20 573 283 279 279
q21 4040 3246 3287 3246
q22 1094 996 990 990
Total cold run time: 110031 ms
Total hot run time: 41728 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7305 7265 7278 7265
q2 332 235 223 223
q3 2890 2761 2751 2751
q4 2059 1702 1697 1697
q5 5327 5391 5399 5391
q6 235 141 142 141
q7 2082 1723 1704 1704
q8 3181 3300 3292 3292
q9 8445 8338 8420 8338
q10 3411 3363 3338 3338
q11 576 474 478 474
q12 784 569 595 569
q13 6244 2964 3000 2964
q14 293 261 262 261
q15 555 517 518 517
q16 694 671 668 668
q17 1752 1551 1524 1524
q18 7538 7441 7321 7321
q19 1659 1658 1451 1451
q20 2030 1796 1776 1776
q21 5285 5001 5270 5001
q22 1137 1023 1022 1022
Total cold run time: 63814 ms
Total hot run time: 57688 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2356293138
<details>
<summary>TPC-H: <b>Total hot run time: 41212 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 309ada3b88104cc70cee6eda36c1a3144dfc58dd, data reload: false
------ Round 1 ----------------------------------
q1 17623 7400 7282 7282
q2 2031 175 153 153
q3 10649 1080 1118 1080
q4 10567 712 735 712
q5 7738 3029 3039 3029
q6 234 150 145 145
q7 993 612 600 600
q8 9426 1999 2009 1999
q9 6869 6404 6404 6404
q10 7019 2253 2299 2253
q11 443 245 250 245
q12 403 211 216 211
q13 17804 2935 2975 2935
q14 235 212 211 211
q15 579 531 508 508
q16 667 613 629 613
q17 983 758 794 758
q18 7292 6668 6600 6600
q19 1414 1039 1111 1039
q20 575 283 280 280
q21 4111 3176 3157 3157
q22 1119 998 1005 998
Total cold run time: 108774 ms
Total hot run time: 41212 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7241 7305 7212 7212
q2 317 232 220 220
q3 2996 2952 2981 2952
q4 2029 1796 1804 1796
q5 5643 5621 5566 5566
q6 234 140 152 140
q7 2261 1819 1765 1765
q8 3307 3416 3396 3396
q9 8696 8892 8780 8780
q10 3552 3427 3489 3427
q11 589 480 485 480
q12 820 605 596 596
q13 10885 3164 3135 3135
q14 309 278 283 278
q15 571 548 506 506
q16 712 677 698 677
q17 1782 1599 1607 1599
q18 8243 7860 7919 7860
q19 1720 1523 1582 1523
q20 2135 1851 1906 1851
q21 5492 5148 5293 5148
q22 1189 1031 1058 1031
Total cold run time: 70723 ms
Total hot run time: 59938 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2350822331
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764665803
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java:
##########
@@ -84,6 +84,12 @@ public DecimalV3Literal roundFloor(int newScale) {
value.setScale(newScale, RoundingMode.FLOOR));
}
+ public DecimalV3Literal round(int newScale) {
+ return new DecimalV3Literal(DecimalV3Type
+ .createDecimalV3Type(((DecimalV3Type) dataType).getPrecision(), newScale),
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357333364
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357386914
<details>
<summary>TPC-DS: <b>Total hot run time: 199206 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 309ada3b88104cc70cee6eda36c1a3144dfc58dd, data reload: false
query1 1300 877 868 868
query2 6379 2107 2040 2040
query3 10763 3959 3884 3884
query4 63162 29455 23421 23421
query5 5151 461 453 453
query6 397 171 165 165
query7 5452 314 295 295
query8 309 237 222 222
query9 8602 2659 2673 2659
query10 449 307 282 282
query11 17695 15014 15662 15014
query12 166 103 101 101
query13 1481 427 430 427
query14 10185 7372 7636 7372
query15 210 183 176 176
query16 6391 460 524 460
query17 1184 615 596 596
query18 844 300 311 300
query19 221 158 151 151
query20 127 109 117 109
query21 206 109 112 109
query22 4736 4564 4798 4564
query23 34668 34060 34131 34060
query24 6042 2929 2902 2902
query25 512 388 400 388
query26 637 161 163 161
query27 1626 283 287 283
query28 4187 2475 2411 2411
query29 680 440 433 433
query30 239 159 154 154
query31 972 781 809 781
query32 72 54 56 54
query33 441 293 285 285
query34 890 500 496 496
query35 878 741 745 741
query36 1030 908 937 908
query37 154 91 88 88
query38 3976 3887 4109 3887
query39 1469 1399 1376 1376
query40 213 98 97 97
query41 49 48 47 47
query42 111 95 99 95
query43 520 496 497 496
query44 1146 805 813 805
query45 196 164 163 163
query46 1119 737 767 737
query47 1946 1790 1821 1790
query48 476 364 381 364
query49 702 412 410 410
query50 840 412 499 412
query51 7105 7000 6923 6923
query52 98 85 88 85
query53 252 173 175 173
query54 573 448 448 448
query55 76 75 79 75
query56 274 250 246 246
query57 1204 1080 1064 1064
query58 215 237 235 235
query59 3417 2966 3104 2966
query60 304 264 277 264
query61 103 100 119 100
query62 745 654 659 654
query63 209 184 182 182
query64 1345 644 665 644
query65 3282 3165 3211 3165
query66 665 294 307 294
query67 16262 15642 15487 15487
query68 1577 567 560 560
query69 425 294 304 294
query70 1184 1129 1107 1107
query71 320 266 270 266
query72 6014 4003 3959 3959
query73 757 336 332 332
query74 9366 8962 9052 8962
query75 3325 2642 2718 2642
query76 1429 964 920 920
query77 476 292 291 291
query78 10212 9579 9392 9392
query79 1060 897 882 882
query80 841 586 577 577
query81 508 261 251 251
query82 1290 235 231 231
query83 237 168 162 162
query84 290 109 107 107
query85 793 367 360 360
query86 351 334 321 321
query87 4354 4341 4420 4341
query88 4412 4062 4055 4055
query89 390 359 364 359
query90 1789 312 310 310
query91 160 164 167 164
query92 75 75 71 71
query93 952 904 913 904
query94 728 366 395 366
query95 446 413 410 410
query96 484 488 484 484
query97 3240 3118 3170 3118
query98 231 220 223 220
query99 1522 1291 1317 1291
Total cold run time: 306568 ms
Total hot run time: 199206 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357391413
<details>
<summary>ClickBench: <b>Total hot run time: 32.1 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 309ada3b88104cc70cee6eda36c1a3144dfc58dd, data reload: false
query1 0.05 0.05 0.05
query2 0.06 0.02 0.02
query3 0.23 0.06 0.07
query4 1.65 0.10 0.11
query5 0.53 0.48 0.51
query6 1.16 0.72 0.72
query7 0.03 0.02 0.01
query8 0.04 0.02 0.04
query9 0.55 0.51 0.50
query10 0.55 0.59 0.54
query11 0.14 0.10 0.10
query12 0.14 0.11 0.10
query13 0.60 0.60 0.59
query14 3.09 2.93 2.95
query15 0.90 0.81 0.82
query16 0.38 0.37 0.38
query17 1.06 1.06 1.05
query18 0.20 0.19 0.19
query19 1.95 1.89 2.04
query20 0.01 0.01 0.01
query21 15.36 0.61 0.59
query22 2.79 2.73 1.08
query23 17.55 0.82 0.73
query24 3.25 1.01 1.51
query25 0.18 0.13 0.09
query26 0.52 0.14 0.14
query27 0.04 0.05 0.04
query28 10.22 1.10 1.06
query29 12.55 3.29 3.28
query30 0.24 0.06 0.06
query31 2.88 0.38 0.38
query32 3.28 0.47 0.45
query33 2.96 3.03 3.01
query34 17.01 4.44 4.43
query35 4.43 4.40 4.42
query36 0.70 0.51 0.51
query37 0.08 0.06 0.06
query38 0.04 0.03 0.04
query39 0.04 0.02 0.02
query40 0.16 0.13 0.12
query41 0.08 0.03 0.02
query42 0.03 0.03 0.02
query43 0.04 0.04 0.03
Total cold run time: 107.75 s
Total hot run time: 32.1 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1770560213
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,515 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ if (second.getValue() >= first.getValue().scale()) {
+ return first;
+ }
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ if (second.getValue() >= middleResult.getValue().scale()) {
+ return first;
+ }
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
+ }
+
+ /**
+ * ln
+ */
+ @ExecFunction(name = "ln")
+ public static Expression ln(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()));
+ }
+
+ /**
+ * log
+ */
+ @ExecFunction(name = "log")
+ public static Expression log(DoubleLiteral first, DoubleLiteral second) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()) / Math.log(second.getValue()));
+ }
+
+ /**
+ * log2
+ */
+ @ExecFunction(name = "log2")
+ public static Expression log2(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log(first.getValue()) / Math.log(2.0));
+ }
+
+ /**
+ * log10
+ */
+ @ExecFunction(name = "log10")
+ public static Expression log10(DoubleLiteral first) {
+ if (first.getValue() <= 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.log10(first.getValue()));
+ }
+
+ /**
+ * sqrt
+ */
+ @ExecFunction(name = "sqrt")
+ public static Expression sqrt(DoubleLiteral first) {
+ if (first.getValue() < 0) {
+ return new NullLiteral(first.getDataType());
+ }
+ return new DoubleLiteral(Math.sqrt(first.getValue()));
+ }
+
+ /**
+ * power
+ */
+ @ExecFunction(name = "power")
+ public static Expression power(DoubleLiteral first, DoubleLiteral second) {
+ return new DoubleLiteral(Math.pow(first.getValue(), second.getValue()));
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764466197
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
Review Comment:
add fe ut test for all functions, each function should test
- invalid value
- boundary value
- general value
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2346510310
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2358114446
<details>
<summary>TPC-H: <b>Total hot run time: 41687 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 4ee347956f142cfd30ea2232d5fd30e153300f76, data reload: false
------ Round 1 ----------------------------------
q1 17585 7384 7295 7295
q2 2033 156 155 155
q3 10664 1146 1184 1146
q4 10237 727 782 727
q5 8083 3142 3080 3080
q6 239 152 153 152
q7 1030 640 611 611
q8 9442 2032 2013 2013
q9 6867 6432 6393 6393
q10 7001 2301 2303 2301
q11 434 249 257 249
q12 411 222 214 214
q13 17797 2966 2979 2966
q14 238 221 215 215
q15 576 525 526 525
q16 667 613 617 613
q17 973 784 803 784
q18 7413 6756 6802 6756
q19 1412 1038 1005 1005
q20 592 289 283 283
q21 4104 3198 3220 3198
q22 1103 1013 1006 1006
Total cold run time: 108901 ms
Total hot run time: 41687 ms
----- Round 2, with runtime_filter_mode=off -----
q1 7241 7252 7305 7252
q2 331 234 229 229
q3 2924 2775 2725 2725
q4 1899 1663 1697 1663
q5 5361 5400 5432 5400
q6 224 143 141 141
q7 2080 1709 1703 1703
q8 3162 3289 3350 3289
q9 8318 8355 8369 8355
q10 3377 3371 3327 3327
q11 579 479 471 471
q12 795 587 589 587
q13 8308 2978 2954 2954
q14 286 278 248 248
q15 567 525 499 499
q16 713 679 686 679
q17 1775 1547 1545 1545
q18 7657 7383 7339 7339
q19 1654 1469 1533 1469
q20 2032 1800 1809 1800
q21 5303 5238 5368 5238
q22 1134 1023 989 989
Total cold run time: 65720 ms
Total hot run time: 57902 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357968030
<details>
<summary>ClickBench: <b>Total hot run time: 33.38 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit efc74eac8a2eb6c04e1005c953f87042ff4bfd8b, data reload: false
query1 0.04 0.05 0.04
query2 0.06 0.03 0.03
query3 0.23 0.06 0.06
query4 1.66 0.10 0.10
query5 0.50 0.51 0.50
query6 1.14 0.72 0.73
query7 0.02 0.01 0.02
query8 0.03 0.03 0.04
query9 0.55 0.50 0.49
query10 0.55 0.57 0.54
query11 0.14 0.11 0.11
query12 0.14 0.10 0.11
query13 0.62 0.59 0.59
query14 2.98 3.03 2.97
query15 0.89 0.82 0.84
query16 0.36 0.39 0.36
query17 1.04 0.99 1.06
query18 0.22 0.20 0.21
query19 1.93 1.86 1.97
query20 0.01 0.00 0.01
query21 15.39 0.63 0.58
query22 2.76 2.46 1.94
query23 17.11 0.86 0.82
query24 2.59 1.53 1.47
query25 0.21 0.07 0.04
query26 0.56 0.15 0.15
query27 0.04 0.05 0.04
query28 10.11 1.10 1.08
query29 12.90 3.27 3.26
query30 0.25 0.06 0.06
query31 2.87 0.39 0.39
query32 3.28 0.46 0.46
query33 2.97 3.01 3.06
query34 17.17 4.40 4.38
query35 4.41 4.46 4.41
query36 0.66 0.47 0.50
query37 0.08 0.06 0.06
query38 0.04 0.03 0.03
query39 0.03 0.02 0.03
query40 0.15 0.12 0.13
query41 0.07 0.02 0.02
query42 0.03 0.02 0.02
query43 0.03 0.03 0.03
Total cold run time: 106.82 s
Total hot run time: 33.38 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2358137109
<details>
<summary>TPC-DS: <b>Total hot run time: 193560 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 4ee347956f142cfd30ea2232d5fd30e153300f76, data reload: false
query1 940 371 379 371
query2 6546 2101 2073 2073
query3 6704 220 230 220
query4 34427 23388 23467 23388
query5 4335 484 456 456
query6 258 172 169 169
query7 4610 292 320 292
query8 285 231 228 228
query9 9647 2654 2647 2647
query10 488 293 268 268
query11 18309 15339 15106 15106
query12 156 96 97 96
query13 1623 414 392 392
query14 10399 7369 7457 7369
query15 255 175 186 175
query16 8128 487 467 467
query17 1681 579 556 556
query18 2143 308 298 298
query19 357 148 151 148
query20 117 112 109 109
query21 219 104 105 104
query22 4572 4135 4248 4135
query23 34745 34074 33848 33848
query24 11090 2922 2985 2922
query25 637 381 389 381
query26 1397 153 157 153
query27 2765 281 276 276
query28 8170 2448 2443 2443
query29 907 408 407 407
query30 321 154 149 149
query31 1003 781 820 781
query32 93 51 55 51
query33 778 283 276 276
query34 1001 496 496 496
query35 856 745 711 711
query36 1110 946 924 924
query37 158 85 88 85
query38 4166 3946 3913 3913
query39 1457 1397 1436 1397
query40 274 95 92 92
query41 48 48 42 42
query42 116 96 94 94
query43 518 502 482 482
query44 1237 811 796 796
query45 193 164 164 164
query46 1147 753 758 753
query47 1888 1789 1849 1789
query48 456 388 354 354
query49 1127 414 389 389
query50 800 411 389 389
query51 7089 6998 6818 6818
query52 98 89 86 86
query53 262 182 179 179
query54 1229 455 454 454
query55 78 73 75 73
query56 276 244 252 244
query57 1219 1096 1057 1057
query58 246 227 233 227
query59 3082 2913 2811 2811
query60 298 262 276 262
query61 105 99 97 97
query62 866 655 640 640
query63 218 187 184 184
query64 5231 629 618 618
query65 3233 3213 3217 3213
query66 1429 300 301 300
query67 16100 15379 15372 15372
query68 3115 552 555 552
query69 442 290 289 289
query70 1223 1000 1111 1000
query71 335 267 270 267
query72 5955 4009 4087 4009
query73 756 340 330 330
query74 9546 8839 8907 8839
query75 3350 2658 2650 2650
query76 2021 959 939 939
query77 432 292 289 289
query78 9882 9348 9294 9294
query79 941 881 888 881
query80 598 577 587 577
query81 455 255 255 255
query82 260 234 229 229
query83 161 155 160 155
query84 237 112 105 105
query85 736 364 346 346
query86 314 318 331 318
query87 4339 4381 4244 4244
query88 5126 4060 4057 4057
query89 376 366 362 362
query90 1835 315 310 310
query91 162 166 162 162
query92 77 71 71 71
query93 899 909 889 889
query94 644 375 350 350
query95 430 401 410 401
query96 493 483 489 483
query97 3095 3119 3124 3119
query98 237 237 218 218
query99 1391 1313 1311 1311
Total cold run time: 295579 ms
Total hot run time: 193560 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357483825
run feut
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764551693
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java:
##########
@@ -596,4 +650,472 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera
return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(
t1.getPrecision(), t1.getScale() - t2.getScale()), result);
}
+
+ /**
+ * coalesce
+ */
+ @ExecFunction(name = "coalesce")
+ public static Expression coalesce(Literal first, Literal... second) {
+ if (!(first instanceof NullLiteral)) {
+ return first;
+ }
+ for (Literal secondLiteral : second) {
+ if (!(secondLiteral instanceof NullLiteral)) {
+ return secondLiteral;
+ }
+ }
+ return first;
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first) {
+ return first.round(0);
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DecimalV3Literal first, IntegerLiteral second) {
+ return first.round(second.getValue());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(0).getDouble());
+ }
+
+ /**
+ * round
+ */
+ @ExecFunction(name = "round")
+ public static Expression round(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.round(second.getValue()).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first) {
+ return first.roundCeiling(0);
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundCeiling(second.getValue());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(0).getDouble());
+ }
+
+ /**
+ * ceil
+ */
+ @ExecFunction(name = "ceil")
+ public static Expression ceil(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first) {
+ return first.roundFloor(0);
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DecimalV3Literal first, IntegerLiteral second) {
+ return first.roundFloor(second.getValue());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(0).getDouble());
+ }
+
+ /**
+ * floor
+ */
+ @ExecFunction(name = "floor")
+ public static Expression floor(DoubleLiteral first, IntegerLiteral second) {
+ DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue())));
+ return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble());
+ }
+
+ /**
+ * exp
+ */
+ @ExecFunction(name = "exp")
+ public static Expression exp(DoubleLiteral first) {
+ return new DoubleLiteral(Math.exp(first.getValue()));
Review Comment:
I was wrong about Infinity, actually it should return "inf" in sql and " ∞" in explain string. NaN is right to show by NULL
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2357444344
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2358326822
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2345675860
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR)
Since 2024-03-18, the Document has been moved to [doris-website](https://github.com/apache/doris-website).
See [Doris Document](https://cwiki.apache.org/confluence/display/DORIS/Doris+Document).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on code in PR #40744:
URL: https://github.com/apache/doris/pull/40744#discussion_r1764526800
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java:
##########
@@ -84,6 +84,12 @@ public DecimalV3Literal roundFloor(int newScale) {
value.setScale(newScale, RoundingMode.FLOOR));
}
+ public DecimalV3Literal round(int newScale) {
+ return new DecimalV3Literal(DecimalV3Type
+ .createDecimalV3Type(((DecimalV3Type) dataType).getPrecision(), newScale),
Review Comment:
when new scale is larger than original one, it would throw an Invocationexception when calling create Decimal Type in java with message: precision should not smaller than scale and ExpressionEvaluator would catch this exception and go back to original expression. But actually when new scalar bigger than old one, we can return original one when folding constant. Same as be calculation logic
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2358041505
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feat](Nereids) add numeric functions [doris]
Posted by "LiBinfeng-01 (via GitHub)" <gi...@apache.org>.
LiBinfeng-01 commented on PR #40744:
URL: https://github.com/apache/doris/pull/40744#issuecomment-2349103090
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org