从json转换为sstable期间出现json2sstable错误

时间:2014-01-16 07:32:46

标签: json cassandra

这里我有一个json输入,我想导入到cassandra,所以我使用json2stable,如下所示

./json2sstable -K yelp -c business /home/srinath/Desktop/test.json /home/srinath/Desktop/CD/Cassandra/cassandra/data/yelp/business/Standard1-e-1-Data.db

输出:

ERROR 15:03:02,594 Unable to initialize MemoryMeter (jamm not specified as javaagent).  This means Cassandra will be unable to measure object sizes accurately and may consequently OOM.
org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.Object[] out of START_OBJECT token
 at [Source: /home/srinath/Desktop/test.json; line: 1, column: 1]
    at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
    at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)
    at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212)
    at org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer.handleNonArray(ObjectArrayDeserializer.java:177)
    at org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:88)
    at org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:18)
    at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1294)
    at org.codehaus.jackson.JsonParser.readValueAs(JsonParser.java:1368)
    at org.apache.cassandra.tools.SSTableImport.importUnsorted(SSTableImport.java:351)
    at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:335)
    at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:559)
ERROR: Can not deserialize instance of java.lang.Object[] out of START_OBJECT token
 at [Source: /home/srinath/Desktop/test.json; line: 1, column: 1]

=============================================== ================================================== ===============================================

示例Json:

{
    "business_id": "qarobAbxGSHI7ygf1f7a_Q",
    "full_address": "891 E Baseline Rd\nSuite 102\nGilbert, AZ 85233",
    "open": true,
    "categories": [
        "Sandwiches",
        "Restaurants"
    ],
    "city": "Gilbert",
    "review_count": 10,
    "name": "Jersey Mike's Subs",
    "neighborhoods": [],
    "longitude": -111.8120071,
    "state": "AZ",
    "stars": 3.5,
    "latitude": 33.3788385,
    "type": "business"
}

1 个答案:

答案 0 :(得分:0)

 cid | key  | ts
 -----+------+-----
 101 | ramu | 999

[{
"columns":[["cid",101],["key","ramu"],["ts",687]]
}]

以上json格式基于上表.. 就像那样,你可以根据你的表格和列来准备你的json。