Search code examples
hivecreate-tablecsvhiveddl

Why my table not recognize the field delimited?


I'm trying input a text file delimited with ";", but it does not work. The create tables is OK, but all data is in one column (tp_registro).

tp_registro      1;0000000167;1120112368---------;29012019;172822;4124999762039------;;0000555;0000060;02;00000001416;00000000000;
seq              NULL
num_a            NULL
dt_chamada       NULL
hr_chamada       NULL
num_b            NULL
pt_interconect   NULL
dur_rel_chamada  NULL
dur_tar_chamada  NULL
tp_servico       NULL
vl_liq_chamada   NULL
vl_brt_chamada   NULL
reserva          NULL
CREATE EXTERNAL TABLE IF NOT EXISTS
gd_f_mtr.tbgdt_stg_batimento_cobilling_tim_nconciliado(
    tp_registro string,
    seq string,
    num_a string,
    dt_chamada string,
    hr_chamada string,
    num_b string,
    pt_interconect string,
    dur_rel_chamada string,
    dur_tar_chamada string,
    tp_servico string,
    vl_liq_chamada string,
    vl_brt_chamada string,
    reserva string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '/073'
STORED AS TEXTFILE
LOCATION '/gr/nas/Ex/Op';

Solution

  • Use FIELDS TERMINATED BY '\073' (backslash \, not /)