0% found this document useful (0 votes)
11 views3 pages

Practice Questions

Uploaded by

preetisahura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Practice Questions

Uploaded by

preetisahura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Practice Questions:

******************************************************************************
Important Hdfs command
***********************************************************************************

1 calculate check sum :- Hadoop fs -checksum /user/a1.txt

2 Health check of file : hdfs fsck /

3 status of dataNode : hdfs dfsadmin -report

4 replication factor of system.log : Hadoop fs -stat %r /data/logs/system.log

5 check owner : Hadoop fs -ls /data/logs/system.log

6 Hadoop fs -stat %b /data/logs/system.log

7 first n line : Hadoop fs -cat /user/a.txt | head -n 10

8 last n line : Hadoop fs -cat /user/a.txt | tail -n 10

9 change grup ownership : Hadoop fs -chgrp admin /data/a.txt

10 appending data : Hadoop fs -appendToFile /local/logs/newdata.log


/user/logs/complete.log

11 list the file or directory : Hadoop fs -ls /

12 make directory : Hadoop fs -mkdir /admin

13 upload file from local to hdfs : Hadoop fs (-put or -copyFromLocal) (path of


local) (path of hdfs)

14 upload file from hdfs to local : Hadoop fs -get (path of hdfs) (path of local)

14 remove file or directory : Hadoop fs -rm /user/a.txt

******************************************************************************
Important Hive command
***********************************************************************************

1 check available database : show databases;

2 create Database : create databse nameofdb;

3 Use Database : use nameofDB;

4 create table : create table tablename(id int, name string, salary int)
row format delimited
fields terminated by ',';

5 Load data : load data local inpath (path of file) into table tablename;
or
insert into tablename(id,name,salary) values (1,name1,100000) , (1,name1,100000),
(1,name1,100000);

6 Array Datatype : create table temperature(sno int,place string,mytemp


array<double>)
> row format delimited
> fields terminated by '\t'
> collection items terminated by ',';

7 map Datatype :
create table tab(city string, gender string, collection map<int,int>)
> row format delimited
> fields terminated by '\t'
> collection items terminated by ','
> map keys terminated by ':';

8 structure datatype : create table struct(name string, city string, info


struct<place:string,temp:float>)
> row format delimited
> fields terminated by '\t'
> collection items terminated by ',';

9 Partitioning : first create table then apply on it


create table part(city string,pin bigint)
partitioned by(state string);

set hive.exec.dynamic.partition.mode=nonstrict;

insert overwrite table part partition(state)

select city,pin,state from states;

10 Bucketting : first create table then apply on it

set hive.enforce.bucketing=true;

create table buc1(id int,name string,sal float)


>clustered by(id) into 3 buckets
>row format delimited
>fields terminated by ',';

insert overwrite table buc1 select * from buctab;0.

******************************************************************************
Important Hbase command
***********************************************************************************

1 create tabele in hbase : create 'tableName', 'Colfam1','colfam2'

2 insert data : put 'tablename', 'mask', 'colfam1:newcolum', 'value'

3 show all data : scan 'tablename'

4 view individual colfam data : get 'tablename' ,'mask' ,{COLUMN =>


'colfam!:newcolum'

5 delete all cell : deleteall 'tablename' , 'mask'

6 delete specific colfam : delete 'tablename', 'mask' , 'colfam1:newcolum'

7 Count No Rows : count 'tablename'


8 List tables : list

9 Alter or version control : alter ‘test_table’, {NAME => ‘colfam1’, VERSIONS => 2}

10 Descripe the table : describe table;

You might also like