parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject parquet-cpp git commit: PARQUET-995: Use sizeof(Int96) instead of Int96Type
Date Thu, 18 May 2017 19:49:23 GMT
Repository: parquet-cpp
Updated Branches:
  refs/heads/master 1bb368468 -> 069131d2c


PARQUET-995: Use sizeof(Int96) instead of Int96Type

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #337 from wesm/PARQUET-995 and squashes the following commits:

28ecda1 [Wes McKinney] Rename unit test
9e9e1eb [Wes McKinney] Add test case that fails valgrind
8201dd4 [Wes McKinney] Use sizeof(Int96) instead of Int96Type


Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/069131d2
Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/069131d2
Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/069131d2

Branch: refs/heads/master
Commit: 069131d2c8f7ea7748c7144434708c9af7be6355
Parents: 1bb3684
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Thu May 18 21:49:18 2017 +0200
Committer: Uwe L. Korn <uwe@apache.org>
Committed: Thu May 18 21:49:18 2017 +0200

----------------------------------------------------------------------
 src/parquet/arrow/arrow-reader-writer-test.cc | 20 ++++++++++++++++++++
 src/parquet/arrow/reader.cc                   |  4 ++--
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/069131d2/src/parquet/arrow/arrow-reader-writer-test.cc
----------------------------------------------------------------------
diff --git a/src/parquet/arrow/arrow-reader-writer-test.cc b/src/parquet/arrow/arrow-reader-writer-test.cc
index 64690ae..3d156b5 100644
--- a/src/parquet/arrow/arrow-reader-writer-test.cc
+++ b/src/parquet/arrow/arrow-reader-writer-test.cc
@@ -1159,6 +1159,26 @@ TEST_F(TestNestedSchemaRead, ReadTablePartial) {
   ASSERT_EQ(table->schema()->field(0)->type()->num_children(), 0);
 }
 
+TEST(TestArrowReaderAdHoc, Int96BadMemoryAccess) {
+  // PARQUET-995
+  const char* data_dir = std::getenv("PARQUET_TEST_DATA");
+  std::string dir_string(data_dir);
+  std::stringstream ss;
+  ss << dir_string << "/"
+     << "alltypes_plain.parquet";
+  auto path = ss.str();
+
+  auto pool = ::arrow::default_memory_pool();
+
+  std::unique_ptr<FileReader> arrow_reader;
+  ASSERT_NO_THROW(
+      arrow_reader.reset(new FileReader(pool,
+              ParquetFileReader::OpenFile(path, false))));
+  std::shared_ptr<::arrow::Table> table;
+  ASSERT_OK_NO_THROW(arrow_reader->ReadTable(&table));
+}
+
+
 }  // namespace arrow
 
 }  // namespace parquet

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/069131d2/src/parquet/arrow/reader.cc
----------------------------------------------------------------------
diff --git a/src/parquet/arrow/reader.cc b/src/parquet/arrow/reader.cc
index 6d8c4ff..826fe37 100644
--- a/src/parquet/arrow/reader.cc
+++ b/src/parquet/arrow/reader.cc
@@ -516,7 +516,7 @@ NONNULLABLE_BATCH_FAST_PATH(::arrow::Time64Type, Int64Type, int64_t)
 template <>
 Status ColumnReader::Impl::ReadNonNullableBatch<::arrow::TimestampType, Int96Type>(
     TypedColumnReader<Int96Type>* reader, int64_t values_to_read, int64_t* levels_read)
{
-  RETURN_NOT_OK(values_buffer_.Resize(values_to_read * sizeof(Int96Type), false));
+  RETURN_NOT_OK(values_buffer_.Resize(values_to_read * sizeof(Int96), false));
   auto values = reinterpret_cast<Int96*>(values_buffer_.mutable_data());
   int64_t values_read;
   PARQUET_CATCH_NOT_OK(*levels_read = reader->ReadBatch(
@@ -626,7 +626,7 @@ template <>
 Status ColumnReader::Impl::ReadNullableBatch<::arrow::TimestampType, Int96Type>(
     TypedColumnReader<Int96Type>* reader, int16_t* def_levels, int16_t* rep_levels,
     int64_t values_to_read, int64_t* levels_read, int64_t* values_read) {
-  RETURN_NOT_OK(values_buffer_.Resize(values_to_read * sizeof(Int96Type), false));
+  RETURN_NOT_OK(values_buffer_.Resize(values_to_read * sizeof(Int96), false));
   auto values = reinterpret_cast<Int96*>(values_buffer_.mutable_data());
   int64_t null_count;
   PARQUET_CATCH_NOT_OK(reader->ReadBatchSpaced(values_to_read, def_levels, rep_levels,


Mime
View raw message