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

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

                Author: ASF GitHub Bot
            Created on: 14/Mar/18 16:18
            Start Date: 14/Mar/18 16:18
    Worklog Time Spent: 10m 
      Work Description: apilloud 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_r174519777
 
 

 ##########
 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:
   Because the compiler error didn't say that was an option. I'll change it.

----------------------------------------------------------------
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: 80380)
    Time Spent: 50m  (was: 40m)

> 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: 50m
>  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