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
Post a Comment