Created on 05-20-2015 12:37 PM - edited 09-16-2022 02:29 AM
I'm sure am overlooking something in the snippet below, but I can't figure out what. As indicated, if I include a call to 'exists' to quickly check if the key exists in table, the subsequent 'get' ends up returning nothing; commenting out the 'exists' call, however, makes the code work. But, now I have to do additional checks before parsing the result fetched from Hbase to make sure it is not empty/null.
... final Get g = new Get(someKey); g.setCacheBlocks(true); g.setMaxVersions(1); g.addColumn(colFamily, colName); /* --- THIS DOES NOT WORK --- */ if (this.someHbaseTab.exists(g)) { final Result res = this.someHbaseTab.get(g); // res is empty!!! } // --- --- --- /* --- THIS WORKS --- */ // No call to 'exists' final Result res = this.someHbaseTab.get(g); // Valid result // --- --- --- ...
I'm running Cloudera CDH5.
Created 05-27-2015 09:49 AM
At the moment the Get object is not reusable between exists() and get()
the exists() sets get.setCheckExistenceOnly(true) so when you the next get that flag will be true.
you can manually set it to false before doing the get, by calling get.setCheckExistenceOnly(false)
or you can create a new Get object.
This may change in a future version, for now you should use one of the workaround proposed above.
Created 05-27-2015 09:49 AM
At the moment the Get object is not reusable between exists() and get()
the exists() sets get.setCheckExistenceOnly(true) so when you the next get that flag will be true.
you can manually set it to false before doing the get, by calling get.setCheckExistenceOnly(false)
or you can create a new Get object.
This may change in a future version, for now you should use one of the workaround proposed above.
Created 06-03-2015 12:56 PM