Home > Enterprise >  Created external table but it's empty
Created external table but it's empty

Time:12-06

I want to create an external table from a .csv file I uploaded to the server earlier. In Bline (shell for Hive), I tried running this script:

CREATE EXTERNAL TABLE c_fink_category_mapping (
    trench_code string,
    fink_code string
)
row format delimited fields terminated by '\073' stored as textfile 
location '/appl/trench/dev/data/in/main/daily_wf/fink_category_mapping'
TABLEPROPERTIES ('serialization.null.format' = '')
;

which creates the table w/o any error byt the table itself is empty. Help would be appreciated. My textfile is populated with data.

CodePudding user response:

First, check if the location path is correct.

Then try with this configuration:

CREATE EXTERNAL TABLE c_fink_category_mapping (
    trench_code string,
    fink_code string
)
ROW FORMAT SERDE 
      'org.apache.hadoop.hive.serde2.OpenCSVSerde' 
WITH SERDEPROPERTIES ( 
  'quoteChar'='"', 
  'separatorChar'=',') 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  '/appl/trench/dev/data/in/main/daily_wf/fink_category_mapping';
  • Related