FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix NPE in tests by handling properly null Result[] and adapting the increment response. by mgarolera · Pull Request #71 · googleapis/java-bigtable-hbase · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public AnvilTopTable(TableName tableName,
putAdapter,
deleteAdapter,
rowMutationsAdapter,
incrementAdapter);
incrementAdapter,
incrRespAdapter);

}

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.cloud.anviltop.hbase.adapters.GetAdapter;
import com.google.cloud.anviltop.hbase.adapters.GetRowResponseAdapter;
import com.google.cloud.anviltop.hbase.adapters.IncrementAdapter;
import com.google.cloud.anviltop.hbase.adapters.IncrementRowResponseAdapter;
import com.google.cloud.anviltop.hbase.adapters.OperationAdapter;
import com.google.cloud.anviltop.hbase.adapters.PutAdapter;
import com.google.cloud.anviltop.hbase.adapters.RowMutationsAdapter;
Expand Down Expand Up @@ -125,6 +126,7 @@ public void onFailure(Throwable throwable) {
protected final DeleteAdapter deleteAdapter;
protected final RowMutationsAdapter rowMutationsAdapter;
protected final IncrementAdapter incrementAdapter;
protected final IncrementRowResponseAdapter incrRespAdapter;
protected final OperationAdapter<Append, ?> appendAdapter;

public BatchExecutor(
Expand All @@ -137,7 +139,8 @@ public BatchExecutor(
PutAdapter putAdapter,
DeleteAdapter deleteAdapter,
RowMutationsAdapter rowMutationsAdapter,
IncrementAdapter incrementAdapter) {
IncrementAdapter incrementAdapter,
IncrementRowResponseAdapter incrRespAdapter) {
this.client = client;
this.options = options;
this.tableName = tableName;
Expand All @@ -148,6 +151,7 @@ public BatchExecutor(
this.deleteAdapter = deleteAdapter;
this.rowMutationsAdapter = rowMutationsAdapter;
this.incrementAdapter = incrementAdapter;
this.incrRespAdapter = incrRespAdapter;
this.appendAdapter = new UnsupportedOperationAdapter<>("append");
}

Expand Down Expand Up @@ -350,7 +354,7 @@ Object adaptResponse(AnviltopServices.GetRowResponse response) {
row, callback, index, results, resultFuture) {
@Override
Object adaptResponse(AnviltopServices.IncrementRowResponse response) {
return new Result();
return incrRespAdapter.adaptResponse(response);
}
},
service);
Expand Down Expand Up @@ -390,8 +394,11 @@ Object adaptResponse(AnviltopServices.MutateRowResponse response) {
/**
* Implementation of {@link org.apache.hadoop.hbase.client.HTable#batch(List, Object[])}
*/
public void batch(List<? extends Row> actions, Object[] results)
public void batch(List<? extends Row> actions, @Nullable Object[] results)
throws IOException, InterruptedException {
if (results == null) {
results = new Object[actions.size()];
}
Preconditions.checkArgument(results.length == actions.size(),
"Result array must have same dimensions as actions list.");
int index = 0;
Expand Down

Back | FazBrowse Home | New Git URL