Support Questions
Find answers, ask questions, and share your expertise

submit hive query via api

submit hive query via api

Explorer

i'm trying to find a good way to submit a hive query and capture the output results with the least amount of lag between steps. i'm maily a windows so as of right now, i would write a query, save it to a text file, scp it into my linux box, then run hive -f "myfile.txt" to execute the query. i'm using basic sql code like so:

 

Select count(*) COUNT
 from ( select 
              `ds`.`keyfield` 
           from `mydb`.`mytable` ds
           where ((ds.`field` ='myvalue1') or (ds.`field` ='myvalue2')
          ) 
group by `ds`.`keyfield`)f;

 

i'm trying to get the COUNT result back to my sql server, where i log it in a table. 

 

i would NOT like to use polybase, and i'd like to keep using hql query language, since thats very simalar to t-sql. 

 

i would image there's a way to write my query, and just post it to my hdp 3 hortonworks cluster, and then get back a jobid, where i can then find the result once completed, but i cant see to find a writeup on it. 

 

Thanks!