Hive:
------
use <db name>
show databases;
show tables;
describe formatted | extended table;
create database <db name>
drop database <db name> (cascade)
hive -e 'select * from hive_demo.salary_orc limit 5'
hive -S -e 'select * from hive_demo.salary_orc limit 5'
hive -S -e 'select * from hive_demo.salary_orc limit 5' -hiveconf hive.root.logger=DEBUG,console
hive -i initialize.sql
hive -f script.sql
source file_name
dfs -ls /user
!ls
set mapred.reduce.tasks = 32
set hive.TAB
set
reset
add jar jar_path
list jars
delete jar jar_name
/user/hue/hdfs-course/awe.csv
Hive:
show databases;
use sara;
show tables;
drop table txnrecords;
!ls -l
dfs -ls /user/hue/hdfs-course/awe.csv
dfs -cat /user/hue/hdfs-course/awe.csv
Build the table
Write HiveQL query
CREATE DATABASE stock_values;
CREATE DATABASE stock_values;
CREATE TABLE apple (date STRING, open INT, high INT, low INT, close INT, adj_close DECIMAL, volume INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' lines terminated by '\n' tblproperties('skip.header.line.count'='1');
DESCRIBE FORMATTED apple;
LOAD DATA INPATH '/user/hue/hdfs-course/awe.csv' OVERWRITE INTO TABLE apple;
select date,high from apple where high < "20";
create external table employee
(
id string,
fname string,
lname string,
department_id string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/user/sample_data/employee'
LOAD DATA INPATH '/user/sample_data/employee.csv' OVERWRITE INTO TABLE employee;
select * from employee;
select * from employee limit 2;
create external table department ( id string,dept_name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/user/sample_data/department';
CREATE EXTERNAL TABLE salary (salary_id string, employee_id string, payment double, date string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/user/sample_data/salary';
displayt the current db in prompt:
set hive.cli.print.current.db = true;
Subscribe to:
Post Comments (Atom)
Flume - Simple Demo
// create a folder in hdfs : $ hdfs dfs -mkdir /user/flumeExa // Create a shell script which generates : Hadoop in real world <n>...
-
How to fetch Spark Application Id programmaticall while running the Spark Job? scala> spark.sparkContext.applicationId res124: String = l...
-
input data: ---------- customerID, itemID, amount 44,8602,37.19 35,5368,65.89 2,3391,40.64 47,6694,14.98 29,680,13.08 91,8900,24.59 ...
-
pattern matching is similar to switch statements in C#, Java no fall-through - at least one condition matched no breaks object PatternExa { ...
No comments:
Post a Comment