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-5100) Test arithmetic functions at the DSL level
Date Wed, 08 Aug 2018 22:09:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 08/Aug/18 22:08
            Start Date: 08/Aug/18 22:08
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #6168: [BEAM-5100][SQL]Test
Arithmetic functions at the DSL level
URL: https://github.com/apache/beam/pull/6168#discussion_r208752033
 
 

 ##########
 File path: sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlDslSqlStdOperatorsTest.java
 ##########
 @@ -557,6 +566,326 @@ public void testStringFunctions() throws Exception {
     pipeline.run();
   }
 
+  @Test
+  @SqlOperatorTest(name = "ABS", kind = "OTHER_FUNCTION")
+  public void testAbs() {
+    ExpressionChecker checker =
+        new ExpressionChecker()
+            .addExpr("ABS(c_integer)", Math.abs(INTEGER_VALUE))
+            .addExpr("ABS(c_bigint)", Math.abs(LONG_VALUE))
+            .addExpr("ABS(c_smallint)", (short) Math.abs(SHORT_VALUE))
+            .addExpr("ABS(c_tinyint)", (byte) Math.abs(BYTE_VALUE))
+            .addExpr("ABS(c_double)", Math.abs(DOUBLE_VALUE))
+            .addExpr("ABS(c_float)", Math.abs(FLOAT_VALUE))
+            .addExpr("ABS(c_decimal)", new BigDecimal(Math.abs(ONE.doubleValue())));
+    checker.buildRunAndCheck();
+  }
+
+  @Test
+  @SqlOperatorTest(name = "LN", kind = "OTHER_FUNCTION")
+  public void testLn() {
+    ExpressionChecker checker =
+        new ExpressionChecker()
+            .addExpr("LN(c_integer)", Math.log(INTEGER_VALUE))
+            .addExpr("LN(c_bigint)", Math.log(LONG_VALUE))
+            .addExpr("LN(c_smallint)", Math.log(SHORT_VALUE))
+            .addExpr("LN(c_tinyint)", Math.log(BYTE_VALUE))
+            .addExpr("LN(c_double)", Math.log(DOUBLE_VALUE))
+            .addExpr("LN(c_float)", Math.log(FLOAT_VALUE))
+            .addExpr("LN(c_decimal)", Math.log(ONE.doubleValue()));
+    checker.buildRunAndCheck();
+  }
+
+  @Test
+  @SqlOperatorTest(name = "SQRT", kind = "OTHER_FUNCTION")
+  public void testSqrt() {
+    ExpressionChecker checker =
+        new ExpressionChecker()
+            .addExpr("SQRT(c_integer)", Math.sqrt(INTEGER_VALUE))
+            .addExpr("SQRT(c_bigint)", Math.sqrt(LONG_VALUE))
+            .addExpr("SQRT(c_smallint)", Math.sqrt(SHORT_VALUE))
+            .addExpr("SQRT(c_tinyint)", Math.sqrt(BYTE_VALUE))
+            .addExpr("SQRT(c_double)", Math.sqrt(DOUBLE_VALUE))
+            .addExpr("SQRT(c_float)", Math.sqrt(FLOAT_VALUE))
+            .addExpr("SQRT(c_decimal)", Math.sqrt(ONE.doubleValue()));
+    checker.buildRunAndCheck();
+  }
+
+  @Test
+  @SqlOperatorTest(name = "ROUND", kind = "OTHER_FUNCTION")
 
 Review comment:
   Can we have more granular `kind`? E.g. `"BASIC_MATH"` for things like `max, min, sqrt..`,
`"TRIGONOMETRY"` for `sin, cos..`, `"RANDOM"` for randoms

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

> Test arithmetic functions at the DSL level
> ------------------------------------------
>
>                 Key: BEAM-5100
>                 URL: https://issues.apache.org/jira/browse/BEAM-5100
>             Project: Beam
>          Issue Type: Sub-task
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




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

Mime
View raw message