[ 
https://issues.apache.org/jira/browse/DRILL-1101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14052036#comment-14052036
 ] 

Aman Sinha commented on DRILL-1101:
-----------------------------------

This is actually an issue with Unioning of two constant strings which are of 
different length.  The following also gives a CannotPlanException.   However, 
this restriction may be too strict...we may want to relax it. 

0: jdbc:drill:zk=local> explain plan for select 'abcdef'  from nation union all 
select 'xyz' from region;
Jul 03, 2014 4:35:20 PM org.apache.drill.exec.planner.logical.DrillUnionRule 
onMatch
WARNING: org.eigenbase.rel.InvalidRelException: Input row types of the Union 
are not compatible.
error_type: 0
message: "Failure while parsing sql. < CannotPlanException:[ Node 
[rel#40794:Subset#4.LOGICAL.ANY([]).[]] could not be implemented; planner state:


> Cannot plan exception- Union all
> --------------------------------
>
>                 Key: DRILL-1101
>                 URL: https://issues.apache.org/jira/browse/DRILL-1101
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Ramana Inukonda Nagaraj
>            Assignee: Aman Sinha
>            Priority: Blocker
>
> Following query results in a CannotPlanException
> select   emails.technology_type , emails.organization,
> emails.metric_no, emails.metric_name, emails.metric_value
> from(
>         select 'emails' as technology_type ,
>         b1.organization as organization,
>         1 as metric_no, 'email_count' as metric_name, 2*count(distinct 
> message_id) as metric_value
>         from emails a1
>         left outer join employee_table b1 
>         on (a1.sender_address = b1.emailid)
>         where a1.event_id = 'RECEIVE'
>         group by b1.organization
>         union all
>         select 'emails' as technology_type,   
>         b2.organization as organization,
>         2 as metric_no, 'email_active_employee_count' as metric_name, 
> count(*) as metric_value
>         from employee_table b2
>         where b2.status = 'A'
>         group by b2.organization
> ) emails;



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to