hive Fetch Task-----筆記

vim tmp.txt
MITH    CLERK   7902    1980-12-17      800.0   NULL    20
7499    ALLEN   SALESMAN        7698    1981-2-20       1600.0  300.0   30
7521    WARD    SALESMAN        7698    1981-2-22       1250.0  500.0   30
7499    ALLEN   SALESMAN        7698    1981-2-20       1600.0  300.0   30
7521    WARD    SALESMAN        7698    1981-2-22       1250.0  500.0   30
7499    ALLEN   SALESMAN        7698    1981-2-20       1600.0  300.0   30
7521    WARD    SALESMAN        7698    1981-2-22       1250.0  500.0   30
7499    ALLEN   SALESMAN        7698    1981-2-20       1600.0  300.0   30
7521    WARD    SALESMAN        7698    1981-2-22       1250.0  500.0   30
7499    ALLEN   SALESMAN        7698    1981-2-20       1600.0  300.0   30
7521    WARD    SALESMAN        7698    1981-2-22       1250.0  500.0   30

hive> show tables;
OK
mysql1
myuser
stu2
student
user
Time taken: 0.057 seconds, Fetched: 5 row(s)
hive> show databases;
OK
default
my_user
testbd
testdb
Time taken: 0.022 seconds, Fetched: 4 row(s)
hive> use default;
OK
Time taken: 0.034 seconds
hive> create table tmp(
    > empno int,
    > ename string,
    > job string,
    > mgr int,
    > hiredate string,
    > sal double,
    > comm double,
    > deptno int
    > )
    > ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
OK
Time taken: 2.326 seconds
hive> show tables;
OK
mysql1
myuser
stu2
student
tmp
user
Time taken: 0.174 seconds, Fetched: 6 row(s)
hive> load data local inpath '/tmp/tmp.txt' overwrite into table tmp;
Loading data to table default.tmp
Table default.tmp stats: [numFiles=1, numRows=0, totalSize=546, rawDataSize=0]
OK
Time taken: 0.235 seconds
hive> select * from tmp;
OK
NULL	CLERK	7902	NULL	800.0	NULL	20.0	NULL
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
Time taken: 0.059 seconds, Fetched: 11 row(s)
[root@hadoop01 conf]# hive -e ' select * from tmp';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
NULL	CLERK	7902	NULL	800.0	NULL	20.0	NULL
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
Time taken: 1.291 seconds, Fetched: 11 row(s)
[root@hadoop01 conf]# hive -e ' select empno,ename,job from tmp';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
NULL	CLERK	7902
7499	ALLEN	SALESMAN
7521	WARD	SALESMAN
7499	ALLEN	SALESMAN
7521	WARD	SALESMAN
7499	ALLEN	SALESMAN
7521	WARD	SALESMAN
7499	ALLEN	SALESMAN
7521	WARD	SALESMAN
7499	ALLEN	SALESMAN
7521	WARD	SALESMAN
Time taken: 1.188 seconds, Fetched: 11 row(s)
[root@hadoop01 conf]# hive -e ' select empno,ename,job,sal*12 from tmp';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
NULL	CLERK	7902	NULL
7499	ALLEN	SALESMAN	19200.0
7521	WARD	SALESMAN	15000.0
7499	ALLEN	SALESMAN	19200.0
7521	WARD	SALESMAN	15000.0
7499	ALLEN	SALESMAN	19200.0
7521	WARD	SALESMAN	15000.0
7499	ALLEN	SALESMAN	19200.0
7521	WARD	SALESMAN	15000.0
7499	ALLEN	SALESMAN	19200.0
7521	WARD	SALESMAN	15000.0
Time taken: 1.659 seconds, Fetched: 11 row(s)
[root@hadoop01 conf]# hive -e ' select empno,ename,job,sal*12,comm,sal*12+nvl(comm,0) from tmp';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
NULL	CLERK	7902	NULL	20.0	NULL
7499	ALLEN	SALESMAN	19200.0	300.0	19500.0
7521	WARD	SALESMAN	15000.0	500.0	15500.0
7499	ALLEN	SALESMAN	19200.0	300.0	19500.0
7521	WARD	SALESMAN	15000.0	500.0	15500.0
7499	ALLEN	SALESMAN	19200.0	300.0	19500.0
7521	WARD	SALESMAN	15000.0	500.0	15500.0
7499	ALLEN	SALESMAN	19200.0	300.0	19500.0
7521	WARD	SALESMAN	15000.0	500.0	15500.0
7499	ALLEN	SALESMAN	19200.0	300.0	19500.0
7521	WARD	SALESMAN	15000.0	500.0	15500.0
[root@hadoop01 conf]# hive -e ' select * from tmp limit 3';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
NULL	CLERK	7902	NULL	800.0	NULL	20.0	NULL
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
Time taken: 1.258 seconds, Fetched: 3 row(s)
[root@hadoop01 conf]# hive -e ' select ename,sal+200 from tmp limit 3';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
CLERK	NULL
ALLEN	1800.0
WARD	1450.0
Time taken: 2.433 seconds, Fetched: 3 row(s)
[root@hadoop01 conf]# hive -e ' select ename,sal from tmp where sal>1000';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
OK
ALLEN	1600.0
WARD	1250.0
ALLEN	1600.0
WARD	1250.0
ALLEN	1600.0
WARD	1250.0
ALLEN	1600.0
WARD	1250.0
ALLEN	1600.0
WARD	1250.0
Time taken: 1.637 seconds, Fetched: 10 row(s)
[root@hadoop01 conf]# hive -e ' select distinct * from tmp';

Logging initialized using configuration in jar:file:/opt/app/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
Query ID = root_20200528173147_453864a6-1813-4ad3-a235-2a5cc1aaf250
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 1
In order to change the average load for a reducer (in bytes):
  set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
  set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
  set mapreduce.job.reduces=<number>
Starting Job = job_1590654785821_0001, Tracking URL = http://hadoop01:8088/proxy/application_1590654785821_0001/
Kill Command = /opt/app/hadoop/bin/hadoop job  -kill job_1590654785821_0001
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2020-05-28 17:32:38,532 Stage-1 map = 0%,  reduce = 0%
2020-05-28 17:33:12,495 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.67 sec
2020-05-28 17:33:24,055 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 3.18 sec
MapReduce Total cumulative CPU time: 3 seconds 180 msec
Ended Job = job_1590654785821_0001
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 3.18 sec   HDFS Read: 10310 HDFS Write: 135 SUCCESS
Total MapReduce CPU Time Spent: 3 seconds 180 msec
OK
NULL	CLERK	7902	NULL	800.0	NULL	20.0	NULL
7499	ALLEN	SALESMAN	7698	1981-2-20	1600.0	300.0	30
7521	WARD	SALESMAN	7698	1981-2-22	1250.0	500.0	30
Time taken: 97.538 seconds, Fetched: 3 row(s)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章