[GitHub] yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix insert into with order by

2018-09-05 Thread GitBox
yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix 
insert into with order by
URL: https://github.com/apache/flink/pull/6648#discussion_r215327517
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/stream/sql/validation/SortValidationTest.scala
 ##
 @@ -54,4 +53,12 @@ class SortValidationTest extends TableTestBase {
 val sqlQuery = "SELECT a FROM MyTable LIMIT 3"
 streamUtil.verifySql(sqlQuery, "")
   }
+
+  // test should fail because time is not order field
+  @Test(expected = classOf[TableException])
+  def testNonTimeSorting(): Unit = {
+
 
 Review comment:
   Remove this empty line looks better.


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


With regards,
Apache Git Services


[GitHub] yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix insert into with order by

2018-09-05 Thread GitBox
yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix 
insert into with order by
URL: https://github.com/apache/flink/pull/6648#discussion_r215327571
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/stream/sql/SortITCase.scala
 ##
 @@ -105,6 +107,36 @@ class SortITCase extends StreamingWithStateTestBase {
   "20")
 assertEquals(expected, SortITCase.testResults)
   }
+
+  @Test
+  def testInsertIntoMemoryTableOrderBy(): Unit = {
+val env = StreamExecutionEnvironment.getExecutionEnvironment
+env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
+val tEnv = TableEnvironment.getTableEnvironment(env)
+MemoryTableSourceSinkUtil.clear()
+
+val t = StreamTestData.getSmall3TupleDataStream(env)
+.assignAscendingTimestamps(x => x._2)
 
 Review comment:
   The "." aligns with the next line looks better?


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


With regards,
Apache Git Services


[GitHub] yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix insert into with order by

2018-09-05 Thread GitBox
yanghua commented on a change in pull request #6648: [FLINK-10261][table] fix 
insert into with order by
URL: https://github.com/apache/flink/pull/6648#discussion_r215327606
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/stream/sql/SortITCase.scala
 ##
 @@ -105,6 +107,36 @@ class SortITCase extends StreamingWithStateTestBase {
   "20")
 assertEquals(expected, SortITCase.testResults)
   }
+
+  @Test
+  def testInsertIntoMemoryTableOrderBy(): Unit = {
+val env = StreamExecutionEnvironment.getExecutionEnvironment
+env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
+val tEnv = TableEnvironment.getTableEnvironment(env)
+MemoryTableSourceSinkUtil.clear()
+
+val t = StreamTestData.getSmall3TupleDataStream(env)
+.assignAscendingTimestamps(x => x._2)
+  .toTable(tEnv, 'a, 'b, 'c, 'rowtime.rowtime)
+tEnv.registerTable("sourceTable", t)
+
+val fieldNames = Array("d", "e", "f", "t")
+val fieldTypes = Array(Types.INT, Types.LONG, Types.STRING, 
Types.SQL_TIMESTAMP)
+  .asInstanceOf[Array[TypeInformation[_]]]
+val sink = new MemoryTableSourceSinkUtil.UnsafeMemoryAppendTableSink
+tEnv.registerTableSink("targetTable", fieldNames, fieldTypes, sink)
+
+val sql = "INSERT INTO targetTable SELECT a, b, c, rowtime " +
+  "FROM sourceTable order by rowtime, a desc"
 
 Review comment:
   SQL keyword (`ORDER BY`) upper case looks better to me.


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


With regards,
Apache Git Services