1

我有一个使用 sqoop 的 CDP 7.3.1,我已将 Postgres 数据库表中的数据加载到 HDFS 位置 /ts/gp/node 中。现在我正在尝试在此创建一个配置单元表。我收到以下错误。请帮忙

CREATE TABLE dsk.node
(
    district  string,
    zone  string
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','  LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/ts/gp/node'
ERROR: ImpalaRuntimeException: Error making 'createTable' RPC to Hive Metastore:
CAUSED BY: MetaException: A managed table's location should be located within managed warehouse root directory or within its database's managedLocationUri. Table node's location is not valid:hdfs://gFasService/ts/gp/node, managed warehouse:hdfs://gFasService/warehouse/tablespace/managed/hive
4

1 回答 1

0

如果您想要托管表,则在不指定位置的情况下创建它

CREATE TABLE dsk.node
(
    district  string,
    zone  string
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','  LINES TERMINATED BY '\n'; 

使用DESCRIBE FORMATTED dsk.node;和检查位置,请参阅手册

然后从上面的 DESCRIBE 命令将数据加载到位置,如果您已经将数据加载到其他位置,只需使用hdfs dfs -cp 命令复制它。

于 2022-02-19T08:17:59.153 回答