You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/12/23 16:13:46 UTC

[jira] [Commented] (NIFI-1328) PutSQL Error Inserting an integer to a Phoenix table

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

ASF GitHub Bot commented on NIFI-1328:
--------------------------------------

GitHub user bbende opened a pull request:

    https://github.com/apache/nifi/pull/146

    NIFI-1328 Explicitly setting the parameters based on type in PutSQL

    NIFI-1241 was to address adding support for BOOLEAN, NUMERIC, and DECIMAL to PutSQL. In that ticket we removed the case statement where we explicitly set the parameters based on type, and instead used setObject(...).
    
    This change goes back to explicitly setting the parameters, adding those three types mentioned above, and then defaults to using setObject(...) for any types we didn't explicitly call out.

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

    $ git pull https://github.com/bbende/nifi NIFI-1328

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

    https://github.com/apache/nifi/pull/146.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 #146
    
----
commit 8bf78b1a52093f27fb6c30222107ec44356e15a3
Author: Bryan Bende <bb...@apache.org>
Date:   2015-12-23T15:02:21Z

    NIFI-1328 Explicitly setting the parameters based on type in PutSQL, falling back to setObject()

----


> PutSQL Error Inserting an integer to a Phoenix table
> ----------------------------------------------------
>
>                 Key: NIFI-1328
>                 URL: https://issues.apache.org/jira/browse/NIFI-1328
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.4.0, 0.4.1
>            Reporter: Bryan Bende
>            Assignee: Bryan Bende
>            Priority: Critical
>             Fix For: 0.5.0
>
>
> In 0.4.0 we condensed a big case statement in PutSQL down to this (around line 728):
> {code}
> stmt.setObject(parameterIndex, parameterValue, jdbcType);
> {code}
> If we send a String as parameterValue, with a jdbcType of 4 which is “int”, this Phoenix method which doesn’t like that:
> https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java#L439
> Before we had:
> {code}
> case Types.INTEGER:
>                     stmt.setInt(parameterIndex, Integer.parseInt(parameterValue));
>                     break;
> {code}
> So it worked because Phoenix didn’t have to do any conversion. We need to consider going back to explicitly converting the string like we were doing before.



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