[ 
https://issues.apache.org/jira/browse/FLINK-5280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15769556#comment-15769556
 ] 

Ivan Mushketyk commented on FLINK-5280:
---------------------------------------

Hi [~fhueske]

Thank you for the great and detailed proposal. It all makes sense.

One question that came to my mind while I was working on it. Would it be better 
to leave all current methods in the *TableSource* interface and simply 
implement them using the return type. Something like:

{code}
trait TableSource[T] {

  /** Returns the number of fields of the table. */
  final def getNumberOfFields: Int = {
    getReturnType.getTotalFields
  }

  /** Returns the names of the table fields. */
  final def getFieldsNames: Array[String] = {
      getReturnType match {
        case c: CompositeType[T] => c.getFieldNames
      }
  }

  /** Returns the types of the table fields. */
  final def getFieldTypes: Array[TypeInformation[_]] = {
    getReturnType match {
      case c: CompositeType[T] => 
0.until(c.getTotalFields).map(c.getTypeAt(_)).toArray
    }
  }

  /** Returns the [[TypeInformation]] for the return type of the 
[[TableSource]]. */
  def getReturnType: TypeInformation[T]

}
{code}

I think there are two benefits:
* No need to change existing code
* We can put all the utility methods for *TableSource* in *TableSource* trait

Would do you think about this?

> Extend TableSource to support nested data
> -----------------------------------------
>
>                 Key: FLINK-5280
>                 URL: https://issues.apache.org/jira/browse/FLINK-5280
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Fabian Hueske
>            Assignee: Ivan Mushketyk
>
> The {{TableSource}} interface does currently only support the definition of 
> flat rows. 
> However, there are several storage formats for nested data that should be 
> supported such as Avro, Json, Parquet, and Orc. The Table API and SQL can 
> also natively handle nested rows.
> The {{TableSource}} interface and the code to register table sources in 
> Calcite's schema need to be extended to support nested data.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to