From 0c6ae2134905dc47525b813de3b3649510c951fa Mon Sep 17 00:00:00 2001 From: Jack Del Vecchio Date: Fri, 13 Oct 2023 17:18:58 +0000 Subject: [PATCH] Add check for correct extension and revert to clearer code. --- plugins/parquet/parquetembed.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/parquet/parquetembed.cpp b/plugins/parquet/parquetembed.cpp index a90e4e25c8a..7b9af829fdc 100644 --- a/plugins/parquet/parquetembed.cpp +++ b/plugins/parquet/parquetembed.cpp @@ -169,8 +169,13 @@ arrow::Status ParquetHelper::openWriteFile() { StringBuffer filename; StringBuffer path; - splitFilename(destination.c_str(), nullptr, &path, &filename, &filename, false); - Owned itr = createDirectoryIterator(path.str(), filename.insert(filename.length() - 8, '*'), false, false); // We want to insert '*' before ".parquet" + StringBuffer ext; + splitFilename(destination.c_str(), nullptr, &path, &filename, &ext, false); + + if(strncasecmp(ext.str(), ".parquet", ext.length()) != 0) + failx("Error opening file: Invalid file extension %s", ext.str()); + + Owned itr = createDirectoryIterator(path.str(), filename.append("*.parquet")); ForEach(*itr) {