实际上,我正通过天鹅座向宇宙发送数据。例如,Cygnus放置数据的Cosmos目录是/user/myUser/mysetdata。我已经创建了包含以下列的hive表: recvTimeTs、recvTime、entityId、entityType、attrName、attrType、attrValue。
现在,我想通过HttpFS将数据直接放入Cosmos,放入天鹅座的同一目录下。
怎么会是".txt“文件格式呢?它必须用逗号分隔吗?例如:
recvTimeTs;recvTimem;entityId;entityType;attrName;attrType;attrValue值;...
发布于 2014-06-17 17:12:26
配置单元表格包含HDFS文件夹中的文件中的结构化数据,该文件夹是在配置单元表格创建命令中提供的。
在HDFS Cygnus 0.1中,这样的结构化数据是通过使用类CSV文件实现的,因此将新文件添加到HDFS文件夹或将新数据附加到该文件夹中已存在的文件中,就像组成新的类CSV数据行一样简单。分隔符必须与您在创建表时指定的相同,例如:
create external table <table_name> (recvTimeTs bigint, recvTime string, entityId string, entityType string, attrName string, attrType string, attrValue string) row format delimited fields terminated by '|' location '/user/<myusername>/<mydataset>/';因此,作为示例分隔符|,新数据行必须如下所示:
<ts>|<ts_ms>|<entity_name>|<entity_type>|<attribute_name>|<attribute_type>|<value>从Cugnus0.2(包括Json)开始,结构化数据是通过使用类Json文件来实现的。在这种情况下,您不必处理分隔符,也不必创建表(请参阅this question),因为Json不使用分隔符,并且表创建是自动的。在这种情况下,您必须按照以下任何一种格式组成新文件或要附加到现有文件的新数据(具体取决于您是以row模式还是以column模式存储数据):
{"recvTimeTs":"13453464536", "recvTime":"2014-02-27T14:46:21", "entityId":"Room1", "entityType":"Room", "attrName":"temperature", "attrType":"centigrade", "attrValue":"26.5", "attrMd":[{name:ID, type:string, value:ground}]}
{"recvTime":"2014-02-27T14:46:21", "temperature":"26.5", "temperature_md":[{"name":"ID", "type":"string", "value":"ground"}]}值得一提的是,有一些脚本负责将0.1-like格式转换为0.2-like (或更高)格式。
https://stackoverflow.com/questions/24246991
复制相似问题