JIRA TRAFODION-2099 Add support for boolean datatype #590
Conversation
-- boolean datatype support in create, cast and params Ex: create table t (a boolean); insert into t values (true), (false); select * from t where a = true; -- boolean datatype support for hive columns -- unarith op support. Currently used for '!' operator that negates a boolean value. Ex: select * from t where !a = false; -- support for more tinyint and largeint unsigned conversion/comparison operations in expressions and pcode -- some code cleanup: removed reference to downrev compiler code genration -- create table if not exists as select... syntax support -- regress/seabase/TEST003 updated with additional tests
Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/901/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/901/ |
Wow, this is a huge change. I didn't look at all the details, just at the big picture, and that looks good to me. Let me just ask a few questions, sorry, I should probably have answered those by myself by looking at the code: We have these type classes, numerics, strings, datetime, interval. Where does boolean fit in here, is it treated as an exact numeric in internal methods? If so, some code has subclasses of numbers with binary and decimal precision, would this be another case that allows only two values? I'm partially thinking of UDFs, and how we should treat boolean values there. As far as i can tell, this follows the ANSI definition of a boolean data type, is this true or are there differences? Is this just experimental for now or should we add this type to the SQL Reference Manual? Thanks, there are only a few people who can pull off a big change like this :-) |
@@ -40,41 +40,107 @@ | |||
|
|||
// *********************************************************************** | |||
// | |||
// SQLBoolean : The boolean data type | |||
// SQLBooleanBase : The boolean data type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A SQL version of the famous French stew. :-)
Looks good. All my comments are minor, except the one in str.cpp which I suspect is a genuine bug. A general question: It looks like the only operations allowed on BOOLEAN columns are =, !=, and !. Are there plans to add support for AND and OR? Could I AND a BOOLEAN column with the result of a predicate? |
Response to Hans/Dave's comment regarding boolean datatype. Boolean datatype is not a numeric datatype. There is still some support for boolean needed in drivers and SPJ/UDF. We could also enhance it later so relational and boolean datatype operations can be mixed. |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/909/ |
Looks good! |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/909/ |
-- boolean datatype support in create, cast and params
Ex:
create table t (a boolean);
insert into t values (true), (false);
select * from t where a = true;
-- boolean datatype support for hive columns
-- unarith op support. Currently used for '!' operator that
negates a boolean value.
Ex: select * from t where !a = false;
-- support for more tinyint and largeint unsigned conversion/comparison
operations in expressions and pcode
-- some code cleanup: removed reference to downrev compiler code genration
-- create table if not exists as select... syntax support
-- regress/seabase/TEST003 updated with additional tests