pvillard31 commented on a change in pull request #3610: NIFI-6552 Kudu Put 
Operations
URL: https://github.com/apache/nifi/pull/3610#discussion_r318471276
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-kudu-bundle/nifi-kudu-processors/src/main/java/org/apache/nifi/processors/kudu/PutKudu.java
 ##########
 @@ -290,29 +234,30 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
     }
 
     private void trigger(final ProcessContext context, final ProcessSession 
session, final List<FlowFile> flowFiles) throws ProcessException {
-        final KuduSession kuduSession = getKuduSession(kuduClient);
         final RecordReaderFactory recordReaderFactory = 
context.getProperty(RECORD_READER).asControllerService(RecordReaderFactory.class);
 
+        final KuduClient kuduClient = getKuduClient();
+        kuduSession = getKuduSession(kuduClient);
+
         final Map<FlowFile, Integer> numRecords = new HashMap<>();
         final Map<FlowFile, Object> flowFileFailures = new HashMap<>();
         final Map<Operation, FlowFile> operationFlowFileMap = new HashMap<>();
 
         int numBuffered = 0;
         final List<RowError> pendingRowErrors = new ArrayList<>();
         for (FlowFile flowFile : flowFiles) {
+            operationType = 
OperationType.valueOf(context.getProperty(INSERT_OPERATION).evaluateAttributeExpressions(flowFile).getValue());
+            Boolean ignoreNull = 
Boolean.valueOf(context.getProperty(IGNORE_NULL).evaluateAttributeExpressions(flowFile).getValue());
             try (final InputStream in = session.read(flowFile);
                 final RecordReader recordReader = 
recordReaderFactory.createRecordReader(flowFile, in, getLogger())) {
                 final List<String> fieldNames = 
recordReader.getSchema().getFieldNames();
                 final RecordSet recordSet = recordReader.createRecordSet();
                 final String tableName = 
context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue();
-                final KuduTable kuduTable = kuduClient.openTable(tableName);
+                kuduTable = kuduClient.openTable(tableName);
 
 Review comment:
   Do we really need to have a class-wide variable instead of the local 
``final`` one as before?

----------------------------------------------------------------
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