Query failed : Exception: Cast from BOOLEAN to BOOLEAN not supported


#1

While MAPD doesn’t claim to support distinct predicate, this results in an expected error, suggesting re-written query failing.

select rnum, tsint.csint from tsint where tsint.csint is distinct from 1
Error: Query failed : Exception: Cast from BOOLEAN to BOOLEAN not supported

create table if not exists TSINT ( RNUM integer not null , CSINT smallint );
insert into TSINT(RNUM, CSINT) values ( 0, NULL);
insert into TSINT(RNUM, CSINT) values ( 1, -1);
insert into TSINT(RNUM, CSINT) values ( 2, 0);
insert into TSINT(RNUM, CSINT) values ( 3, 1);
insert into TSINT(RNUM, CSINT) values ( 4, 10);


#2

Hi,

Yes, calcite is doing a rewrite

mapdql> explain calcite select rnum, tsint.csint from tsint where tsint.csint is distinct from 1;
Explanation
LogicalProject(rnum=[$0], csint=[$1])
  LogicalFilter(condition=[CAST(CASE(IS NULL($1), IS NOT NULL(1), IS NULL(1), IS NOT NULL($1), <>($1, 1))):BOOLEAN NOT NULL])
    EnumerableTableScan(table=[[mapd, TSINT]])

It should be fairly easy for us to allow a CAST from boolean to boolean

Will raise an issue.

regards


#3

issue https://github.com/mapd/mapd-core/issues/173 created