beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-2281) call SqlFunctions in operator implementation
Date Wed, 14 Mar 2018 00:04:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 14/Mar/18 00:03
            Start Date: 14/Mar/18 00:03
    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:
users@infra.apache.org


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

    Worklog Id:     (was: 80149)
    Time Spent: 0.5h  (was: 20m)

> 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: 0.5h
>  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)

Mime
View raw message