Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MaterializedView select with CTE bug #5165

Merged
merged 2 commits into from
Jan 4, 2021
Merged

Conversation

kangkaisen
Copy link
Contributor

Fix #5164

For different Analyzer scopes, the id for SelectStmt maybe the same, but the Analyzer instance always unique

@@ -86,7 +86,7 @@

private final PlannerContext ctx_;
private final ArrayList<ScanNode> scanNodes = Lists.newArrayList();
private Map<UUID, List<ScanNode>> selectStmtToScanNodes = Maps.newHashMap();
private Map<Analyzer, List<ScanNode>> selectStmtToScanNodes = Maps.newHashMap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the Analyzer of CTE same as outer query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.
For SQL

select id, t1 from(
select id, a as t1 from t
union all
select id, aaa as t1 from t
) k2;

The analyzer instances for select id, a as t1 from t and select id, aaa as t1 from t are different.
Such as, The analyzer instances for select id, a as t1 from t is 6177, which ancestors are[6219,6220,6221],
The analyzer instances for select id, aaa as t1 from t is 6225, which ancestors are[6247,6220,6221].

@EmmyMiao87 EmmyMiao87 added area/materialized-view Issues or PRs related to materialized view kind/fix Categorizes issue or PR as related to a bug. labels Dec 29, 2020
morningman
morningman previously approved these changes Jan 3, 2021
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Jan 3, 2021
@morningman morningman self-assigned this Jan 3, 2021
@morningman
Copy link
Contributor

Hi, @kangkaisen , there are unused imports:

SingleNodePlanner.java:76:8: Unused import - java.util.UUID. [UnusedImports]

Please fix it first.

@kangkaisen
Copy link
Contributor Author

Hi, @kangkaisen , there are unused imports:

SingleNodePlanner.java:76:8: Unused import - java.util.UUID. [UnusedImports]

Please fix it first.

@morningman done

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kangkaisen kangkaisen merged commit bcf1091 into apache:master Jan 4, 2021
EmmyMiao87 pushed a commit to EmmyMiao87/incubator-doris that referenced this pull request Jan 26, 2021
Change-Id: I48d6e57ec0beb91606a464f9eb4c45aadec1fc27
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. area/materialized-view Issues or PRs related to materialized view kind/fix Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaterializedView select result is wrong when union all CTE
3 participants