<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Checking if a key exists in a Hbase table affects subsequent get call in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/27731#M6072</link>
    <description>&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
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
// --- --- ---
...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm running Cloudera CDH5.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 09:29:55 GMT</pubDate>
    <dc:creator>balac</dc:creator>
    <dc:date>2022-09-16T09:29:55Z</dc:date>
    <item>
      <title>Checking if a key exists in a Hbase table affects subsequent get call</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/27731#M6072</link>
      <description>&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
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
// --- --- ---
...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm running Cloudera CDH5.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:29:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/27731#M6072</guid>
      <dc:creator>balac</dc:creator>
      <dc:date>2022-09-16T09:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if a key exists in a Hbase table affects subsequent get call</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/27980#M6073</link>
      <description>&lt;P&gt;At the moment the Get object is not reusable&amp;nbsp;between exists() and get()&lt;/P&gt;&lt;P&gt;the exists() sets&amp;nbsp;get.setCheckExistenceOnly(true) so when you the next get that flag will be true.&lt;/P&gt;&lt;P&gt;you can manually set it to false before doing the get, by calling&amp;nbsp;get.setCheckExistenceOnly(false)&lt;/P&gt;&lt;P&gt;or you can create a new Get object.&lt;/P&gt;&lt;P&gt;This may change in a future version, for now you should use one of the workaround proposed above.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 16:49:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/27980#M6073</guid>
      <dc:creator>th30z</dc:creator>
      <dc:date>2015-05-27T16:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if a key exists in a Hbase table affects subsequent get call</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/28174#M6074</link>
      <description>Thanks!</description>
      <pubDate>Wed, 03 Jun 2015 19:56:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Checking-if-a-key-exists-in-a-Hbase-table-affects-subsequent/m-p/28174#M6074</guid>
      <dc:creator>balac</dc:creator>
      <dc:date>2015-06-03T19:56:30Z</dc:date>
    </item>
  </channel>
</rss>

