Hive - CSV

> Database > Apache - Hive (HS|Hive Server)

1 - About

CSV / TSV format in Hive.

3 - Read

You can create a external table with:

Advertising

3.1 - Serde

3.2 - Text File

Hive - Text File (TEXTFILE)

Example with the customer table of the TPCDS schema

CREATE external TABLE customer_row
(
    c_customer_sk             BIGINT,
    c_customer_id             string,
    c_current_cdemo_sk        BIGINT,
    c_current_hdemo_sk        BIGINT,
    c_current_addr_sk         BIGINT,
    c_first_shipto_date_sk    BIGINT,
    c_first_sales_date_sk     BIGINT,
    c_salutation              string,
    c_first_name              string,
    c_last_name               string,
    c_preferred_cust_flag     string,
    c_birth_day               INT,
    c_birth_month             INT,
    c_birth_year              INT,
    c_birth_country           string,
    c_login                   string,
    c_email_address           string,
    c_last_review_date        string
)
ROW format delimited FIELDS TERMINATED BY '|' 
STORED AS TEXTFILE
LOCATION 'hdfs://locationToMyDirectory';

STORED AS TEXTFILE is the default and is then optional

db/hive/csv.txt · Last modified: 2019/05/15 17:27 by gerardnico