Categories

Apr 24 in Big Data | Hadoop

Q:

How to Achieve?

Step 1: Create a table.

hive>create table table1(id int,firstname string,lastname string) row format delimited fields terminated by ',';

Step 2: Load data into that table.

hive>load data local inpath '/home/arani/Desktop/table1.csv' into table table1; 

Step 3: Now create a bucket table.

 hive>create table bucket_table(id int,firstname string,lastname string) clustered by (id) into 5 buckets row format delimited fields terminated by ',';

Step 4: Insert table created in first step data into the bucket table.

 hive>insert overwrite table bucket_table select * from table1;

Now you can see the bucket table in the UI. Or, you can also see by using this command

hadoopusr$ hdfs dfs -cat /user/hive/warehouse/bucketeddb.db/bucket_table/000000_0 in terminal.

Related questions

Madanswer
May 7 in Big Data | Hadoop
Apr 7 in Big Data | Hadoop
Apr 24 in Big Data | Hadoop
...