<?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 Passing parameters to multiple queries using beeline in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329831#M230521</link>
    <description>&lt;P&gt;Is it possible to send hive variables to multiple hql files/queries and execute them in a single hive session?&lt;/P&gt;&lt;P&gt;when I try something like this, only the first query is picking up the variables and other is returning no result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$beeline -u "{$url}" --hivevar FROM=2020 --hivevar TO=2021 -e "$(cat loadTable1.hql loadTable2.hql)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where both the hqls take these two variables as parameters.&lt;/P&gt;&lt;P&gt;My goal is to run my hqls in parallel in one hive sessions, are there any cons to this approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 03:56:28 GMT</pubDate>
    <dc:creator>Aarth</dc:creator>
    <dc:date>2021-11-09T03:56:28Z</dc:date>
    <item>
      <title>Passing parameters to multiple queries using beeline</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329831#M230521</link>
      <description>&lt;P&gt;Is it possible to send hive variables to multiple hql files/queries and execute them in a single hive session?&lt;/P&gt;&lt;P&gt;when I try something like this, only the first query is picking up the variables and other is returning no result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$beeline -u "{$url}" --hivevar FROM=2020 --hivevar TO=2021 -e "$(cat loadTable1.hql loadTable2.hql)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where both the hqls take these two variables as parameters.&lt;/P&gt;&lt;P&gt;My goal is to run my hqls in parallel in one hive sessions, are there any cons to this approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 03:56:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329831#M230521</guid>
      <dc:creator>Aarth</dc:creator>
      <dc:date>2021-11-09T03:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Passing parameters to multiple queries using beeline</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329847#M230527</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/93401"&gt;@Aarth&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add the hive properties in the HQL file so that it will take it at the session level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;beeline -u "jdbc:hive2://&amp;lt;FQDN:10000&amp;gt;" -f rajkumar.hql&lt;/P&gt;&lt;P&gt;Add all the required properties in the HQL file so it will be applied at the time of executing at a session level.&lt;BR /&gt;set hive.compute.query.using.stats=false;&lt;BR /&gt;set hive.fetch.task.conversion=none ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If you are processing more than one HQL file add the needed properties to it.&lt;/P&gt;&lt;P&gt;If you are happy with the reply, mark it Accept as Solution&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 10:26:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329847#M230527</guid>
      <dc:creator>Shifu</dc:creator>
      <dc:date>2021-11-09T10:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Passing parameters to multiple queries using beeline</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329866#M230530</link>
      <description>&lt;P&gt;Hive parameters are user input so it's not a fixed value that can be defined inside a hql. It must be passed as an argument. Pls advice.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 11:40:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/329866#M230530</guid>
      <dc:creator>Aarth</dc:creator>
      <dc:date>2021-11-09T11:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Passing parameters to multiple queries using beeline</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/334181#M231646</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;beeline -e "query_string". the query string can contain multiple queries. Those queries will be executed sequentially.&lt;BR /&gt;&lt;BR /&gt;In these case once loadTable1.hql completed after that loadTable2.hql will start.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;One Solution -&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Merge both the file as a single file and execute the target HQL by replacing hive variables like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[hive@node~]$ cat loadTable1.hql loadTable2.hql
#HQL file 1
select * from sample1 where rownum between ${hivevar:FROM} and ${hivevar:TO};
#HQL file 2
select * from sample2 where rownum between ${hivevar:FROM} and ${hivevar:TO};
[hive@node~]$ cat loadTable1.hql loadTable2.hql &amp;gt; target.hql
[hive@node ~]$ beeline -u "${jdbc_url}" --hivevar FROM=10 --hivevar TO=30 -f target.hql
0: jdbc:hive2&amp;gt; #HQL file 1
0: jdbc:hive2&amp;gt; select * from sample1 where rownum between ${hivevar:FROM} and ${hivevar:TO};
DEBUG : Acquired the compile lock.
INFO : Compiling command(queryId=hive_20220119094048_055b8d53-a101-453f-902b-3b08b6ffd4d3): select * from sample1 where rownum between 10 and 30
.
.
.
0: jdbc:hive2&amp;gt; #HQL file 2
0: jdbc:hive2&amp;gt; select * from sample2 where rownum between ${hivevar:FROM} and ${hivevar:TO};
DEBUG : Acquired the compile lock.
INFO : Compiling command(queryId=hive_20220119094048_9271ad34-64d1-424b-ad09-f3ca8cf630f9): select * from sample2 where rownum between 10 and 30
.
.
.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 10:01:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Passing-parameters-to-multiple-queries-using-beeline/m-p/334181#M231646</guid>
      <dc:creator>ggangadharan</dc:creator>
      <dc:date>2022-01-19T10:01:36Z</dc:date>
    </item>
  </channel>
</rss>

