<?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 Re: Impala query to scan two records in different partitions in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-query-to-scan-two-records-in-different-partitions/m-p/59196#M67197</link>
    <description>&lt;P&gt;I'm afraid Impala is not yet able to recognize that only two partitions need to be scanned. We're aware of the gap and that specific optimization is tracked by:&lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/IMPALA-2108" target="_blank"&gt;https://issues.apache.org/jira/browse/IMPALA-2108&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For now, you can manually rewrite your query as suggested in the JIRA as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;((id='1a' and yyyymmdd=20170815 and group_id=1) OR&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(id='2b' and yyyymmdd=20170811 and group_id=2))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;((yyyymmdd=20170811 and group_id=2) OR&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(yyyymmdd=20170815 and group_id=1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or alternatively, use a union:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;BR /&gt;id='1a' and yyyymmdd=20170815 and group_id=1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;union all&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;id='2b' and yyyymmdd=20170811 and group_id=2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2017 23:01:50 GMT</pubDate>
    <dc:creator>alex.behm</dc:creator>
    <dc:date>2017-08-24T23:01:50Z</dc:date>
    <item>
      <title>Impala query to scan two records in different partitions</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-query-to-scan-two-records-in-different-partitions/m-p/59195#M67196</link>
      <description>&lt;P&gt;I have a table with two columns test, id and yyyymmdd and group_id are my partition columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run following query it runs fast as it only scans 1 partition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;BR /&gt;(id='1a' and yyyymmdd=20170815 and group_id=1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I tried to run following . It scans entire table. Even explain shows that it is going to perform full table scan. I think I'm missing somethign simple here. Appreciate community's help to find out what I'm missing here ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;BR /&gt;(id='1a' and yyyymmdd=20170815 and group_id=1) OR&lt;BR /&gt;(id='2b' and yyyymmdd=20170811 and group_id=2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to scan two rows in two different partitions ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:08:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-query-to-scan-two-records-in-different-partitions/m-p/59195#M67196</guid>
      <dc:creator>sunilosunil</dc:creator>
      <dc:date>2022-09-16T12:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Impala query to scan two records in different partitions</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-query-to-scan-two-records-in-different-partitions/m-p/59196#M67197</link>
      <description>&lt;P&gt;I'm afraid Impala is not yet able to recognize that only two partitions need to be scanned. We're aware of the gap and that specific optimization is tracked by:&lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/IMPALA-2108" target="_blank"&gt;https://issues.apache.org/jira/browse/IMPALA-2108&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For now, you can manually rewrite your query as suggested in the JIRA as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;((id='1a' and yyyymmdd=20170815 and group_id=1) OR&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(id='2b' and yyyymmdd=20170811 and group_id=2))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;((yyyymmdd=20170811 and group_id=2) OR&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(yyyymmdd=20170815 and group_id=1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or alternatively, use a union:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;BR /&gt;id='1a' and yyyymmdd=20170815 and group_id=1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;union all&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select id, yyyymmdd, group_id, test from dwh.table where&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;id='2b' and yyyymmdd=20170811 and group_id=2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 23:01:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-query-to-scan-two-records-in-different-partitions/m-p/59196#M67197</guid>
      <dc:creator>alex.behm</dc:creator>
      <dc:date>2017-08-24T23:01:50Z</dc:date>
    </item>
  </channel>
</rss>

