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

Alicia Ying Shu commented on PHOENIX-2886:
------------------------------------------

Agree that we need to check MaxLength and max Scale and their nullables for 
target data types. As for SortOrder it is different. The final sort order of 
Union All query is determined by ORDER BY. The individual Sort Order of the 
individual sql query will not change even we change the Sort Order here since 
we will not add a SORT operation. It is just a placeholder for creating 
PColumnImpl for projection. So it is a no-op and we do not need to check/change 
it in target data types, Order by will take care it in the final results. If 
there is no Order By, the order of results for individual query will keep as it 
is.

> Union ALL with Char column  not present in the table in Query 1 but in Query 
> 2 throw exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-2886
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2886
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Alicia Ying Shu
>            Assignee: Alicia Ying Shu
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2886-v1.patch, PHOENIX-2886-v2.patch, 
> PHOENIX-2886-v3.patch, PHOENIX-2886.patch, UnionAllIT.java.diff
>
>
> To reproduce:
> create table person ( id bigint not null primary key, firstname char(10), 
> lastname varchar(10) );
> upsert into person values( 1, 'john', 'doe');
> upsert into person values( 2, 'jane', 'doe');
> -- fixed value for char(10)
> select id, 'foo' firstname, lastname from person union all select * from 
> person;
> java.lang.RuntimeException: java.sql.SQLException: ERROR 201 (22000): Illegal 
> data. Expected length of at least 106 bytes, but had 13
> -- fixed value for bigint
> select cast( 10 AS bigint) id, 'foo' firstname, lastname from person union 
> all select * from person;
> java.lang.RuntimeException: java.sql.SQLException: ERROR 201 (22000): Illegal 
> data. Expected length of at least 106 bytes, but had 13



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

Reply via email to