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

Quanlong Huang updated IMPALA-14957:
------------------------------------
    Description: 
The following query failed with IllegalStateException
{code:sql}
with l as (
  select 1, 2
  UNION ALL
  SELECT id, unnest(arr1) FROM functional_parquet.complextypes_arrays)
select * from l LIMIT 10;{code}
The error logs:
{noformat}
I20260507 15:19:21.481348 515633 Frontend.java:2443] 
d24a51e768b3d7fa:cf72dba300000000] OriginalPlanner planner failed: class 
java.lang.IllegalStateException
I20260507 15:19:21.481555 515633 jni-util.cc:335] 
d24a51e768b3d7fa:cf72dba300000000] java.lang.RuntimeException: 
java.lang.IllegalStateException: computeMemLayout not done for slot: arr1 
(tid=1 sid=2)
        at 
org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2459)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2126)
        at 
org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:175)
Caused by: java.lang.IllegalStateException: computeMemLayout not done for slot: 
arr1 (tid=1 sid=2)
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:601)
        at org.apache.impala.analysis.SlotRef.toThrift(SlotRef.java:333)
        at org.apache.impala.analysis.Expr.treeToThriftHelper(Expr.java:906)
        at org.apache.impala.analysis.Expr.treeToThrift(Expr.java:884)
        at org.apache.impala.analysis.Expr.treesToThrift(Expr.java:948)
        at org.apache.impala.planner.UnionNode.toThrift(UnionNode.java:363)
        at 
org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:592)
        at 
org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:599)
        at org.apache.impala.planner.PlanNode.treeToThrift(PlanNode.java:523)
        at 
org.apache.impala.planner.PlanFragment.toThrift(PlanFragment.java:656)
        at 
org.apache.impala.service.Frontend.createPlanExecInfo(Frontend.java:2050)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2078)
        at 
org.apache.impala.service.Frontend.getPlannedExecRequest(Frontend.java:3424)
        at 
org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:3198)
        at 
org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:2590)
        at 
org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2436)
        ... 2 more{noformat}
It seems an issue of unnest(). I can workaround the error by not using unnest():
{code:sql}
with l as (
  select 1, 2
  UNION ALL
  SELECT id, a.item FROM functional_parquet.complextypes_arrays t, t.arr1 a)
select * from l LIMIT 10;

+---+------+
| 1 | 2    |
+---+------+
| 1 | 1    |
| 1 | 2    |
| 1 | 3    |
| 1 | 4    |
| 1 | 5    |
| 2 | 1    |
| 2 | NULL |
| 2 | 3    |
| 2 | 4    |
| 2 | 5    |
+---+------+
Fetched 10 row(s) in 0.59s{code}

  was:
The following query failed with IllegalStateException
{code:sql}
with l as (
  select 1, 2
  UNION ALL
  SELECT id, unnest(arr1) FROM functional_parquet.complextypes_arrays)
select * from l LIMIT 10;{code}
The error logs:
{noformat}
I20260507 15:19:21.481348 515633 Frontend.java:2443] 
d24a51e768b3d7fa:cf72dba300000000] OriginalPlanner planner failed: class 
java.lang.IllegalStateException
I20260507 15:19:21.481555 515633 jni-util.cc:335] 
d24a51e768b3d7fa:cf72dba300000000] java.lang.RuntimeException: 
java.lang.IllegalStateException: computeMemLayout not done for slot: arr1 
(tid=1 sid=2)
        at 
org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2459)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2126)
        at 
org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:175)
Caused by: java.lang.IllegalStateException: computeMemLayout not done for slot: 
arr1 (tid=1 sid=2)
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:601)
        at org.apache.impala.analysis.SlotRef.toThrift(SlotRef.java:333)
        at org.apache.impala.analysis.Expr.treeToThriftHelper(Expr.java:906)
        at org.apache.impala.analysis.Expr.treeToThrift(Expr.java:884)
        at org.apache.impala.analysis.Expr.treesToThrift(Expr.java:948)
        at org.apache.impala.planner.UnionNode.toThrift(UnionNode.java:363)
        at 
org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:592)
        at 
org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:599)
        at org.apache.impala.planner.PlanNode.treeToThrift(PlanNode.java:523)
        at 
org.apache.impala.planner.PlanFragment.toThrift(PlanFragment.java:656)
        at 
org.apache.impala.service.Frontend.createPlanExecInfo(Frontend.java:2050)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2078)
        at 
org.apache.impala.service.Frontend.getPlannedExecRequest(Frontend.java:3424)
        at 
org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:3198)
        at 
org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:2590)
        at 
org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2436)
        ... 2 more{noformat}
It seems an issue of unnest(). I can workaround the error by not using unnest():
{code:sql}
with l as (
  select 1, 2
  UNION ALL
  SELECT id, a.item FROM functional_parquet.complextypes_arrays t, t.arr1 a)
select * from l LIMIT 10;{code}


> IllegalStateException when using unnest() with UNION in inline view
> -------------------------------------------------------------------
>
>                 Key: IMPALA-14957
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14957
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Quanlong Huang
>            Assignee: Quanlong Huang
>            Priority: Critical
>
> The following query failed with IllegalStateException
> {code:sql}
> with l as (
>   select 1, 2
>   UNION ALL
>   SELECT id, unnest(arr1) FROM functional_parquet.complextypes_arrays)
> select * from l LIMIT 10;{code}
> The error logs:
> {noformat}
> I20260507 15:19:21.481348 515633 Frontend.java:2443] 
> d24a51e768b3d7fa:cf72dba300000000] OriginalPlanner planner failed: class 
> java.lang.IllegalStateException
> I20260507 15:19:21.481555 515633 jni-util.cc:335] 
> d24a51e768b3d7fa:cf72dba300000000] java.lang.RuntimeException: 
> java.lang.IllegalStateException: computeMemLayout not done for slot: arr1 
> (tid=1 sid=2)
>         at 
> org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2459)
>         at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2126)
>         at 
> org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:175)
> Caused by: java.lang.IllegalStateException: computeMemLayout not done for 
> slot: arr1 (tid=1 sid=2)
>         at 
> com.google.common.base.Preconditions.checkState(Preconditions.java:601)
>         at org.apache.impala.analysis.SlotRef.toThrift(SlotRef.java:333)
>         at org.apache.impala.analysis.Expr.treeToThriftHelper(Expr.java:906)
>         at org.apache.impala.analysis.Expr.treeToThrift(Expr.java:884)
>         at org.apache.impala.analysis.Expr.treesToThrift(Expr.java:948)
>         at org.apache.impala.planner.UnionNode.toThrift(UnionNode.java:363)
>         at 
> org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:592)
>         at 
> org.apache.impala.planner.PlanNode.treeToThriftHelper(PlanNode.java:599)
>         at org.apache.impala.planner.PlanNode.treeToThrift(PlanNode.java:523)
>         at 
> org.apache.impala.planner.PlanFragment.toThrift(PlanFragment.java:656)
>         at 
> org.apache.impala.service.Frontend.createPlanExecInfo(Frontend.java:2050)
>         at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:2078)
>         at 
> org.apache.impala.service.Frontend.getPlannedExecRequest(Frontend.java:3424)
>         at 
> org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:3198)
>         at 
> org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:2590)
>         at 
> org.apache.impala.service.Frontend.getTExecRequestWithFallback(Frontend.java:2436)
>         ... 2 more{noformat}
> It seems an issue of unnest(). I can workaround the error by not using 
> unnest():
> {code:sql}
> with l as (
>   select 1, 2
>   UNION ALL
>   SELECT id, a.item FROM functional_parquet.complextypes_arrays t, t.arr1 a)
> select * from l LIMIT 10;
> +---+------+
> | 1 | 2    |
> +---+------+
> | 1 | 1    |
> | 1 | 2    |
> | 1 | 3    |
> | 1 | 4    |
> | 1 | 5    |
> | 2 | 1    |
> | 2 | NULL |
> | 2 | 3    |
> | 2 | 4    |
> | 2 | 5    |
> +---+------+
> Fetched 10 row(s) in 0.59s{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