How to install Hive in Hadoop eco system - for beginners
Автор: how to hadoop
Загружено: 2019-02-11
Просмотров: 158
This is a tutorial to install hive. for beginners.
Hive Class Examples:
=============================================================================
1. Database
2. Tables
3. Internal table, External table
4. Load data from local and HDFS
5. Partitions
6. Joins
7. Buckets
8. Serde
=============================================================================
Create Tables
create database if not exists student;
show databases;
use student;
describe database student;
create table if not exists student ( name string, id int , year int);
show tables;
create table if not exists student ( name string, id int , year int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;
create table if not exists student1 ( name string, id int , year int);
create table if not exists student2 ( name string, id int , year int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;
create external table if not exists student3 ( name string, id int , year int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;
=============================================================================
Load Data
load data local inpath '/home/hadoop/work/hive_inputs/student.txt' overwrite into table student1;
select * from student1;
load data local inpath '/home/hadoop/work/hive_inputs/student.txt' overwrite into table student2;
select * from student2;
load data local inpath '/home/hadoop/work/hive_inputs/student1.txt' into table student2;
Hadoop: Execute: Exit.
hadoop fs -put /home/hadoop/work/hive_inputs/ /home/hadoop/work/hive_inputs/
hadoop fs -put /home/hadoop/work/hive_inputs/student.txt /home/hadoop/work/hive_inputs/student.txt
Hive: use student;
load data inpath '/home/hadoop/work/hive_inputs/student.txt' overwrite into table student2;
Move Operation. Source file will be deleted.
load data inpath '/home/hadoop/work/hive_inputs/student.txt' into table student2;
hadoop fs -put /home/hadoop/work/hive_inputs/student.txt /home/hadoop/work/hive_inputs/student.txt
load data local inpath '/home/hadoop/work/hive_inputs/student.txt' overwrite into table student;
load data local inpath '${env:HOME}/work/hive_inputs/student.txt' overwrite into table student;
=============================================================================
Print Commands
set hive.cli.print.current.db=true;
set hive.cli.print.header=true;
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: