mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
add error check
This commit is contained in:
parent
b4e30ad78e
commit
c6e205b2ad
@ -72,6 +72,9 @@ namespace
|
||||
|
||||
HDFSFileInfo ls;
|
||||
ls.file_info = hdfsListDirectory(fs.get(), prefix_without_globs.data(), &ls.length);
|
||||
if (ls.file_info == nullptr) {
|
||||
throw Exception(ErrorCodes::ACCESS_DENIED, "Cannot list directory {}: {}", prefix_without_globs, String(hdfsGetLastError()));
|
||||
}
|
||||
Strings result;
|
||||
for (int i = 0; i < ls.length; ++i)
|
||||
{
|
||||
|
@ -361,6 +361,10 @@ def test_hdfsCluster(started_cluster):
|
||||
assert actual == expected
|
||||
fs.delete(dir, recursive=True)
|
||||
|
||||
def testHdfsDirectoryNotExist(started_cluster):
|
||||
ddl ="create table HDFSStorageWithNotExistDir (id UInt32, name String, weight Float64) ENGINE = HDFS('hdfs://hdfs1:9000/dir1/empty', 'TSV')";
|
||||
node1.query(ddl)
|
||||
assert "Cannot list directory" in node1.query_and_get_error("select * from HDFSStorageWithNotExistDir")
|
||||
|
||||
if __name__ == '__main__':
|
||||
cluster.start()
|
||||
|
Loading…
Reference in New Issue
Block a user