我是新来的avro,而试图使用avro别名属性,我得到下面的错误。
查询: select department_id , office_name from test.depart_alias;
semanticexception[error 10004]:行1:23无效的表别名或列引用“office\u name”:(可能的列名为:department\u id、department\u name)
我的avsc格式的json文件是
{
"type" : "record",
"name" : "departments",
"doc" : "Sqoop import of departments",
"fields" : [ {
"name" : "department_id",
"type" : [ "null", "int" ],
"default" : null,
"columnName" : "department_id",
"sqlType" : "4"
}, {
"name" : "department_name",
"type" : [ "null", "string" ],
"default" : null,
"aliases" : [ "office_name" ],
"columnName" : "department_name",
"sqlType" : "12"
} ],
"tableName" : "departments"
我想用办公室名作为部门名的别名。我该如何实施
谢谢
1条答案
按热度按时间nhjlsmyf1#
如果旧的列字段名为department\u name,则架构应如下所示
旧列名或“别名”应该放在别名数组中。