r - Exporting Hive to CSV with data type integrity -


the table present in hive in following format:

desc table_name; col_id                double col_ts                string col_nm                string cols_nm               string col_cd                string col_state_cd          string 

i using following code export csv :

 hive -e 'set hive.cli.print.header=true; select * table_name' | sed 's/[\t]/,/g'  > /home/yourfile.csv 

but when read through r, data type of col_id changes strings. how ensure data format same in hive?

try hadley wickham's readr package -- it's great @ guessing @ data types.

require(readr) demo_tables <- read_csv("my_table.csv") 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -