AaronLeon commented on a change in pull request #3410: NIFI-6100 Use setBytes 
in JdbcCommon for binary types
URL: https://github.com/apache/nifi/pull/3410#discussion_r286171830
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java
 ##########
 @@ -807,7 +807,7 @@ public static void setParameter(final PreparedStatement 
stmt, final String attrN
                             throw new ParseException("Unable to parse binary 
data using the formatter `" + valueFormat + "`.",0);
                     }
 
-                    stmt.setBinaryStream(parameterIndex, new 
ByteArrayInputStream(bValue), bValue.length);
+                    stmt.setBytes(parameterIndex, bValue);
 
 Review comment:
   Hmm.. what about adding an upstream check to see if PreparedStatement 
instanceof PhoenixPreparedStatement, which can be handled independently? Using 
try/catch as control flow doesn't seem quite right, esp. for something that 
supports operations that need to be very performant (e.g. data ingestion). This 
would give us a place to handle other JDBC drivers that are not totally 
compliant and handle the case where developers wish to support two drivers that 
are incompatible (for example, one that only has .setBytes(...) _and_ one that 
only has .setBinaryStream(...)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to