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

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

                Author: ASF GitHub Bot
            Created on: 06/Nov/18 22:24
            Start Date: 06/Nov/18 22:24
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #6967: 
[BEAM-5979]  Fix DATE and TIME in INSERTION
URL: https://github.com/apache/beam/pull/6967#discussion_r231316843
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
 ##########
 @@ -235,4 +239,40 @@ public void testExplainQuery() throws Exception {
             "BeamCalcRel(expr#0..2=[{inputs}], proj#0..2=[{exprs}])\n"
                 + "  BeamIOSourceRel(table=[[beam, person]])\n"));
   }
+
+  @Test
+  public void test_time_types() throws Exception {
+    InMemoryMetaStore metaStore = new InMemoryMetaStore();
+    TestTableProvider testTableProvider = new TestTableProvider();
+    metaStore.registerProvider(testTableProvider);
+
+    BeamSqlCli cli = new BeamSqlCli().metaStore(metaStore);
+    cli.execute(
+        "CREATE EXTERNAL TABLE test_table (\n"
+            + "f_date DATE, \n"
+            + "f_time TIME, \n"
+            + "f_ts TIMESTAMP"
+            + ") \n"
+            + "TYPE 'test'");
+
+    cli.execute(
+        "INSERT INTO test_table VALUES ("
+            + "DATE '2018-11-01', "
+            + "TIME '15:23:59', "
+            + "TIMESTAMP '2018-07-01 21:26:07.123' )");
+
+    Table table = metaStore.getTables().get("test_table");
+    assertNotNull(table);
+    TestTableProvider.TableWithRows tableWithRows = 
testTableProvider.tables().get(table.getName());
+    assertEquals(1, tableWithRows.getRows().size());
+    Row row = tableWithRows.getRows().get(0);
+    assertEquals(3, row.getFieldCount());
+
+    // test DATE field
+    row.getDateTime("f_date").toString("yyyy-MM-dd").equals("2018-11-01");
 
 Review comment:
   assert?

----------------------------------------------------------------
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: 163222)
    Time Spent: 1.5h  (was: 1h 20m)

> Support DATE and TIME in DML
> ----------------------------
>
>                 Key: BEAM-5979
>                 URL: https://issues.apache.org/jira/browse/BEAM-5979
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Right now, BeamSQL uses Schema's DATETIME field to save all time related 
> data. However, BeamSQL doesn't implement correctly how TIME and DATE should 
> be converted to Joda's datetime.



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

Reply via email to