存在于Hive中的表格格式如下:
desc table_name;
col_id double
col_ts string
col_nm string
cols_nm string
col_cd string
col_state_cd string我使用以下代码将其导出到csv:
hive -e 'set hive.cli.print.header=true; select * from table_name' | sed 's/[\t]/,/g' > /home/yourfile.csv但是当我通过R读取它时,col_id的数据类型会更改为字符串。如何确保数据格式与Hive中相同?
发布于 2016-05-24 01:49:03
试试Hadley的重新读卡器包 --它很擅长猜测数据类型。
require(readr)
demo_tables <- read_csv("my_table.csv")https://stackoverflow.com/questions/31053877
复制相似问题