Hive Flashcards

remember Hive commands and general knowledge

1
Q

What is the coding format for creating a table?

A

Create table table_name (id int, name STRING, ssn BIGINT)

ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘ ‘ LINES BY ‘\n’

Same way you create on in SQL: “create name” followed by the column (aka fields names of the table) separated via comma).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the coding format to make an external table?

A

CREATE EXTERNAL TABLE /table name e.g./ ugenre_external_table (
genre INT, # the datatype name
genreID TINYINT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘|’ LINES TERMINATED BY ‘\n’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the coding format to LOAD a table?

A

LOAD DATA INPATH ‘ ‘’ ‘ ‘’ OVERWRITE INTO TABLE ‘ ‘’ ‘ ‘’ ;

LOAD DATA INPATH ‘/user/maria_dev/u.data’ OVERWRITE INTO TABLE udata_external_table;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what it he code for the constraints on a table for a json file separated by commas

A

ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the syntax to create a table, and at the same time populate the code with data from another column

A

create table {table name} AS SELECT

create table salary_internal as select salary_id,employee_id,payment,datefrom salary;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

to find data on a file

A

describe formatted {table_name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the syntax to alter a partition from a static partition to a dynamic partition

A

SET hive.exec.dynamic.partition=true;

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How (i.e. what is the syntax) and where do you format a compression file.

A

When you create your table:

create table employee_par
(salary_id TINYINT, employee_id TINYINT, payment FLOAT, the_date STRING)
stored as parquetfile;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the different compatible formats within Hadoop

A
  • ORC
  • AVRO
  • JSON
  • Parquet
  • Sequence
  • txt files (i.e. CSV)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly