Dmitry Lychagin has posted comments on this change. ( 
https://asterix-gerrit.ics.uci.edu/3433 )

Change subject: [ASTERIXDB-2584][FUN] Support rounding digit for round()
......................................................................


Patch Set 9:

(4 comments)

https://asterix-gerrit.ics.uci.edu/#/c/3433/9//COMMIT_MSG
Commit Message:

https://asterix-gerrit.ics.uci.edu/#/c/3433/9//COMMIT_MSG@10
PS9, Line 10:   - user can pass optional 2nd argument to round() function
minor. fix indentation


https://asterix-gerrit.ics.uci.edu/#/c/3433/9/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericRoundFunctionTypeComputer.java
File 
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericRoundFunctionTypeComputer.java:

https://asterix-gerrit.ics.uci.edu/#/c/3433/9/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/NumericRoundFunctionTypeComputer.java@83
PS9, Line 83:             case ANY:
ANY could be FLOAT or DOUBLE at runtime, so we should also return nullable type 
for it (AUnionType.createNullableType()). We just need to move "case ANY" next 
to FLOAT/DOUBLE


https://asterix-gerrit.ics.uci.edu/#/c/3433/9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundEvaluator.java
File 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundEvaluator.java:

https://asterix-gerrit.ics.uci.edu/#/c/3433/9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundEvaluator.java@175
PS9, Line 175:             double multiplier = Math.pow(10, 
Math.abs(roundingDigit));
minor. Math.abs() is redundant here because roundingDigit >= 0 at this point.


https://asterix-gerrit.ics.uci.edu/#/c/3433/9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundEvaluator.java@213
PS9, Line 213:             double multiplier = Math.pow(10, 
Math.abs(roundingDigit));
minor. You know that roundingDigit is < 0 at this point, so could just do 
-roundingDigit instead of Math.abs()



--
To view, visit https://asterix-gerrit.ics.uci.edu/3433
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibdde2745e8bc440556e45ed07262eb33327f842b
Gerrit-Change-Number: 3433
Gerrit-PatchSet: 9
Gerrit-Owner: Hussain Towaileb <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose (1000171)
Gerrit-Reviewer: Dmitry Lychagin <[email protected]>
Gerrit-Reviewer: Hussain Towaileb <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>
Gerrit-Comment-Date: Wed, 12 Jun 2019 21:19:22 +0000
Gerrit-HasComments: Yes

Reply via email to