Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

hive rest api : cannot query tables ?

avatar
Super Collaborator

Unable to query hive tables... was able to retrive the schema of tables, couldn't get the data of the table?

16 REPLIES 16

avatar
Contributor

Hello guys,

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

Thank you

avatar
Master 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

avatar
Super Collaborator

@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

avatar
Master Mentor

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

avatar
Super Collaborator

@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

avatar
Explorer

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

anyone able to resolve this ?

avatar
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 !