[ 
https://issues.apache.org/jira/browse/BEAM-2281?focusedWorklogId=80150&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-80150
 ]

ASF GitHub Bot logged work on BEAM-2281:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Mar/18 00:04
            Start Date: 14/Mar/18 00:04
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #4865: 
[BEAM-2281][Sql] Use SqlFunctions.toBigDecimal not toString
URL: https://github.com/apache/beam/pull/4865#discussion_r174321131
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/interpreter/operator/arithmetic/BeamSqlArithmeticExpression.java
 ##########
 @@ -53,10 +54,8 @@ protected 
BeamSqlArithmeticExpression(List<BeamSqlExpression> operands, SqlTypeN
 
   @Override public BeamSqlPrimitive<? extends Number> evaluate(Row inputRow,
       BoundedWindow window) {
-    BigDecimal left = BigDecimal.valueOf(
-        Double.valueOf(opValueEvaluated(0, inputRow, window).toString()));
-    BigDecimal right = BigDecimal.valueOf(
-        Double.valueOf(opValueEvaluated(1, inputRow, window).toString()));
+    BigDecimal left = SqlFunctions.toBigDecimal((Number) opValueEvaluated(0, 
inputRow, window));
 
 Review comment:
   Why not use the 
[`toBigDecimal(Object)`](https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java#L1673)
 overload?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 80150)
    Time Spent: 40m  (was: 0.5h)

> call SqlFunctions in operator implementation
> --------------------------------------------
>
>                 Key: BEAM-2281
>                 URL: https://issues.apache.org/jira/browse/BEAM-2281
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Xu Mingmin
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Calcite has a collections of functions in 
> {{org.apache.calcite.runtime.SqlFunctions}}. It sounds a good source to 
> leverage when adding operators as {{BeamSqlExpression}}. 
> [~xumingming] [~app-tarush], any comments?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to