From 31caa33f36eb8fe3878275fca0817c2fff8ddef0 Mon Sep 17 00:00:00 2001 From: Jia Ke Date: Mon, 22 May 2023 13:43:35 +0000 Subject: [PATCH] write parquet data into temp dir --- .../hive/storage_adapters/hdfs/HdfsWriteFile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/velox/connectors/hive/storage_adapters/hdfs/HdfsWriteFile.cpp b/velox/connectors/hive/storage_adapters/hdfs/HdfsWriteFile.cpp index caa08dc4ee1c..6fef3e9a1789 100644 --- a/velox/connectors/hive/storage_adapters/hdfs/HdfsWriteFile.cpp +++ b/velox/connectors/hive/storage_adapters/hdfs/HdfsWriteFile.cpp @@ -25,6 +25,13 @@ HdfsWriteFile::HdfsWriteFile( short replication, int blockSize) : hdfsClient_(hdfsClient), filePath_(path) { + auto pos = filePath_.rfind("/"); + auto parentDir = filePath_.substr(0, pos + 1); + // Check whether the parentDir exist, create it if not exist. + if (hdfsExists(hdfsClient_, parentDir.c_str()) == -1) { + hdfsCreateDirectory(hdfsClient_, parentDir.c_str()); + } + hdfsFile_ = hdfsOpenFile( hdfsClient_, filePath_.c_str(),