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

Zoltan Haindrich commented on HIVE-22706:
-----------------------------------------

now that I've dived into this I'm starting to understand how unfortunate this 
is....this issue is somewhat specific to metastore tables 
* for boolean columns we use "CHAR(1)"  for derby; I've tried the BOOLEAN type; 
but it didn't really worked (so our jpa implementation (as it is now) doesn't 
like the BOOLEAN datatype) 
* somehow updating the could to true/false thru the metastore/jpa way make the 
CHAR(1) column contain 'N' or 'Y'
* when we access the same value thru the JDBC storage handler; we will end up 
in the [getBoolean() method of the CHAR 
type|https://github.com/apache/derby/blob/4253dcf4aa37dc64cf7235d494cd2f00f72e678a/java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLChar.java#L343]
 which interprets "0" and "false" as false other values as true

right now I'm not sure where is the logic which transforms true/false into 'Y' 
and 'N' - but as a result of that conversion; we will see a bunch of 'true' 
values when using the sys database... 

This could be probably fixed by extending the jdbc handler 
[here|https://github.com/apache/hive/blob/36f58c5f8f4d7ea65eb6ec90b84e3bec513ee0a1/jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/dao/JdbcRecordIterator.java#L112]
 to also accept 'N' as a false value in case the underlying BOOLEAN column is 
CHAR....

> Jdbc storage handler incorrectly interprets boolean column value in derby
> -------------------------------------------------------------------------
>
>                 Key: HIVE-22706
>                 URL: https://issues.apache.org/jira/browse/HIVE-22706
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>
> in case the column value is false ; the storage handler interprets it as true



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to