Hadoop Query Not executing

Hello Community,

I have created my first hql code, see below and I can't get any data to appear.. I have recently installed Sandbox. The installation comes with a few sample databases. I'm using the database called sample_07 to guide me with my own .hql code.

My hql code is as follows:

CREATE EXTERNAL TABLE mysample
(
 code STRING,
 description STRING,
 total_emp INT,
 salary INT
)
ROW FORMAT DELIMITED
 FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/root/music'
TBLPROPERTIES ("skip.header.line.count" = "1");

Open in new window


However, when I run the code using Zeppellin Notebook with the following code, I can see the tables, but no data appears

%jdbc(hive)
select * from mysample limit 14

Open in new window


However, when I run the same code, with using the sample database called sample_07 both the tables and data appear.

csharp

I'm sure there is something very simple that I'm missing.

Can someone please let me know where I'm going wrong?
LVL 1
Member_2_7966113Asked:
Who is Participating?
 
Amitkumar PConnect With a Mentor Sr. ConsultantCommented:
Hi,

You have created an external table "mysample" where the file location is "/root/music". Please check the following:

1. You have data file (.txt) available in that directory. If not, make data file (as per the table definition) available.

OR

2. insert data from the sample_07 and give it a try.

INSERT OVERWRITE TABLE mysample SELECT * FROM sample_07;

Hope it helps.
0
 
Member_2_7966113Author Commented:
Hi Amit,

That solution worked fine.

Thanks
0
 
Member_2_7966113Author Commented:
Thanks Amit
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.