luoyuxia commented on code in PR #20571:
URL: https://github.com/apache/flink/pull/20571#discussion_r946234851


##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java:
##########
@@ -743,6 +743,31 @@ public void testBoolComparison() {
         }
     }
 
+    @Test
+    public void testCastTimeStampToDecimal() throws Exception {
+        try {
+            // test cast timestamp to decimal explicitly
+            List<Row> results =
+                    CollectionUtil.iteratorToList(
+                            tableEnv.executeSql(
+                                            "select cast(cast('2012-12-19 
11:12:19.1234567' as timestamp) as decimal(30,8))")
+                                    .collect());
+            
assertThat(results.toString()).isEqualTo("[+I[1355886739.12345670]]");
+
+            // test insert timestamp type to decimal type directly
+            tableEnv.executeSql("create table t1 (c1 DECIMAL(38,6))");
+            tableEnv.executeSql("create table t2 (c2 TIMESTAMP)");
+            tableEnv.executeSql("insert into t2 values('2029-06-05 
14:28:29.23445')").await();

Review Comment:
   Yeah, that's what's in my mind. But miss it by mistake.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to