繁体   English   中英

无法从给定路径读取架构:hdfs://...avsc

[英]Unable to read schema from given path: hdfs://…avsc

我尝试通过以下步骤创建一个配置单元表:

  1. 使用 sqoop 将数据加载到 hdfs(完成)
  2. sqoop 还创建了一个 avsc 文件,我将其上传到 hdfs
  3. 在配置单元中,我想使用以下语句创建一个表:

命令:

CREATE EXTERNAL TABLE kontoauszug
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'
LOCATION 'hdfs:///user/tki/KONTOAUSZUG'
TBLPROPERTIES ('avro.schema.url'='hdfs://m1.hdp2/user/tki/KONTOAUSZUG.avsc');

我收到以下错误:

FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.DDLTask. 
java.lang.RuntimeException: MetaException(message:org.apache.hadoop.hive.serde2.SerDeException 
Encountered AvroSerdeException determining schema. 
Returning signal schema to indicate problem: Unable to read schema from given path: hdfs://m1.hdp2/user/tki/KONTOAUSZUG.avsc)

这是否意味着找不到 KONTOAUSZUG.avsc? 我交叉检查它是可用的。

它的内容是:

[hadoop@m1 hive]$ cat KONTOAUSZUG.avsc 
{
  "type" : "record",
  "name" : "KONTOAUSZUG",
  "doc" : "Sqoop import of KONTOAUSZUG",
  "fields" : [ {
    "name" : "FK_PROCESS_ID_INS",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "FK_PROCESS_ID_INS",
    "sqlType" : "2"
  }, {
    "name" : "FK_SOURCE_ID",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "FK_SOURCE_ID",
    "sqlType" : "2"
  }, {
    "name" : "SRC_STM_ID",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "SRC_STM_ID",
    "sqlType" : "2"
  }, {
    "name" : "FK_PROCESS_ID_UPD",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "FK_PROCESS_ID_UPD",
    "sqlType" : "2"
  }, {
    "name" : "BUCHUNGSDATUM",
    "type" : [ "null", "long" ],
    "default" : null,
    "columnName" : "BUCHUNGSDATUM",
    "sqlType" : "93"
  }, {
    "name" : "BUCHUNGSTEXT",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "BUCHUNGSTEXT",
    "sqlType" : "12"
  }, {
    "name" : "SOLL",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "SOLL",
    "sqlType" : "2"
  }, {
    "name" : "HABEN",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "HABEN",
    "sqlType" : "2"
  }, {
    "name" : "FK_KONTO_ID",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "FK_KONTO_ID",
    "sqlType" : "2"
  }, {
    "name" : "EINGABE_MANUELL_F",
    "type" : [ "null", "string" ],
    "default" : null,
    "columnName" : "EINGABE_MANUELL_F",
    "sqlType" : "2"
  } ],
  "tableName" : "KONTOAUSZUG"
}

CREATE table 语句中,您使用了三个斜杠: hdfs:///而不是hdfs://

(...)'hdfs:///user/tki/KONTOAUSZUG' TBLPROPERTIES (...)

此外,如果您是从 namenode 服务器获取架构,我认为您应该在主机 url 之后写入端口。

'avro.schema.url'='hdfs://m1.hdp2:端口/user/tki/KONTOAUSZUG.avsc'

详情请查看这里 而且,这个关于 hdfs 端口的答案

这是访问错误。 请检查 avsc 目录以获得适当的权限并重试 hdfs://m1.hdp2/user/tki/KONTOAUSZUG.avsc

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM