JingsongLi commented on a change in pull request #9274: 
[FLINK-13495][table-planner-blink] blink-planner should support 
varchar/char/decimal precision to connector
URL: https://github.com/apache/flink/pull/9274#discussion_r311525247
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/utils/testTableSources.scala
 ##########
 @@ -620,3 +622,39 @@ class TestInputFormatTableSource[T](
 
   override def getTableSchema: TableSchema = tableSchema
 }
+
+class TestDataTypeTableSource(
+    tableSchema: TableSchema,
+    values: Seq[Row]) extends InputFormatTableSource[Row] {
+
+  override def getInputFormat: InputFormat[Row, _ <: InputSplit] = {
+    new CollectionInputFormat[Row](
+      values.asJava,
+      fromDataTypeToTypeInfo(getProducedDataType)
+          .createSerializer(new ExecutionConfig)
+          .asInstanceOf[TypeSerializer[Row]])
+  }
+
+  override def getReturnType: TypeInformation[Row] =
+    throw new RuntimeException("Should not invoke this deprecated method.")
+
+  override def getProducedDataType: DataType = tableSchema.toRowDataType
+
+  override def getTableSchema: TableSchema = tableSchema
+}
+
+class TestStreamTableSource(
+    tableSchema: TableSchema,
+    values: Seq[Row]) extends StreamTableSource[Row] {
+
+  override def getDataStream(execEnv: StreamExecutionEnvironment): 
DataStream[Row] = {
+    execEnv.fromCollection(values, tableSchema.toRowType)
+  }
+
+  override def getReturnType: TypeInformation[Row] =
+    throw new RuntimeException("Should not invoke this deprecated method.")
 
 Review comment:
   ok

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to