Skip to content

Commit

Permalink
Add check for correct extension and revert to clearer code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdelv committed Oct 13, 2023
1 parent e4524f9 commit 0c6ae21
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/parquet/parquetembed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ arrow::Status ParquetHelper::openWriteFile()
{
StringBuffer filename;
StringBuffer path;
splitFilename(destination.c_str(), nullptr, &path, &filename, &filename, false);
Owned<IDirectoryIterator> 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<IDirectoryIterator> itr = createDirectoryIterator(path.str(), filename.append("*.parquet"));

ForEach(*itr)
{
Expand Down

0 comments on commit 0c6ae21

Please sign in to comment.