You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "exceptionfactory (via GitHub)" <gi...@apache.org> on 2023/05/31 13:10:02 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #7316: NIFI-11608 Fixing Expression Language Evaluation in dataset and tablename.

exceptionfactory commented on code in PR #7316:
URL: https://github.com/apache/nifi/pull/7316#discussion_r1211688613


##########
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java:
##########
@@ -203,20 +201,24 @@ public void onUnscheduled() {
     public void onTrigger(ProcessContext context, ProcessSession session)  {
         WriteStream writeStream;
         Descriptors.Descriptor protoDescriptor;
+
+        FlowFile flowFile = session.get();
+        if (flowFile == null) {
+            return;
+        }
+
+        final TableName tableName = TableName.of(context.getProperty(PROJECT_ID).getValue(), context.getProperty(DATASET).evaluateAttributeExpressions(flowFile).getValue(), context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue());

Review Comment:
   This variable name is shadowing `tableName` on line 118, so the member variable declaration on that line needs to be removed as well.



##########
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java:
##########
@@ -203,20 +201,24 @@ public void onUnscheduled() {
     public void onTrigger(ProcessContext context, ProcessSession session)  {
         WriteStream writeStream;
         Descriptors.Descriptor protoDescriptor;
+
+        FlowFile flowFile = session.get();
+        if (flowFile == null) {
+            return;
+        }
+
+        final TableName tableName = TableName.of(context.getProperty(PROJECT_ID).getValue(), context.getProperty(DATASET).evaluateAttributeExpressions(flowFile).getValue(), context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue());

Review Comment:
   Recommend breaking this into multiple lines for better readability.
   ```suggestion
           final String projectId = context.getProperty(PROJECT_ID).getValue();
           final String dataset = context.getProperty(DATASET).evaluateAttributeExpressions(flowFile).getValue();
           final String dataTableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue();
           final TableName tableName = TableName.of(projectId, dataset, dataTableName);
   ```



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

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org