Yang, Tong 6182f91ba8 MRS component operation guide_normal 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2022-12-09 14:55:21 +00:00

24 lines
3.5 KiB
HTML

<a name="mrs_01_1647"></a><a name="mrs_01_1647"></a>
<h1 class="topictitle1">Why Modified and Deleted Data Can Still Be Queried by Using the Scan Command?</h1>
<div id="body1596003894352"><div class="section" id="mrs_01_1647__s32b1b6ea012e4225a89000a5edc6d9bd"><h4 class="sectiontitle">Question</h4><p id="mrs_01_1647__a0289ddd875c24a22934d4c970d99416a">Why modified and deleted data can still be queried by using the <strong id="mrs_01_1647__a6125145124994f9ebeabcbfae523d2c5">scan</strong> command?</p>
<pre class="screen" id="mrs_01_1647__s4affcbe10f284441909e3283cbf116e8">scan '&lt;table_name&gt;',{FILTER=&gt;"SingleColumnValueFilter('&lt;column_family&gt;','column',=,'binary:&lt;value&gt;')"}</pre>
</div>
<div class="section" id="mrs_01_1647__s04c04b5ab02e441788493e3419098ebc"><h4 class="sectiontitle">Answer</h4><p id="mrs_01_1647__a25cd8aedcd3f4783a5865d0427fec7c0">Because of the scalability of HBase, all values specific to the versions in the queried column are all matched by default, even if the values have been modified or deleted. For a row where column matching has failed (that is, the column does not exist in the row), the HBase also queries the row.</p>
<p id="mrs_01_1647__af473e3b257d945bf977ca84b2f5817be">If you want to query only the new values and rows where column matching is successful, you can use the following statement:</p>
<pre class="screen" id="mrs_01_1647__sa41da4c36b574eb9b6bf25e2c285ab55">scan '&lt;table_name&gt;',{FILTER=&gt;"SingleColumnValueFilter('&lt;column_family&gt;','column',=,'binary:&lt;value&gt;',true,true)"}</pre>
<p id="mrs_01_1647__ae58c73a4bf1d48c7b453a14839afddf1">This command can filter all rows where column query has failed. It queries only the latest values of the current data in the table; that is, it does not query the values before modification or the deleted values.</p>
<div class="note" id="mrs_01_1647__neb46a83bf78a407899230a7f31c221bd"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_1647__a4f88187008b144fb820dc3c631a10dc9">The related parameters of <strong id="mrs_01_1647__aad9f9e3883254cf8aa74df3f3900c81e">SingleColumnValueFilter</strong> are described as follows:</p>
<p id="mrs_01_1647__a78ee2e07fd8b4c8aaf266d308ab16e7e">SingleColumnValueFilter(final byte[] family, final byte[] qualifier, final CompareOp compareOp, ByteArrayComparable comparator, final boolean filterIfMissing, final boolean latestVersionOnly)</p>
<div class="p" id="mrs_01_1647__ae05724ef451f485fb19a3c3477dbf69e">Parameter description:<ul id="mrs_01_1647__udc7d3d1deb9d48c2bb6dc9351db703cb"><li id="mrs_01_1647__le61d8920bc3d449e9113c1ae7ee4bf55">family: family of the column to be queried.</li><li id="mrs_01_1647__l6973080d9fc54483a4b56007789e6948">qualifier: column to be queried.</li><li id="mrs_01_1647__l76cdad2d92114f868106c1ec09a1e30e">compareOp: comparison operation, such as = and &gt;.</li><li id="mrs_01_1647__l7f30681f896041dc922ad30a630ee989">comparator: target value to be queried.</li><li id="mrs_01_1647__l87a2715a82c54010845ba6b1261f9eaf">filterIfMissing: whether a row is filtered out if the queried column does not exist. The default value is false.</li><li id="mrs_01_1647__l8f49a06dc5a14b98a76c256f0a43efd9">latestVersionOnly: whether values of the latest version are queried. The default value is false.</li></ul>
</div>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1638.html">Common Issues About HBase</a></div>
</div>
</div>