我的同事在用avro serde创建配置单元表时出错。下面是他尝试的代码,结果出错了。
DROP TABLE IF EXISTS twitter;
CREATE TABLE twitter
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
TBLPROPERTIES ('avro.schema.literal'='{
"type" : "record",
"name" : "twitter_schema",
"namespace" : "com.miguno.avro",
"fields" : [ {
"name" : "username",
"type" : "string",
"doc" : "Name of the user account on Twitter.com"},
{"name" : "tweet",
"type" : "string",
"doc" : "The content of the user's Twitter message"},
{"name" : "timestamp",
"type" : "long",
"doc" : "Unix epoch time in seconds"}
],"doc:" : "A basic schema for storing Twitter messages"}');
后来我发现第17行中的撇号“'”引起了这个问题。
"doc" : "The content of the user's Twitter message"},
在上面的一行中,doc注解包含了一个带有撇号的单词。我把它取了下来,效果很好。
暂无答案!
目前还没有任何答案,快来回答吧!