Skip to content

HIVE-29559: materializeCTE to query Analyzer from DDLSemanticAnalyzerFactory#6423

Open
konstantinb wants to merge 4 commits intoapache:masterfrom
konstantinb:HIVE-29559
Open

HIVE-29559: materializeCTE to query Analyzer from DDLSemanticAnalyzerFactory#6423
konstantinb wants to merge 4 commits intoapache:masterfrom
konstantinb:HIVE-29559

Conversation

@konstantinb
Copy link
Copy Markdown
Contributor

@konstantinb konstantinb commented Apr 11, 2026

What changes were proposed in this pull request?

HIVE-29559: SemanticAnalyzer.materializeCTE to query SemanticAnalyzer instance from DDLSemanticAnalyzerFactory

Why are the changes needed?

As originally intended by the changes for HIVE-28724, the PR #5973 has introduced a new CreateTableAnalyzer class and registered it with DDLSemanticAnalyzerFactory

Unfortunately, the PR has also introduced a new CalcitePlanner.The materializeCTE() method is almost an exact copy of SemanticAnalyzer.materializeCTE(), with only one difference: it explicitly uses CreateTableAnalyzer instead of SemanticAnalyzer.

Because some code was removed from SemanticAnalyzer, its own implementation of materializeCTE() broke during the merge of this PR. The new query file of this PR reproduces the NPE happening with the current master branch code.

The first, "easy" and working choice was to copy the whole materializeCTE() from CalcitePlanner to SemanticAnalyzer and remove materializeCTE() from CalcitePlanner completely. I decided to take it a bit further due to the following reasons:

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit tests, new query file, all existing tests pass

….out file generated with proper test driver this time
@konstantinb konstantinb changed the title HIVE-29559: SemanticAnalyzer.materializeCTE to use CreateTableAnalyzer instead of SemanticAnalyze HIVE-29559: materializeCTE to query Analyzer from DDLSemanticAnalyzerFactory Apr 13, 2026
@konstantinb konstantinb marked this pull request as ready for review April 14, 2026 00:07
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants