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

Jason Altekruse updated DRILL-2011:
-----------------------------------
    Description: 
This last query in this test will currently fail to plan, the exception is - 
SEVERE: org.eigenbase.util.EigenbaseContextException: At line 0, column 0: 
Table 'EXPR$0' not found

The anonymous sub-query in the view is not able to be resolved inside of 
calcite, simply giving an alias to the subquery fixes the planning issue. The 
query runs fine if not defined in a view.

{{
  @Test
  public void testAggOnSubquery() throws Exception {
    test("use dfs.tmp");
    test("create or replace view testAggOnSubquery_view as select n_nationkey, 
sum(n_regionkey) from (select n_nationkey,n_regionkey from 
cp.`tpch/nation.parquet`) GROUP BY n_nationkey");
    test("select n_nationkey from testAggOnSubquery_view");
  }
}}

This runs fine
{{
select n_nationkey from (select n_nationkey, sum(n_regionkey) from (select 
n_nationkey,n_regionkey from cp.`tpch/nation.parquet`) GROUP BY n_nationkey)
}}

  was:
This last query in this test will currently fail to plan, the exception is - 
SEVERE: org.eigenbase.util.EigenbaseContextException: At line 0, column 0: 
Table 'EXPR$0' not found

The anonymous sub-query in the view is not able to be resolved inside of 
calcite, simply giving an alias to the subquery fixes the planning issue. The 
query runs fine if not defined in a view.

<code>
  @Test
  public void testAggOnSubquery() throws Exception {
    test("use dfs.tmp");
    test("create or replace view testAggOnSubquery_view as select n_nationkey, 
sum(n_regionkey) from (select n_nationkey,n_regionkey from 
cp.`tpch/nation.parquet`) GROUP BY n_nationkey");
    test("select n_nationkey from testAggOnSubquery_view");
  }

</code>

This runs fine
<code>
select n_nationkey from (select n_nationkey, sum(n_regionkey) from (select 
n_nationkey,n_regionkey from cp.`tpch/nation.parquet`) GROUP BY n_nationkey)
</code>


> View on top of a aggregation over a subquery fails to plan
> ----------------------------------------------------------
>
>                 Key: DRILL-2011
>                 URL: https://issues.apache.org/jira/browse/DRILL-2011
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Jason Altekruse
>
> This last query in this test will currently fail to plan, the exception is - 
> SEVERE: org.eigenbase.util.EigenbaseContextException: At line 0, column 0: 
> Table 'EXPR$0' not found
> The anonymous sub-query in the view is not able to be resolved inside of 
> calcite, simply giving an alias to the subquery fixes the planning issue. The 
> query runs fine if not defined in a view.
> {{
>   @Test
>   public void testAggOnSubquery() throws Exception {
>     test("use dfs.tmp");
>     test("create or replace view testAggOnSubquery_view as select 
> n_nationkey, sum(n_regionkey) from (select n_nationkey,n_regionkey from 
> cp.`tpch/nation.parquet`) GROUP BY n_nationkey");
>     test("select n_nationkey from testAggOnSubquery_view");
>   }
> }}
> This runs fine
> {{
> select n_nationkey from (select n_nationkey, sum(n_regionkey) from (select 
> n_nationkey,n_regionkey from cp.`tpch/nation.parquet`) GROUP BY n_nationkey)
> }}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to