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

    https://github.com/apache/flink/pull/3791#discussion_r114063647
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/table.scala
 ---
    @@ -417,12 +452,33 @@ class Table(
     
       private def join(right: Table, joinPredicate: Option[Expression], 
joinType: JoinType): Table = {
         // check that right table belongs to the same TableEnvironment
    -    if (right.tableEnv != this.tableEnv) {
    +    if (right.tableEnv != null && right.tableEnv != this.tableEnv) {
           throw new ValidationException("Only tables from the same 
TableEnvironment can be joined.")
         }
    +
    +    val rule: PartialFunction[LogicalNode, LogicalNode] = {
    +      case udtf: LogicalTableFunctionCall if udtf.child == null => {
    +        new LogicalTableFunctionCall(
    +          udtf.functionName,
    +          udtf.tableFunction,
    +          udtf.parameters,
    +          udtf.resultType,
    +          udtf.fieldNames,
    +          this.logicalPlan
    +        ).validate(tableEnv)
    +      }
    +      case other: LogicalNode => other.validate(tableEnv)
    +    }
    +
    +    val newRightPlan = right.logicalPlan.postOrderTransform(rule)
    --- End diff --
    
    I think we have to make sure at this point that the right plan is only a 
`LogicalTableFunctionCall` and an `Alias`. We cannot translate anything else 
yet and should give a meaningful error message.
    Also, it would be good, if we could merge the `Alias` into the 
`LogicalTableFunctionCall` to get rid of many special cases in the validation 
process.


---
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