[fix](planner) table valued function could not used in subquery (#15496)

This commit is contained in:
morrySnow
2022-12-30 10:01:25 +08:00
committed by GitHub
parent 10be583e52
commit 917b266799
4 changed files with 17 additions and 6 deletions

View File

@ -304,7 +304,6 @@ public class SelectStmt extends QueryStmt {
inlineStmt.getTables(analyzer, expandView, tableMap, parentViewNameSet);
} else if (tblRef instanceof TableValuedFunctionRef) {
TableValuedFunctionRef tblFuncRef = (TableValuedFunctionRef) tblRef;
tblFuncRef.analyze(analyzer);
tableMap.put(tblFuncRef.getTableFunction().getTable().getId(),
tblFuncRef.getTableFunction().getTable());
} else {

View File

@ -32,10 +32,12 @@ public class TableValuedFunctionRef extends TableRef {
private String funcName;
private Map<String, String> params;
public TableValuedFunctionRef(String funcName, String alias, Map<String, String> params) {
public TableValuedFunctionRef(String funcName, String alias, Map<String, String> params) throws AnalysisException {
super(new TableName(null, null, "_table_valued_function_" + funcName), alias);
this.funcName = funcName;
this.params = params;
this.tableFunction = TableValuedFunctionIf.getTableFunction(funcName, params);
this.table = tableFunction.getTable();
if (hasExplicitAlias()) {
return;
}
@ -70,10 +72,6 @@ public class TableValuedFunctionRef extends TableRef {
if (isAnalyzed) {
return;
}
// Table function could generate a table which will has columns
// Maybe will call be during this process
this.tableFunction = TableValuedFunctionIf.getTableFunction(funcName, params);
this.table = tableFunction.getTable();
desc = analyzer.registerTableRef(this);
isAnalyzed = true; // true that we have assigned desc
analyzeJoin(analyzer);