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.

how to use select query or DML queries in WebHCat ?

Highlighted

how to use select query or DML queries in WebHCat ?

Hi,

Can we use select query in webhcat ?

When I was trying DDL like show database/show tables using webhcat,i can get the output in json format

but when i use select query ,am getting error with exit code-64..Here is my query:

"curl -s -d user.name=root -d 'exec=select * from tweets_clean;' 'http://localhost:50111/templeton/v1/ddl' "

Can anyone pls suggest any idea how to use so because I need to fetch hive table data and visualize that in my web application

Thanks in advance

7 REPLIES 7
Highlighted

Re: how to use select query or DML queries in WebHCat ?

Mentor

@priya dharshini

# this will execute a hive query and save result to hdfs file in your home directory called output

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: how to use select query or DML queries in WebHCat ?

New Contributor

@Artem Ervits

The command

curl -s -d execute="show + databases" -d statusdir="output" 'localhost:50111/templeton/v1/hive?user.name=root'

exits with Hive JOB ID but the commands

hdfs dfs -cat output/stdout

hdfs dfs -cat output/stderr

don't contain any results for any of the command I tried to execute. Am I doing anything wrong. Please advise

Re: how to use select query or DML queries in WebHCat ?

Thanks Artem Ervits,

But I have empty result in sysout.

In my syserr file i have an exception like 'ClassNotFoundException Class org.apache.hive.hcatalog.data.JsonSerDe not found". So do i want to add any SerDe for that ?

Highlighted

Re: how to use select query or DML queries in WebHCat ?

Mentor

@priya dharshini what version if HDP is it? Can you run same query in beeline or Amari Hive View to confirm it works? If it doesn't you may need to open support ticket to get serde resolved.

Highlighted

Re: how to use select query or DML queries in WebHCat ?

Am using HDP 2.2 .

I have used the same query in beeline and besswax(hive Interface), i can get the output

Highlighted

Re: how to use select query or DML queries in WebHCat ?

Mentor

@priya dharshini can you confirm hcat client is installed? Show me the schema for your table?

CREATE EXTERNAL TABLE tweets (
createddate string,
geolocation string,
tweetmessage string,
`user` struct<geoenabled:boolean, id:int, name:string, screenname:string, userlocation:string>)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION '/user/root/';
Highlighted

Re: how to use select query or DML queries in WebHCat ?

Mentor

@priya dharshini can you accept the best answer to close this thread or provide your own solution?

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