Impala (1) 기본 명령 및 조작

--  impala    a, Hive     ,Hive        
create table a(id int ,name string);
--  Hive    b, impala     ,impala         
create table b(id int ,name string);
--          
invalidate metadata;

-- 1.  Hive impala    a     ,      
-- 2.vi /etc/passwd      hdfs    hdfs:x:996:993:Hadoop HDFS:/var/lib/hadoop-hdfs:/sbin/nologin   hdfs:x:996:993:Hadoop HDFS:/var/lib/hadoop-hdfs:/bin/bash
-- 3.     su hdfs     hdfs dfs -chmod -R 777 /     
-- 4. Hive    set mapreduce.framework.name=local;         
-- 5. Hive      , impala     ,    a , refresh a; 

--      
impala-shell -i localhost
--      
impala-shell --quiet  

--     
-- 
impala-shell -q 'select * from a'
-- 
impala-shell -q 'select * from a' -o a.txt
-- -b       -o        --output_delimiter=','    
impala-shell -q 'select * from a' -B --output_delimiter=',' -o a.txt
-- shell    impala  shell  
shell hdfs dfs -ls /;

explain select * from a;
+------------------------------------------------------------------------------------+
| Explain String                                                                     |
+------------------------------------------------------------------------------------+
| Max Per-Host Resource Reservation: Memory=8.00KB Threads=3                         |
| Per-Host Resource Estimates: Memory=64MB                                           |
| WARNING: The following tables are missing relevant table and/or column statistics. |
| default.a                                                                          |
|                                                                                    |
| PLAN-ROOT SINK                                                                     |
| |                                                                                  |
| 01:EXCHANGE [UNPARTITIONED]                                                        |
| |                                                                                  |
| 00:SCAN HDFS [default.a]                                                           |
|    partitions=1/1 files=6 size=34B                                                 |
|    row-size=15B cardinality=unavailable                                            |
+------------------------------------------------------------------------------------+
[cdh01:21000] default> explain select count(1) from a;
+------------------------------------------------------------------------------------+
| Explain String                                                                     |
+------------------------------------------------------------------------------------+
| Max Per-Host Resource Reservation: Memory=8.00KB Threads=3                         |
| Per-Host Resource Estimates: Memory=84MB                                           |
| WARNING: The following tables are missing relevant table and/or column statistics. |
| default.a                                                                          |
|                                                                                    |
| PLAN-ROOT SINK                                                                     |
| |                                                                                  |
| 03:AGGREGATE [FINALIZE]                                                            |
| |  output: count:merge(*)                                                          |
| |  row-size=8B cardinality=1                                                       |
| |                                                                                  |
| 02:EXCHANGE [UNPARTITIONED]                                                        |
| |                                                                                  |
| 01:AGGREGATE                                                                       |
| |  output: count(*)                                                                |
| |  row-size=8B cardinality=1                                                       |
| |                                                                                  |
| 00:SCAN HDFS [default.a]                                                           |
|    partitions=1/1 files=6 size=34B                                                 |
|    row-size=0B cardinality=unavailable                                             |
+------------------------------------------------------------------------------------+

--        
select current_database();
--           
show tables in default;
--     
show tables in default like 't*';
--      
desc tb_name
--          
desc formatted tb_name;

















좋은 웹페이지 즐겨찾기