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

    https://github.com/apache/flink/pull/3791#discussion_r114198491
  
    --- 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 --
    
    Before this was done in by unwrapping the TableFunctionCall and adding the 
alias. This step also ensured, that there are no other operations except Alias 
and the function call. This logic is still used in the TableFunctionParser. I 
think we should do similar steps here.



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