Skip to content

Commit

Permalink
PARQUET-519: Remove last of suppressed compiler warnings
Browse files Browse the repository at this point in the history
Author: Wes McKinney <wesm@apache.org>

Closes apache#69 from wesm/PARQUET-519 and squashes the following commits:

cde787e [Wes McKinney] Initialize RleDecoder with encoded_len
b8f0234 [Wes McKinney] Remove -Wno-unused-variable and fix compiler warnings
  • Loading branch information
wesm committed Sep 2, 2018
1 parent 938b843 commit 824c4be
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 16 deletions.
1 change: 0 additions & 1 deletion cpp/src/parquet/column/levels-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace parquet_cpp {

void GenerateLevels(int min_repeat_factor, int max_repeat_factor,
int max_level, std::vector<int16_t>& input_levels) {
int total_count = 0;
// for each repetition count upto max_repeat_factor
for (int repeat = min_repeat_factor; repeat <= max_repeat_factor; repeat++) {
// repeat count increases by a factor of 2 for every iteration
Expand Down
1 change: 0 additions & 1 deletion cpp/src/parquet/column/levels.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class LevelDecoder {
int SetData(Encoding::type encoding, int16_t max_level,
int num_buffered_values, const uint8_t* data) {
uint32_t num_bytes = 0;
uint32_t total_bytes = 0;
encoding_ = encoding;
num_values_remaining_ = num_buffered_values;
bit_width_ = BitUtil::Log2(max_level + 1);
Expand Down
6 changes: 0 additions & 6 deletions cpp/src/parquet/column/test-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ class DataPageBuilder {
if (encoding != Encoding::PLAIN) {
ParquetException::NYI("only plain encoding currently implemented");
}
int bytes_to_encode = values.size() * sizeof(T);

PlainEncoder<TYPE> encoder(d);
encoder.Encode(&values[0], values.size(), sink_);

Expand Down Expand Up @@ -171,8 +169,6 @@ void DataPageBuilder<Type::BOOLEAN>::AppendValues(const ColumnDescriptor *d,
if (encoding != Encoding::PLAIN) {
ParquetException::NYI("only plain encoding currently implemented");
}
int bytes_to_encode = values.size() * sizeof(bool);

PlainEncoder<Type::BOOLEAN> encoder(d);
encoder.Encode(values, values.size(), sink_);

Expand All @@ -186,8 +182,6 @@ static std::shared_ptr<DataPage> MakeDataPage(const ColumnDescriptor *d,
const std::vector<T>& values,
const std::vector<int16_t>& def_levels, int16_t max_def_level,
const std::vector<int16_t>& rep_levels, int16_t max_rep_level) {
int num_values = values.size();

InMemoryOutputStream page_stream;
test::DataPageBuilder<TYPE> page_builder(&page_stream);

Expand Down
1 change: 0 additions & 1 deletion cpp/src/parquet/encodings/dictionary-encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ inline void DictEncoder<T>::Put(const T& v) {
index = hash_slots_[j];
}

int bytes_added = 0;
if (index == HASH_SLOT_EMPTY) {
// Not in the hash table, so we insert it now
index = uniques_.size();
Expand Down
1 change: 0 additions & 1 deletion cpp/src/parquet/encodings/encoding-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ template <>
void GenerateData<ByteArray>(int num_values, ByteArray* out, vector<uint8_t>* heap) {
// seed the prng so failure is deterministic
int max_byte_array_len = 12;
int num_bytes = max_byte_array_len + sizeof(uint32_t);
heap->resize(num_values * max_byte_array_len);
random_byte_array(num_values, 0, heap->data(), out, 2, max_byte_array_len);
}
Expand Down
1 change: 0 additions & 1 deletion cpp/src/parquet/file/file-deserialize-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class TestPageSerde : public ::testing::Test {
// have meaningful data associated with them

// Serialize the Page header
uint32_t serialized_len = max_serialized_len;
page_header_.__set_data_page_header(data_page_header_);
page_header_.uncompressed_page_size = uncompressed_size;
page_header_.compressed_page_size = compressed_size;
Expand Down
1 change: 0 additions & 1 deletion cpp/src/parquet/file/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ void ParquetFileReader::DebugPrint(std::ostream& stream, bool print_values) {
vector<std::shared_ptr<Scanner> > scanners(num_columns, NULL);
for (int i = 0; i < num_columns; ++i) {
std::shared_ptr<ColumnReader> col_reader = group_reader->Column(i);
Type::type col_type = col_reader->type();

std::stringstream ss;
ss << "%-" << COL_WIDTH << "s";
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/parquet/thrift/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ set(THRIFT_SRCS
parquet_constants.cpp
parquet_types.cpp)

set_source_files_properties(parquet_types.cpp PROPERTIES
COMPILE_FLAGS -Wno-unused-variable)

add_library(parquet_thrift STATIC
${THRIFT_SRCS}
)
Expand Down
6 changes: 2 additions & 4 deletions cpp/src/parquet/util/rle-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,9 @@ bool CheckRoundTrip(const vector<int>& values, int bit_width) {
int encoded_len = encoder.Flush();
int out;

RleDecoder decoder(buffer, len, bit_width);
RleDecoder decoder(buffer, encoded_len, bit_width);
for (size_t i = 0; i < values.size(); ++i) {
uint64_t val;
bool result = decoder.Get(&out);
EXPECT_TRUE(decoder.Get(&out));
if (values[i] != out) {
return false;
}
Expand Down Expand Up @@ -354,7 +353,6 @@ TEST(BitRle, Random) {
std::random_device rd;
std::uniform_int_distribution<int> dist(1, 20);

uint32_t seed = 0;
for (int iter = 0; iter < niters; ++iter) {
// generate a seed with device entropy
uint32_t seed = rd();
Expand Down

0 comments on commit 824c4be

Please sign in to comment.