You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Matt Burgess <ma...@apache.org> on 2016/07/28 17:56:59 UTC

Double objects in ResultSet with column type Float

Hello all,

I had a question about the Hive JDBC driver and its treatment of
float/double types.  According to the following, floating-point
literals are treated as doubles:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-FloatingPointTypes.

So let's say I have a column in position 2 of "float" type and I do an
insert that sets the column's value for that row to 1.0.  If I do a
executeQuery from the JDBC driver and call ResultSet.getObject(2), I
get a Double back even though if I do a
ResultSet.getMetaData().getColumnType(2) I get a 6
(java.sql.Types.FLOAT). If I call getFloat(2), I get a Float object
back.

Is this the intended behavior? If not, is it a bug? I couldn't find a
Jira but perhaps it is related to the following Jira:
https://issues.apache.org/jira/browse/HIVE-1631 ?

Thanks in advance,
Matt