shawnweeks commented on a change in pull request #3462: NIFI-6243 Add Support 
for AtomicDistributedCache to the HBase 1.x and…
URL: https://github.com/apache/nifi/pull/3462#discussion_r284070069
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-services/nifi-hbase_2-client-service-bundle/nifi-hbase_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_2_ClientService.java
 ##########
 @@ -485,6 +486,22 @@ public boolean checkAndPut(final String tableName, final 
byte[] rowId, final byt
         }
     }
 
+    @Override
+    public boolean checkAndPut(String tableName, byte[] rowId, byte[] family, 
byte[] qualifier, byte[] value, long timestamp, PutColumn column) throws 
IOException {
+        try (final Table table = 
connection.getTable(TableName.valueOf(tableName))) {
+            Put put = new Put(rowId);
+            put.addColumn(
+                    column.getColumnFamily(),
+                    column.getColumnQualifier(),
+                    column.getBuffer());
+            if ( value == null || timestamp == 0L ) {
+                return table.checkAndMutate(rowId, 
family).qualifier(qualifier).ifNotExists().thenPut(put);
+            } else {
+                return table.checkAndMutate(rowId, 
family).qualifier(qualifier).ifEquals(value).timeRange(TimeRange.at(timestamp)).thenPut(put);
 
 Review comment:
   Agreed, I misunderstood what the timestamp was used for there and thought it 
was going to include the timestamp as part of the check.

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