Hive - CSV

Card Puncher Data Processing

About

CSV / TSV format in Hive.

Read

You can create a external table with:

Serde

See Hive - Open Csv Serde

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





Discover More
Tpcds Customer Data
Hive - Open Csv Serde

The Csv Serde is a serde that is applied above a text file. It's one way of reading a CSV / TSV format. The CSVSerde is available in Hive 0.14 and greater. Origin: ....



Share this page:
Follow us:
Task Runner