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

James Taylor commented on PHOENIX-2886:
---------------------------------------

Please let me know what query you're running and what exception you're getting. 
For example, I ran this:
{code}
create table person ( id bigint not null primary key, firstname char(10), 
lastname varchar(10) );
select id, cast( 'foo' as char(10)) firstname, lastname from person union all 
select * from person;
{code}
and I got the following exception with this stack trace:
{code}
stack trace here
{code}

What's your expected output? How many rows does the person table have?

There should be no coerce necessary to be inserted into that sql statement as 
all of the types should match.

Also, this is a very strange test case, as it'll duplicate the person table, 
but with 'foo' as the first name for the first set of rows. Always better if 
you can write more sensible tests.

> 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
>
>
> 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