Hive Flashcards
remember Hive commands and general knowledge
What is the coding format for creating a table?
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).
what is the coding format to make an external table?
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’;
what is the coding format to LOAD a table?
LOAD DATA INPATH ‘ ‘’ ‘ ‘’ OVERWRITE INTO TABLE ‘ ‘’ ‘ ‘’ ;
LOAD DATA INPATH ‘/user/maria_dev/u.data’ OVERWRITE INTO TABLE udata_external_table;
what it he code for the constraints on a table for a json file separated by commas
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’
What is the syntax to create a table, and at the same time populate the code with data from another column
create table {table name} AS SELECT
create table salary_internal as select salary_id,employee_id,payment,datefrom salary;
to find data on a file
describe formatted {table_name}
What is the syntax to alter a partition from a static partition to a dynamic partition
SET hive.exec.dynamic.partition=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
How (i.e. what is the syntax) and where do you format a compression file.
When you create your table:
create table employee_par
(salary_id TINYINT, employee_id TINYINT, payment FLOAT, the_date STRING)
stored as parquetfile;
What are the different compatible formats within Hadoop
- ORC
- AVRO
- JSON
- Parquet
- Sequence
- txt files (i.e. CSV)