konstantinb commented on PR #6423:
URL: https://github.com/apache/hive/pull/6423#issuecomment-4350563599

   Hi @kasakrisz @abstractdog — follow-up to HIVE-28724. Tests passing, 
SonarQube clean. Would value your eyes when you have a chance.
   
   **Diff is mostly cleanup — net negative LOC.** HIVE-28724 introduced 
`DDLSemanticAnalyzerFactory` routing for `TOK_CREATETABLE` and a 
`CreateTableAnalyzer` class that extends `CalcitePlanner`. Inside 
`materializeCTE` itself, however, the analyzer construction was hard-coded — 
`new CreateTableAnalyzer(...)` in `CalcitePlanner.materializeCTE` (the parent 
class instantiating its own subclass) and `new SemanticAnalyzer(...)` in 
`SemanticAnalyzer.materializeCTE` — leaving two near-duplicate methods and a 
parent↔child class reference. This PR routes that call through the factory in 
`SemanticAnalyzer.materializeCTE`, the two implementations become equivalent, 
the `CalcitePlanner` override is removed, and the cycle goes away. End state: 
factory-uniform with the original intent of HIVE-28724, just applied at this 
call site too.
   
   The same asymmetry also produced an NPE on materialized CTEs whenever the 
runtime analyzer instance is a plain `SemanticAnalyzer`. The obvious trigger is 
`set hive.cbo.enable=false`, but it's also reachable from default-CBO-enabled 
entry via `ReCompileWithoutCBOPlugin`: with 
`hive.cbo.fallback.strategy=ALWAYS`, any non-fatal CBO crash on a query with a 
materialized CTE recompiles with `cbo.enable=false` injected into conf, landing 
in the buggy method. Both paths reproduced empirically; the regression test in 
`cte_materialize.q` covers each.
   
   Aware of the non-CBO deprecation direction — this PR doesn't expand that 
surface, it removes a duplicate method. Happy to adjust the shape if you'd 
prefer something different.
   
   cc @deniskuzZ @ramitg254 for visibility.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to