woutifier-t commented on a change in pull request #3977: NIFI-7007 Add update 
functionality to the PutCassandraRecord processor.
URL: https://github.com/apache/nifi/pull/3977#discussion_r369052930
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraRecord.java
 ##########
 @@ -67,6 +113,36 @@
             .required(true)
             .build();
 
+    static final PropertyDescriptor STATEMENT_TYPE = new 
PropertyDescriptor.Builder()
+            .name("put-cassandra-record-statement-type")
+            .displayName("Statement Type")
+            .description("Specifies the type of CQL Statement to generate.")
+            .required(true)
+            .defaultValue(INSERT_TYPE.getValue())
+            .allowableValues(UPDATE_TYPE, INSERT_TYPE, 
STATEMENT_TYPE_USE_ATTR_TYPE)
+            .build();
+
+    static final PropertyDescriptor UPDATE_METHOD = new 
PropertyDescriptor.Builder()
+            .name("put-cassandra-record-update-method")
+            .displayName("Update Method")
+            .description("Specifies the method to use to SET the values. This 
property is used if the Statement Type is " +
+                    "UPDATE and ignored otherwise.")
+            .required(false)
+            .defaultValue(SET_TYPE.getValue())
+            .allowableValues(INCR_TYPE, DECR_TYPE, SET_TYPE, 
UPDATE_METHOD_USE_ATTR_TYPE)
+            .build();
+
+    static final PropertyDescriptor UPDATE_KEYS = new 
PropertyDescriptor.Builder()
+            .name("put-cassandra-record-update-keys")
+            .displayName("Update Keys")
+            .description("A comma-separated list of column names that uniquely 
identifies a row in the database for UPDATE statements. "
+                    + "If the Statement Type is UPDATE and this property is 
not set, the conversion to CQL will fail. "
+                    + "This property is ignored if the Statement Type is not 
UPDATE.")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 
 Review comment:
   Interesting, trying to run some test cases against this validator and it 
exhibits some (for me) unexpected behavior.
   
   * Passing an empty string to it fails validation (expected)
   * Passing just a separator (,) validates (unexpected), regardless if 
excludeEmptyEntries is set to true or false
   I don't see much in the way of documentation of that validator, but wouldn't 
it be logical for "," to fail validation? Debugging shows that Java's split 
method only works that way if we use the overloaded version `",".split(",", -1)`

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