You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by fhueske <gi...@git.apache.org> on 2017/01/05 22:18:51 UTC

[GitHub] flink pull request #3039: [FLINK-5280] Update TableSource to support nested ...

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3039#discussion_r94853135
  
    --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/CommonTestData.scala ---
    @@ -60,4 +67,52 @@ object CommonTestData {
           ignoreComments = "%"
         )
       }
    +
    +  def getNestedTableSource: BatchTableSource[Person] = {
    +    new AbstractBatchTableSource[Person] {
    +      override def getDataSet(execEnv: ExecutionEnvironment): DataSet[Person] = {
    +        val executionEnvironment = ExecutionEnvironment.getExecutionEnvironment
    +        executionEnvironment.fromCollection(
    +          util.Arrays.asList(
    +            new Person("Mike", "Smith", new Address("5th Ave", "New-York")),
    +            new Person("Sally", "Miller", new Address("Potsdamer Platz", "Berlin")),
    +            new Person("Bob", "Taylor", new Address("Pearse Street", "Dublin"))),
    +          getReturnType
    +        )
    +      }
    +
    +      /** Returns the [[TypeInformation]] for the return type of the [[TableSource]]. */
    +      override def getReturnType: TypeInformation[Person] = new PojoTypeInfo[Person](
    --- End diff --
    
    `TypeExtractor.getForClass(Person)` should return a `PojoTypeInfo[Person]`. No need to fiddle with Java reflection ;-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---