Skip to content

Commit

Permalink
PARQUET-455: Fix OS X / Clang compiler warnings
Browse files Browse the repository at this point in the history
There actually was a legitimate bug fixed here for malformed Parquet files, but we are not yet in a position to write a decent test for it until PARQUET-497. I will make a note on that JIRA.

I also set our Travis CI build to fail on future compiler warnings.

This also closes apache#15.

Author: Wes McKinney <wes@cloudera.com>

Closes apache#40 from wesm/PARQUET-455 and squashes the following commits:

a348063 [Wes McKinney] Compiler warnings fail the build
271d71e [Wes McKinney] Fix OS X / Clang compiler warnings

Change-Id: I8b89f98506f59bb5b207b6cf1b0f2ea5d17c2585
  • Loading branch information
wesm authored and julienledem committed Feb 6, 2016
1 parent bbfc0d5 commit b77fdd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cpp/src/parquet/encodings/plain-encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ class PlainEncoder<Type::BOOLEAN> : public Encoder<Type::BOOLEAN> {
explicit PlainEncoder(const ColumnDescriptor* descr) :
Encoder<Type::BOOLEAN>(descr, parquet::Encoding::PLAIN) {}

virtual size_t Encode(const std::vector<bool>& src, int num_values,
virtual size_t Encode(const bool* src, int num_values, uint8_t* dst) {
throw ParquetException("this API for encoding bools not implemented");
return 0;
}

size_t Encode(const std::vector<bool>& src, int num_values,
uint8_t* dst) {
size_t bytes_required = BitUtil::RoundUp(num_values, 8) / 8;
BitWriter bit_writer(dst, bytes_required);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/parquet/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void ParquetFileReader::ParseMetaData() {

uint32_t metadata_len = *reinterpret_cast<uint32_t*>(footer_buffer);
size_t metadata_start = filesize - FOOTER_SIZE - metadata_len;
if (metadata_start < 0) {
if (FOOTER_SIZE + metadata_len > filesize) {
throw ParquetException("Invalid parquet file. File is less than file metadata size.");
}

Expand Down

0 comments on commit b77fdd7

Please sign in to comment.