Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

hive rest api : cannot query tables ?

Re: hive rest api : cannot query tables ?

Explorer

Hello guys,

This is exaclty what I need, query a Hive Table and show results on screen, is it already implemented?

Thank you

Highlighted

Re: hive rest api : cannot query tables ?

Mentor

@Krishna Srinivas try webhcat

curl -s -d execute="select+*+from+sample_08;" \

-d statusdir="output" \

'http://localhost:50111/templeton/v1/hive?user.name=root'

# if you ls on the directory, it will have two files, stderr and stdout

hdfs dfs -ls output

# if the job succeeded, you can cat the stdout file and view the results

hdfs dfs -cat output/stdout

Highlighted

Re: hive rest api : cannot query tables ?

Expert Contributor

@Neeraj Sabharwal @Artem Ervits Hi , Have tried the same curl -s -d execute="select+*+from+table1;" -d statusdir="status" 'http://<IP add>:50111/templeton/v1/hive?user.name=hive' {"id":"job_1455079614548_0015"} Its showing as ID of job but the status directory is not getting creating in hdfs.

hdfs dfs -ls status ls: `status': No such file or directory

Highlighted

Re: hive rest api : cannot query tables ?

Mentor

Provide full path to sttus dir. "/user/username/status" @Krishna Srinivas

Highlighted

Re: hive rest api : cannot query tables ?

Expert Contributor

@Neeraj Sabharwal @Artem Ervits We have been referring to the URL

https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference but unfortunately its not too clear for executing queries using webhcat

Highlighted

Re: hive rest api : cannot query tables ?

New Contributor

I am also facing same problem, it returns job_id but on cluster these files are not created.

anyone able to resolve this ?

Highlighted

Re: hive rest api : cannot query tables ?

New Contributor

Hello guys,

2019 and i still have the same problem with hive api rest . I can successfully run the request :

hduser@master:~$ curl -s -d execute="select+*+from+mytable;" -d statusdir="/home/output" 'http://localhost:50111/templeton/v1/hive?user.name=HIVEU'

and when i want to display the job results :

hduser@master:~$ hdfs dfs -ls output

hduser@master:~$ ls: `output': No such file or directory


Can anyone please give some hepl !

Don't have an account?
Coming from Hortonworks? Activate your account here