You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/12/11 04:36:33 UTC

[GitHub] walterddr commented on a change in pull request #7180: [FLINK-11010] [TABLE] Flink SQL timestamp is inconsistent with currentProcessingTime()

walterddr commented on a change in pull request #7180: [FLINK-11010] [TABLE] Flink SQL timestamp is inconsistent with currentProcessingTime()
URL: https://github.com/apache/flink/pull/7180#discussion_r240470904
 
 

 ##########
 File path: flink-libraries/flink-table/src/test/java/org/apache/flink/table/runtime/stream/sql/JavaSqlITCase.java
 ##########
 @@ -164,4 +167,35 @@ public void testUnion() throws Exception {
 
 		StreamITCase.compareWithList(expected);
 	}
+
+	@Test
+	public void testProctime() throws Exception {
+		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+		StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);
+
+		DataStream<Tuple3<Integer, Long, String>> ds = JavaStreamTestData.getSmall3TupleDataSet(env);
+		tableEnv.registerDataStream("MyTable", ds, "a, b, c, proctime.proctime");
+
+		String sqlQuery = "select proctime from MyTable";
+
+		Table result = tableEnv.sqlQuery(sqlQuery);
+
+		tableEnv
+			.toAppendStream(result, TypeInformation.of(Row.class))
+			.addSink(new SinkFunction<Row>() {
+				@Override
+				public void invoke(Row value, Context context) throws Exception {
+
+					Timestamp procTimestamp = (Timestamp) value.getField(0);
+
+					// validate the second here
+					long procSecondTime = procTimestamp.getTime() / 1000;
 
 Review comment:
   This causes me some trouble because cases can happen when they cross the second boundary. this is not a stable ITCase in my opinion.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services