[jira] [Commented] (HIVE-17844) Hive JDBC driver converts floats to doubles, changing values slightly

2018-02-09 Thread Vihang Karajgaonkar (JIRA)

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

Vihang Karajgaonkar commented on HIVE-17844:


[~zi] Can you give a example query which can lead to incorrect results? Thanks 
for reporting this..

> Hive JDBC driver converts floats to doubles, changing values slightly
> -
>
> Key: HIVE-17844
> URL: https://issues.apache.org/jira/browse/HIVE-17844
> Project: Hive
>  Issue Type: Bug
>  Components: JDBC
>Reporter: Zoltan Ivanfi
>Priority: Major
>
> When querying data through Hive's JDBC driver, float values are automatically 
> converted to doubles and will slightly differ from values seen when directly 
> querying the data using a textual SQL interface.
> Please note that by slight difference I don't only mean additional zeroes at 
> the end, but an actual numeric difference in the displayed value. This is the 
> result of the different precision used when displaying double values, as 
> discussed 
> [here|https://stackoverflow.com/questions/17504833/why-converting-from-float-to-double-changes-the-value],
>  for example.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (HIVE-17844) Hive JDBC driver converts floats to doubles, changing values slightly

2017-10-20 Thread Zoltan Ivanfi (JIRA)

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

Zoltan Ivanfi commented on HIVE-17844:
--

[~akolb], yes, that's true, but it doesn't represent the initial user-supplied 
number faithfully any more.

If the user supplies the value 125.32, it can not be represented as a float 
precisely, but rounding rules during displaying that float will still display 
125.32. However, when converting that float to double, different, more precise 
rounding rules start to apply, resulting in 125.3169482422 getting 
displayed instead of 125.32. It is true that the double value is precisely the 
same as the float value, yet although none of them is precisely the same as the 
user-supplied value, the float gets displayed as the original value and the 
double isn't.

If 125.32 is stored directly to a double, then it is approximated more 
precisely and will display correctly. When it is stored as a float and then 
converted to a double, this is no longer true.

> Hive JDBC driver converts floats to doubles, changing values slightly
> -
>
> Key: HIVE-17844
> URL: https://issues.apache.org/jira/browse/HIVE-17844
> Project: Hive
>  Issue Type: Bug
>  Components: JDBC
>Reporter: Zoltan Ivanfi
>
> When querying data through Hive's JDBC driver, float values are automatically 
> converted to doubles and will slightly differ from values seen when directly 
> querying the data using a textual SQL interface.
> Please note that by slight difference I don't only mean additional zeroes at 
> the end, but an actual numeric difference in the displayed value. This is the 
> result of the different precision used when displaying double values, as 
> discussed 
> [here|https://stackoverflow.com/questions/17504833/why-converting-from-float-to-double-changes-the-value],
>  for example.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HIVE-17844) Hive JDBC driver converts floats to doubles, changing values slightly

2017-10-20 Thread Alexander Kolbasov (JIRA)

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

Alexander Kolbasov commented on HIVE-17844:
---

According to the discussion that Zoltan refers to, the double represents float 
precisely, but the printed representation is different.

> Hive JDBC driver converts floats to doubles, changing values slightly
> -
>
> Key: HIVE-17844
> URL: https://issues.apache.org/jira/browse/HIVE-17844
> Project: Hive
>  Issue Type: Bug
>  Components: JDBC
>Reporter: Zoltan Ivanfi
>
> When querying data through Hive's JDBC driver, float values are automatically 
> converted to doubles and will slightly differ from values seen when directly 
> querying the data using a textual SQL interface.
> Please note that by slight difference I don't only mean additional zeroes at 
> the end, but an actual numeric difference in the displayed value. This is the 
> result of the different precision used when displaying double values, as 
> discussed 
> [here|https://stackoverflow.com/questions/17504833/why-converting-from-float-to-double-changes-the-value],
>  for example.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)