[
https://issues.apache.org/jira/browse/BEAM-5100?focusedWorklogId=132718&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-132718
]
ASF GitHub Bot logged work on BEAM-5100:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Aug/18 22:13
Start Date: 08/Aug/18 22:13
Worklog Time Spent: 10m
Work Description: amaliujia 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_r208752990
##########
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:
`kind` comes from Calcite. It is not defined by us. See:
`https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/SqlKind.java`
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 132718)
Time Spent: 1h 10m (was: 1h)
> 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: 1h 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)