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

    https://github.com/apache/flink/pull/1237#discussion_r45600786
  
    --- Diff: 
flink-staging/flink-table/src/main/scala/org/apache/flink/api/java/table/JavaBatchTranslator.scala
 ---
    @@ -54,6 +55,22 @@ class JavaBatchTranslator extends PlanTranslator {
         Table(Root(rowDataSet, resultFields))
       }
     
    +  override def createTable(tableSource: TableSource): Table = {
    +    // a TableSource requires an ExecutionEnvironment
    +    if (env.isEmpty) {
    +      throw new ExpressionException("This operation requires an 
ExecutionEnvironment.")
    +    }
    +    tableSource match {
    +      case adaptive: AdaptiveTableSource => Table(Root(adaptive, 
adaptive.getOutputFields()))
    +
    +      case static: StaticTableSource =>
    +        createTable(static.createStaticDataSet(env.get),
    --- End diff --
    
    I think it's more scalaesque to use Scala's pattern matching to extract the 
`ExecutionEnvironment` from `env` instead of the `if` check with a following 
`get`.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to