You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2017/06/14 01:04:00 UTC
[jira] [Assigned] (HIVE-16881) Make extractSqlBoolean More
Consistent
[ https://issues.apache.org/jira/browse/HIVE-16881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
BELUGA BEHR reassigned HIVE-16881:
----------------------------------
Assignee: BELUGA BEHR
> Make extractSqlBoolean More Consistent
> --------------------------------------
>
> Key: HIVE-16881
> URL: https://issues.apache.org/jira/browse/HIVE-16881
> Project: Hive
> Issue Type: Improvement
> Components: Metastore
> Affects Versions: 2.1.1, 3.0.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Trivial
> Attachments: HIVE-16881.1.patch, HIVE-16881.2.patch
>
>
> {code:title=org.apache.hadoop.hive.metastore.MetaStoreDirectSql|borderStyle=solid}
> private static Boolean extractSqlBoolean(Object value) throws MetaException {
> // MySQL has booleans, but e.g. Derby uses 'Y'/'N' mapping. People using derby probably
> // don't care about performance anyway, but let's cover the common case.
> if (value == null) return null;
> if (value instanceof Boolean) return (Boolean)value;
> Character c = null;
> if (value instanceof String && ((String)value).length() == 1) {
> c = ((String)value).charAt(0);
> }
> if (c == null) return null;
> if (c == 'Y') return true;
> if (c == 'N') return false;
> throw new MetaException("Cannot extract boolean from column value " + value);
> }
> {code}
> It's not very clear here what the code intends. For example, if the _value_ is "YE" then the code returns _null_. If the _value_ is "Z" then an exception is thrown.
> # Change this to throw an exception when any invalid value is encountered
> # Add comments
> # Use Apache Commons Library for parsing
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)