From e3658a60a6f362030eb529e6f1109c422470a193 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 31 Oct 2016 21:25:22 -0400 Subject: [PATCH] PARQUET-760: Store correct encoding in fallback data pages Author: Uwe L. Korn Closes #182 from xhochy/PARQUET-760 and squashes the following commits: 1791506 [Uwe L. Korn] PARQUET-760: Store correct encoding in fallback data pages Change-Id: Id8f2308a3c8a9ebacb251476f532b82bba9f2787 --- cpp/src/parquet/column/column-writer-test.cc | 9 +++++---- cpp/src/parquet/column/writer.cc | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cpp/src/parquet/column/column-writer-test.cc b/cpp/src/parquet/column/column-writer-test.cc index 745efe7f11c16..2269e8f736d2c 100644 --- a/cpp/src/parquet/column/column-writer-test.cc +++ b/cpp/src/parquet/column/column-writer-test.cc @@ -381,10 +381,11 @@ TYPED_TEST(TestPrimitiveWriter, RequiredVeryLargeChunk) { writer->WriteBatch(this->values_.size(), nullptr, nullptr, this->values_ptr_); writer->Close(); - // Just read the first SMALL_SIZE rows to ensure we could read it back in - this->ReadColumn(); - ASSERT_EQ(SMALL_SIZE, this->values_read_); - this->values_.resize(SMALL_SIZE); + // Read all rows so we are sure that also the non-dictionary pages are read correctly + this->SetupValuesOut(VERY_LARGE_SIZE); + this->ReadColumnFully(); + ASSERT_EQ(VERY_LARGE_SIZE, this->values_read_); + this->values_.resize(VERY_LARGE_SIZE); ASSERT_EQ(this->values_, this->values_out_); std::vector encodings = this->metadata_encodings(); // There are 3 encodings (RLE, PLAIN_DICTIONARY, PLAIN) in a fallback case diff --git a/cpp/src/parquet/column/writer.cc b/cpp/src/parquet/column/writer.cc index d1c3fe2ca3492..92a5e09968143 100644 --- a/cpp/src/parquet/column/writer.cc +++ b/cpp/src/parquet/column/writer.cc @@ -216,6 +216,7 @@ void TypedColumnWriter::CheckDictionarySizeLimit() { fallback_ = true; // Only PLAIN encoding is supported for fallback in V1 current_encoder_.reset(new PlainEncoder(descr_, properties_->allocator())); + encoding_ = Encoding::PLAIN; } }