You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/01/19 04:01:39 UTC

[jira] [Commented] (PHOENIX-2454) Upsert with Double.NaN returns NumberFormatException

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

ASF GitHub Bot commented on PHOENIX-2454:
-----------------------------------------

GitHub user chuxi opened a pull request:

    https://github.com/apache/phoenix/pull/148

    bugfix: PHOENIX-2454 Upsert with Double.NaN returns NumberFormatException

    the bug is on the lira: https://issues.apache.org/jira/browse/PHOENIX-2454
    
    I met the problem when some value in the DataFrame is NaN(Double.NaN and Float.NaN), and it is really important part as storing DataFrame into Phoenix Table. 
    
    So can the community merge this PR? 
    
    Int, Long, and Short, Byte has no NaN in Scala
    
    It has simple logic inside. I have already did basic test. But maybe someone else could test totally. :)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/chuxi/phoenix master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/phoenix/pull/148.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #148
    
----
commit 548e07c843d343796f53f783867a92a6a0cf03af
Author: jinhanwei <ji...@growingio.com>
Date:   2016-01-19T02:52:36Z

    bugfix: PHOENIX-2454 Upsert with Double.NaN returns NumberFormatException

----


> Upsert with Double.NaN returns NumberFormatException
> ----------------------------------------------------
>
>                 Key: PHOENIX-2454
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2454
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: alex kamil
>            Priority: Minor
>
> When saving Double.NaN via prepared statement into column of type Double getting NumberFormatException (while expected behavior is saving null)
> test case:
> {code}
> import java.sql.*;
> public static void main(String [] args){
>   try {
> 	  Connection phoenixConnection = DriverManager.getConnection("jdbc:phoenix:localhost");
> 	  String sql  = "CREATE TABLE test25 (id BIGINT not null primary key,  col1 double, col2 double)";
> 	  Statement stmt = phoenixConnection.createStatement();
> 	  stmt.executeUpdate(sql);
> 	  phoenixConnection.commit();
> 	  
> 	  sql = "UPSERT INTO test25 (id, col1,col2) VALUES (?,?,?)";
> 	  PreparedStatement ps = phoenixConnection.prepareStatement(sql);
> 	  ps.setInt(1, 12);
> 	  ps.setDouble(2, 2.5);
> 	  ps.setDouble(3, Double.NaN);
> 	  ps.executeUpdate();
> 	  phoenixConnection.commit();
> 	  phoenixConnection.close();
> 	  } catch (Exception e) {
> 	         e.printStackTrace();
> 	  }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)