Daryl Teo created NIFI-977:
------------------------------

             Summary: PutSQL - attribute type cannot be negative
                 Key: NIFI-977
                 URL: https://issues.apache.org/jira/browse/NIFI-977
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 0.3.0
            Reporter: Daryl Teo
            Priority: Minor


- PutSQL expects JDBC Types numeric values.
- FlowFile attributes are String based.
- Some JDBC Types have negative numeric values.
For example - BIGINT is -5

http://docs.oracle.com/javase/7/docs/api/constant-values.html#java.sql.Types.BIGINT

- NUMBER_PATTERN only looks for digits. 

https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutSQL.java#L147

Reproduce

- Use a UpdateAttribute + ReplaceText processors to prepare a SQL statement
- Set sql.args.1.type to -5
- Set sql.args.1.value to '123'
- Set text to some sql statement.
- Pipe success relationship into PutSQL

Effect 

- error log : sql.args.1.type is not a valid jdbc numeral value

Workarounds

- Use supported types with positive numbers. May lead to loss of precision 
(setInt vs setLong).

Proposed fix

- change NUMBER_PATTERN from \\d+ to -?\\d+



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

Reply via email to