我们尝试创建一个外部配置单元表,它的模式与现有的内部/托管表相似,下一步将插入ecternal的数据。
下面的代码使用托管表的复制架构创建外部表
CREATE EXTERNAL TABLE IF NOT EXISTS sls_test_ext like sls_test
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ","
LINES TERMINATED BY "\n"
LOCATION "/bla/bla/";
但当它被执行时,它返回如下
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:sp2020.sls_test_ext cannot be declared transactional because it's an external table)
INFO : Completed executing command(queryId=hive_20201111233927_593d38ff-39ed-412e-b128-41d949a3a476); Time taken: 0.017 seconds
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:sp2020.sls_test_ext cannot be declared transactional because it's an external table) (state=08S01,code=1)
然后我们试着修改上面的代码如下
CREATE EXTERNAL TABLE IF NOT EXISTS sls_test_ext like sls_test
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ","
LINES TERMINATED BY "\n"
LOCATION "/bla/bla/"
TBLPROPERTIES ("transactional"="false");
它将返回相同的错误。是否有任何缺少的代码或需要更改某些配置单元配置
注意:托管表是使用sqoop import hive table自动创建的?
1条答案
按热度按时间5w9g7ksd1#
您可以尝试以下解决方案:
托管表:
外部表: