Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distinct predicate fails with Mismatched types: varchar(1) vs varchar(32) #7727

Open
the6campbells opened this issue Apr 2, 2017 · 2 comments
Labels

Comments

@the6campbells
Copy link

Presto server/jdbc 0.170

Mapped to MySQL

select rnum, tvchar.cvchar from mysql_cert.dbcert.tvchar where tvchar.cvchar is distinct from ' '

select rnum, tvchar.cvchar from mysql_cert.dbcert.tvchar where not ( tvchar.cvchar is not distinct from ' ')

Error: Query failed (#20170402_174600_04939_impt7): Mismatched types: varchar(1) vs varchar(32)
SQLState: null
ErrorCode: 65536

create table TVCHAR ( RNUM integer not null , CVCHAR varchar(32 ) null ) ;

insert into TVCHAR(RNUM, CVCHAR) values ( 0, NULL);
insert into TVCHAR(RNUM, CVCHAR) values ( 1, '');
insert into TVCHAR(RNUM, CVCHAR) values ( 2, ' ');
insert into TVCHAR(RNUM, CVCHAR) values ( 3, 'BB');
insert into TVCHAR(RNUM, CVCHAR) values ( 4, 'EE');
insert into TVCHAR(RNUM, CVCHAR) values ( 5, 'FF');

vs others which function including

select rnum, tvchar.cvchar from mysql_cert.dbcert.tvchar where tvchar.cvchar is not distinct from ' '

select rnum, tvchar.cvchar from mysql_cert.dbcert.tvchar where (tvchar.cvchar = ' ') or (tvchar.cvchar is null and ' ' is null)

@sopel39 sopel39 added the bug label Apr 3, 2017
@sopel39
Copy link
Contributor

sopel39 commented Apr 3, 2017

this indeed seems like a bug. Implicit cast should be used. FYI: @martint

@dqmdev
Copy link

dqmdev commented Sep 29, 2023

same issue exists in recent (i.e 0.279+) versions of Presto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants