Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public class Analyzer {

// Flag indicating if this analyzer instance belongs to a subquery.
private boolean isSubquery = false;
private boolean isFirstScopeInSubquery = false;
// Flag indicating if this analyzer instance belongs to an inlineview.
private boolean isInlineView = false;

Expand All @@ -167,6 +168,7 @@ public class Analyzer {

public void setIsSubquery() {
isSubquery = true;
isFirstScopeInSubquery = true;
globalState.containsSubquery = true;
}

Expand Down Expand Up @@ -789,7 +791,7 @@ public SlotDescriptor registerColumnRef(TableName tblName, String colName) throw
* This column could not be resolved because doris can only resolved the parent column instead of grandpa.
* The exception of this query like that: Unknown column 'k1' in 'a'
*/
if (d == null && hasAncestors() && isSubquery) {
if (d == null && hasAncestors() && isSubquery && isFirstScopeInSubquery) {
// analyzer father for subquery
if (newTblName == null) {
d = getParentAnalyzer().resolveColumnRef(colName);
Expand Down