G-Research / ParquetSharp

ParquetSharp is a .NET library for reading and writing Apache Parquet files.
Apache License 2.0
183 stars 49 forks source link

Fix out of memory errors causing logic_error when using ManagedRandomAccessFile #471

Closed adamreeve closed 4 months ago

adamreeve commented 4 months ago

When one of the ManagedRandomAccessFile methods called from C++ caused an OutOfMemoryException, the exception message was set to null in HandleException, but this caused a std::logic_error on the C++ side when trying to convert nullptr to std::string when constructing an arrow::Status in ManagedRandomAccessFile::GetResult. The error looks like:

ParquetSharp.ParquetException: St11logic_error (message: 'basic_string::_S_construct null not valid')

I've added a check for exception == nullptr to fix this.

I've also changed the TRYCATCH macro so that these errors are propagated out as an OutOfMemoryException again, and fixed the use of plain integers for status codes.