[
https://issues.apache.org/jira/browse/PARQUET-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16370876#comment-16370876
]
ASF GitHub Bot commented on PARQUET-1218:
-----------------------------------------
wesm closed pull request #438: PARQUET-1218: More informative error message on
too short pages
URL: https://github.com/apache/parquet-cpp/pull/438
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/parquet/column_reader.cc b/src/parquet/column_reader.cc
index 10d72109..bcbb339b 100644
--- a/src/parquet/column_reader.cc
+++ b/src/parquet/column_reader.cc
@@ -180,7 +180,10 @@ std::shared_ptr<Page> SerializedPageReader::NextPage() {
// Read the compressed data page.
buffer = stream_->Read(compressed_len, &bytes_read);
if (bytes_read != compressed_len) {
- ParquetException::EofException();
+ std::stringstream ss;
+ ss << "Page was smaller (" << bytes_read << ") than expected (" <<
compressed_len
+ << ")";
+ ParquetException::EofException(ss.str());
}
// Uncompress it if we need to
diff --git a/src/parquet/exception.cc b/src/parquet/exception.cc
index 2278bc80..5f5525cc 100644
--- a/src/parquet/exception.cc
+++ b/src/parquet/exception.cc
@@ -25,8 +25,13 @@
namespace parquet {
-PARQUET_NORETURN void ParquetException::EofException() {
- throw ParquetException("Unexpected end of stream.");
+PARQUET_NORETURN void ParquetException::EofException(const std::string& msg) {
+ std::stringstream ss;
+ ss << "Unexpected end of stream";
+ if (!msg.empty()) {
+ ss << ": " << msg;
+ }
+ throw ParquetException(ss.str());
}
PARQUET_NORETURN void ParquetException::NYI(const std::string& msg) {
diff --git a/src/parquet/exception.h b/src/parquet/exception.h
index 37481848..08629bee 100644
--- a/src/parquet/exception.h
+++ b/src/parquet/exception.h
@@ -59,7 +59,7 @@ namespace parquet {
class PARQUET_EXPORT ParquetException : public std::exception {
public:
- PARQUET_NORETURN static void EofException();
+ PARQUET_NORETURN static void EofException(const std::string& msg = "");
PARQUET_NORETURN static void NYI(const std::string& msg);
PARQUET_NORETURN static void Throw(const std::string& msg);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [C++] More informative error message on too short pages
> -------------------------------------------------------
>
> Key: PARQUET-1218
> URL: https://issues.apache.org/jira/browse/PARQUET-1218
> Project: Parquet
> Issue Type: Improvement
> Components: parquet-cpp
> Reporter: Uwe L. Korn
> Assignee: Uwe L. Korn
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)