[
https://issues.apache.org/jira/browse/PHOENIX-2454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
alex kamil updated PHOENIX-2454:
--------------------------------
Description:
When saving Double.NaN via prepared statement into column of type Double
getting NumberFormatException (while expected behavior is saving null)
test case:
{quote}
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();
}
}
{quote}
was:When saving Double.NaN via prepared statement into column of type Double
getting NumberFormatException (while expected behavior is saving null)
> 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:
> {quote}
> 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();
> }
> }
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)