[ https://issues.apache.org/jira/browse/HIVE-28571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stamatis Zampetakis resolved HIVE-28571. ---------------------------------------- Fix Version/s: 4.1.0 Resolution: Fixed Fixed in [https://github.com/apache/hive/commit/454415b4798dbb7accf5e5de23db3dc4801b7d68] Thanks for the review [~soumyakanti.das] , [~aturoczy] , [~asolimando] , [~okumin] ! > Basic UNIONTYPE support in CBO > ------------------------------ > > Key: HIVE-28571 > URL: https://issues.apache.org/jira/browse/HIVE-28571 > Project: Hive > Issue Type: Improvement > Security Level: Public(Viewable by anyone) > Components: CBO > Affects Versions: 4.0.1 > Reporter: Stamatis Zampetakis > Assignee: Stamatis Zampetakis > Priority: Major > Labels: pull-request-available > Fix For: 4.1.0 > > > {code:sql} > CREATE TABLE utable (cu UNIONTYPE<INTEGER, STRING>); > SELECT cu FROM utable; > {code} > Currently any query that contains a UNIONTYPE cannot be handled by the CBO. > {noformat} > 2024-10-10T02:05:47,369 ERROR [c8b49b58-c8e0-437a-8f15-301cfaf3fb89 main] > parse.CalcitePlanner: CBO failed, skipping CBO. > org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException: Union > type is not supported > at > org.apache.hadoop.hive.ql.optimizer.calcite.translator.TypeConverter.convert(TypeConverter.java:281) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.optimizer.calcite.translator.TypeConverter.convert(TypeConverter.java:165) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.optimizer.calcite.translator.TypeConverter.getType(TypeConverter.java:136) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.genTableLogicalPlan(CalcitePlanner.java:3127) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.genLogicalPlan(CalcitePlanner.java:5043) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:1630) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:1573) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.calcite.tools.Frameworks.lambda$withPlanner$0(Frameworks.java:131) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:914) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:180) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:126) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner.logicalPlan(CalcitePlanner.java:1325) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:573) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:13164) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:466) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:332) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:180) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:332) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:224) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Compiler.compile(Compiler.java:109) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:499) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:451) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:415) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:409) > ~[hive-exec-4.1.0-SNAPSHOT.jar:4.1.0-SNAPSHOT] > {noformat} > When the hive.cbo.fallback.strategy is conservative the query will silently > by-pass CBO with the exception above and run exclusively via the non-cbo > optimizer. > The goal of this ticket is to support UNIONTYPE in the CBO path to take > advantage of the powerful optimizations that are performed in the CBO layer > and avoid relying on the fallback mechanism. > At the time of writing, the [support of > UNIONTYPE|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-UnionTypesunionUnionTypes] > is still at a very primitive stage. This ticket does not aim to cover new > use-cases but just to ensure that existing queries that involve UNIONTYPE can > exploit the CBO. -- This message was sent by Atlassian Jira (v8.20.10#820010)