Support Questions

Find answers, ask questions, and share your expertise

Used Sqoop to import Mysql table (Employees) onto HDP. Now, I would like to create a Hive ORC Employees Table based on it with the as is schema and data on HDP. How can I do it?

avatar
Expert Contributor

My first step was to create an ORC table on Hive with the same schema as the one imported on hdp :

CREATE TABLE IF NOT EXISTS orcemployees( emp_no int, birth_date date,
 first_name string, last_name string, gender string, hire_date date) 
STORED AS ORC;

My second step was to copy the data from employees into orcemployees:

insert into table orcemployees select * from employees;

The problem is when I execute select * from orcemployees; the schema is displayed and not the associated data.

1 ACCEPTED SOLUTION

avatar
Master Mentor
@keerthana gajarajakumar

your error says you don't have permissions for admin user on that folder. You need to

sudo -u hdfs hdfs dfs -chown -R admin:hdfs /tmp/task/employees

OR

sudo -u hdfs hdfs dfs -chmod -R 777 /tmp/task/employees

View solution in original post

23 REPLIES 23

avatar
Expert Contributor

@Artem Ervits -- How can I set primary key and reference foreign keys while creating a table / extrenal table in hive?

I'm getting the following error:

external-table-error.png

avatar
Master Mentor

@keerthana gajarajakumar please open a new thread as this is a new question.

avatar
Expert Contributor

ok @Artem Ervits -- i just posted a question for this.

avatar

This tutorial walks you through the process of creating Hive ORC table from existing Hive table using Ambari Hive User View:

http://hortonworks.com/hadoop-tutorial/hello-world-an-introduction-to-hadoop-hcatalog-hive-and-pig/#...