[ 
https://issues.apache.org/jira/browse/FLINK-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16578355#comment-16578355
 ] 

ASF GitHub Bot commented on FLINK-9977:
---------------------------------------

fhueske commented on a change in pull request #6535: [FLINK-9977] [table][doc] 
Refine the SQL/Table built-in function docs
URL: https://github.com/apache/flink/pull/6535#discussion_r209626394
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/SqlExpressionTest.scala
 ##########
 @@ -133,11 +136,78 @@ class SqlExpressionTest extends ExpressionTestBase {
     testSqlApi("TRIM(LEADING 'x' FROM 'xxxxSTRINGxxxx')", "STRINGxxxx")
     testSqlApi("TRIM(TRAILING 'x' FROM 'xxxxSTRINGxxxx')", "xxxxSTRING")
     testSqlApi(
-      "OVERLAY('This is a old string' PLACING 'new' FROM 11 FOR 3)",
+      "OVERLAY('This is an old string' PLACING ' new' FROM 10 FOR 5)",
       "This is a new string")
     testSqlApi("SUBSTRING('hello world', 2)", "ello world")
     testSqlApi("SUBSTRING('hello world', 2, 3)", "ell")
-    testSqlApi("INITCAP('hello world')", "Hello World")
+    testSqlApi("INITCAP('hello WORLD')", "Hello World")
+    testSqlApi("CONCAT('a', 'b')", "ab")
+    testSqlApi("CONCAT('a', NULLIF('a', 'a'), 'b')", "null")
+    testSqlApi("CONCAT_WS('~', 'a', NULLIF('a', 'a'), 'b')", "a~b")
+    testSqlApi("LPAD('hi',4,'??')", "??hi")
+    testSqlApi("RPAD('hi',4,'??')", "hi??")
+    testSqlApi("FROM_BASE64('aGVsbG8gd29ybGQ=')", "hello world")
+    testSqlApi("TO_BASE64('hello world')", "aGVsbG8gd29ybGQ=")
+  }
+
+  @Test
+  def testTemporalFunctions(): Unit = {
+    testSqlApi("DATE '1990-10-14'", "1990-10-14")
+    testSqlApi("TIME '12:12:12'", "12:12:12")
+    testSqlApi("TIMESTAMP '1990-10-14 12:12:12.123'", "1990-10-14 
12:12:12.123")
+    testSqlApi("INTERVAL '10 00:00:00.004' DAY TO SECOND", "+10 00:00:00.004")
+    testSqlApi("INTERVAL '10 00:12' DAY TO MINUTE", "+10 00:12:00.000")
+    testSqlApi("INTERVAL '2-10' YEAR TO MONTH", "+2-10")
+    testSqlApi("EXTRACT(DAY FROM DATE '1990-12-01')", "1")
+    testSqlApi("EXTRACT(DAY FROM INTERVAL '19 12:10:10.123' DAY TO 
SECOND(3))", "19")
+    testSqlApi("YEAR(DATE '1994-09-27')", "1994")
+    testSqlApi("QUARTER(DATE '2016-04-12')", "2")
+    testSqlApi("MONTH(DATE '1994-09-27')", "9")
+    testSqlApi("WEEK(DATE '1994-09-27')", "39")
+    testSqlApi("DAYOFYEAR(DATE '1994-09-27')", "270")
+    testSqlApi("DAYOFMONTH(DATE '1994-09-27')", "27")
+    testSqlApi("DAYOFWEEK(DATE '1994-09-27')", "3")
+    testSqlApi("HOUR(TIMESTAMP '1994-09-27 13:14:15')", "13")
+    testSqlApi("MINUTE(TIMESTAMP '1994-09-27 13:14:15')", "14")
+    testSqlApi("SECOND(TIMESTAMP '1994-09-27 13:14:15')", "15")
+    testSqlApi("FLOOR(TIME '12:44:31' TO MINUTE)", "12:44:00")
+    testSqlApi("CEIL(TIME '12:44:31' TO MINUTE)", "12:45:00")
+    testSqlApi(
 
 Review comment:
   Add a test that evaluates to `false`?

----------------------------------------------------------------
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


> Refine the docs for Table/SQL built-in functions
> ------------------------------------------------
>
>                 Key: FLINK-9977
>                 URL: https://issues.apache.org/jira/browse/FLINK-9977
>             Project: Flink
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Xingcan Cui
>            Assignee: Xingcan Cui
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: Java.jpg, SQL.jpg, Scala.jpg
>
>
> There exist some syntax errors or inconsistencies in documents and Scala docs 
> of the Table/SQL built-in functions. This issue aims to make some 
> improvements to them.
> Also, according to FLINK-10103, we should use single quotes to express 
> strings in SQL. For example, CONCAT("AA", "BB", "CC") should be replaced with 
> CONCAT('AA', 'BB', 'CC'). 



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

Reply via email to