[ 
https://issues.apache.org/jira/browse/IMPALA-14563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on IMPALA-14563 started by Surya Hebbar.
---------------------------------------------
> IllegalStateException when aggregating complex type
> ---------------------------------------------------
>
>                 Key: IMPALA-14563
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14563
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Noémi Pap-Takács
>            Assignee: Surya Hebbar
>            Priority: Major
>              Labels: complextype, impala-iceberg
>
> We throw an IllegalStateException when the user tries to aggregate by a 
> column that is a complex type. We should throw an AnalysisException instead.
>  
> h4. Example to reproduce the issue:
> Create a partitioned Iceberg table from tpch_parquet.lineitem:
> {code:java}
> CREATE TABLE ice_lineitem_part AS 
> SELECT * FROM tpch_parquet.lineitem 
> PARTITIONED BY SPEC(l_linenumber) 
> STORED AS ICEBERG;
> {code}
> Query the metadata table, aggregating by the `partition` column which is a 
> complex type:
> {noformat}
> Query: select `partition`, AVG(file_size_in_bytes) from 
> default.ice_lineitem_part.`files` group by `partition`
> {noformat}
> Exception:
> {noformat}
> IllegalStateException: null
> I20251113 15:04:31.439616 183824 jni-util.cc:321] 
> a64e95977de2e096:3af17e2000000000] java.lang.IllegalStateException
> at com.google.common.base.Preconditions.checkState(Preconditions.java:496)
> at 
> org.apache.impala.analysis.SlotRef.addStructChildrenAsSlotRefs(SlotRef.java:264)
> at org.apache.impala.analysis.SlotRef.<init>(SlotRef.java:93)
> at 
> org.apache.impala.analysis.AggregateInfoBase.createTupleDesc(AggregateInfoBase.java:135)
> at 
> org.apache.impala.analysis.AggregateInfoBase.createTupleDescs(AggregateInfoBase.java:101)
> at org.apache.impala.analysis.AggregateInfo.create(AggregateInfo.java:161)
> at org.apache.impala.analysis.AggregateInfo.create(AggregateInfo.java:182)
> at 
> org.apache.impala.analysis.MultiAggregateInfo.analyze(MultiAggregateInfo.java:310)
> at 
> org.apache.impala.analysis.SelectStmt$SelectAnalyzer.buildAggregateExprs(SelectStmt.java:1222)
> at 
> org.apache.impala.analysis.SelectStmt$SelectAnalyzer.analyze(SelectStmt.java:358)
> at 
> org.apache.impala.analysis.SelectStmt$SelectAnalyzer.access$100(SelectStmt.java:285)
> at org.apache.impala.analysis.SelectStmt.analyze(SelectStmt.java:277)
> at 
> org.apache.impala.analysis.AnalysisContext$AnalysisDriverImpl.analyze(AnalysisContext.java:576)
> at 
> org.apache.impala.analysis.AnalysisContext.analyzeAndAuthorize(AnalysisContext.java:496)
> at org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:2972)
> at org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:2539)
> at 
> org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2408)
> at org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2097)
> at 
> org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:176)
> I20251113 15:04:31.439733 183824 status.cc:129] 
> a64e95977de2e096:3af17e2000000000] IllegalStateException: null
>     @          0x116f403  impala::Status::Status()
>     @          0x1a9d537  impala::JniUtil::GetJniExceptionMsg()
>     @          0x178d892  impala::JniCall::Call<>()
>     @          0x175cbbd  impala::Frontend::GetExecRequest()
>     @          0x24e8d6f  impala::QueryDriver::DoFrontendPlanning()
>     @          0x24e8f29  impala::QueryDriver::RunFrontendPlanner()
>     @          0x1841669  impala::ImpalaServer::ExecuteInternal()
>     @          0x1842531  impala::ImpalaServer::Execute()
>     @          0x17c3187  impala::ImpalaServer::ExecuteStatementCommon()
>     @          0x17c44d9  impala::ImpalaServer::ExecuteStatement()
> {noformat}
>  
> A correct query would be aggregating by a specific field of the complex type, 
> e.g.:
> {code:java}
> select `partition`.l_linenumber, AVG(file_size_in_bytes) from 
> default.ice_lineitem_part7.`files` group by `partition`.l_linenumber; {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to