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

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

                Author: ASF GitHub Bot
            Created on: 09/Aug/18 22:17
            Start Date: 09/Aug/18 22:17
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on a change in pull request #6174: 
[BEAM-5106][SQL]test conditional operators and functions at DSL level
URL: https://github.com/apache/beam/pull/6174#discussion_r209096193
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlDslSqlStdOperatorsTest.java
 ##########
 @@ -1170,4 +1171,32 @@ public void testTimestampMinusInterval() throws 
Exception {
                 parseDate("1983-01-19 01:01:58"));
     checker.buildRunAndCheck();
   }
+
+  @Test
+  @SqlOperatorTest(name = "CASE", kind = "CASE")
+  @SqlOperatorTest(name = "NULLIF", kind = "NULLIF")
+  @SqlOperatorTest(name = "COALESCE", kind = "COALESCE")
+  public void testConditionalOperatorsAndFunctions() {
+    ExpressionChecker checker =
+        new ExpressionChecker()
+            .addExpr("CASE 1 WHEN 1 THEN 'hello' ELSE 'world' END", "hello")
+            .addExpr(
+                "CASE 2 " + "WHEN 1 THEN 'hello' " + "WHEN 3 THEN 'bond' " + 
"ELSE 'world' END",
+                "world")
+            .addExpr(
+                "CASE 3 " + "WHEN 1 THEN 'hello' " + "WHEN 3 THEN 'bond' " + 
"ELSE 'world' END",
+                "bond")
+            .addExpr("CASE " + "WHEN 1 = 1 THEN 'hello' " + "ELSE 'world' 
END", "hello")
+            .addExpr("CASE " + "WHEN 1 > 1 THEN 'hello' " + "ELSE 'world' 
END", "world")
+            .addExpr("NULLIF(5, 4) ", 5)
+            .addExpr("NULLIF(4, 5) ", 4)
+            .addExpr("NULLIF(5, 5)", null, FieldType.INT32)
 
 Review comment:
   I could probably add a check for NULL before `expectedValue.getClass()` 
though.

----------------------------------------------------------------
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: 133337)
    Time Spent: 3h 20m  (was: 3h 10m)

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




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

Reply via email to