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

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

                Author: ASF GitHub Bot
            Created on: 08/Aug/18 22:05
            Start Date: 08/Aug/18 22:05
    Worklog Time Spent: 10m 
      Work Description: akedin 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_r208751346
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlDslSqlStdOperatorsTest.java
 ##########
 @@ -794,4 +794,33 @@ 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)
+            // Cannot assign null here to test NULLIF(5, 5), which is expected 
to return NULL.
+            // .addExpr("NULLIF(5, 5)", null)
 
 Review comment:
   why?

----------------------------------------------------------------
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: 132705)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  Remaining Estimate: 0h
>




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

Reply via email to