parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject parquet-cpp git commit: PARQUET-1038: Key value metadata should be nullptr if not set
Date Fri, 23 Jun 2017 04:51:49 GMT
Repository: parquet-cpp
Updated Branches:
  refs/heads/master 29ed01ea7 -> 9adbe6d2a


PARQUET-1038: Key value metadata should be nullptr if not set

Author: Phillip Cloud <cpcloud@gmail.com>

Closes #357 from cpcloud/PARQUET-1038 and squashes the following commits:

5fc6276 [Phillip Cloud] Ridiculous hack
b7401e0 [Phillip Cloud] Pass specific gcov
8c99235 [Phillip Cloud] Turn off haskell
fbbc45e [Phillip Cloud] PARQUET-1038: Key value metadata should be nullptr if not set


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

Branch: refs/heads/master
Commit: 9adbe6d2a067ea08be83fb90ab511dce231bbe45
Parents: 29ed01e
Author: Phillip Cloud <cpcloud@gmail.com>
Authored: Fri Jun 23 00:51:44 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Fri Jun 23 00:51:44 2017 -0400

----------------------------------------------------------------------
 ci/upload_coverage.sh                         |  8 +++++---
 cmake_modules/ThirdpartyToolchain.cmake       |  1 +
 src/parquet/arrow/arrow-reader-writer-test.cc |  3 +++
 src/parquet/arrow/arrow-schema-test.cc        | 15 +++++++++++++++
 src/parquet/file/metadata.cc                  |  3 ++-
 5 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/9adbe6d2/ci/upload_coverage.sh
----------------------------------------------------------------------
diff --git a/ci/upload_coverage.sh b/ci/upload_coverage.sh
index 521dae4..73b37c2 100755
--- a/ci/upload_coverage.sh
+++ b/ci/upload_coverage.sh
@@ -26,7 +26,9 @@ ls -l
 
 echo $PARQUET_ROOT
 
-coveralls --gcov-options '\-l' -r $PARQUET_ROOT \
+coveralls --gcov $(which gcov-4.9) \
+    --gcov-options '\-l' --root '' \
+    --include $PARQUET_ROOT \
     --exclude $PARQUET_ROOT/parquet-build/thirdparty \
     --exclude $PARQUET_ROOT/parquet-build/arrow_ep \
     --exclude $PARQUET_ROOT/parquet-build/brotli_ep \
@@ -38,5 +40,5 @@ coveralls --gcov-options '\-l' -r $PARQUET_ROOT \
     --exclude $PARQUET_ROOT/parquet-build/zlib_ep \
     --exclude $PARQUET_ROOT/parquet-build/zlib_ep-prefix \
     --exclude $PARQUET_ROOT/build \
-    --exclude /usr \
-    --exclude $PARQUET_ROOT/src/parquet/thrift
+    --exclude $PARQUET_ROOT/src/parquet/thrift \
+    --exclude /usr

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/9adbe6d2/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index 6661185..f958620 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -191,6 +191,7 @@ if (NOT THRIFT_FOUND)
                         "-DWITH_C_GLIB=OFF"
                         "-DWITH_JAVA=OFF"
                         "-DWITH_PYTHON=OFF"
+                        "-DWITH_HASKELL=OFF"
                         "-DWITH_CPP=ON"
                         "-DWITH_STATIC_LIB=ON"
                         )

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/9adbe6d2/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 16dddb0..97bb19b 100644
--- a/src/parquet/arrow/arrow-reader-writer-test.cc
+++ b/src/parquet/arrow/arrow-reader-writer-test.cc
@@ -377,6 +377,9 @@ class TestParquetIO : public ::testing::Test {
   void ReadTableFromFile(
       std::unique_ptr<FileReader> reader, std::shared_ptr<Table>* out) {
     ASSERT_OK_NO_THROW(reader->ReadTable(out));
+    auto key_value_metadata =
+        reader->parquet_reader()->metadata()->key_value_metadata().get();
+    ASSERT_EQ(nullptr, key_value_metadata);
     ASSERT_NE(nullptr, out->get());
   }
 

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/9adbe6d2/src/parquet/arrow/arrow-schema-test.cc
----------------------------------------------------------------------
diff --git a/src/parquet/arrow/arrow-schema-test.cc b/src/parquet/arrow/arrow-schema-test.cc
index a3d98bf..34d4813 100644
--- a/src/parquet/arrow/arrow-schema-test.cc
+++ b/src/parquet/arrow/arrow-schema-test.cc
@@ -184,6 +184,21 @@ TEST_F(TestConvertParquetSchema, ParquetKeyValueMetadata) {
   ASSERT_EQ("baz", arrow_metadata->value(1));
 }
 
+TEST_F(TestConvertParquetSchema, ParquetEmptyKeyValueMetadata) {
+  std::vector<NodePtr> parquet_fields;
+  std::vector<std::shared_ptr<Field>> arrow_fields;
+
+  parquet_fields.push_back(
+      PrimitiveNode::Make("int32", Repetition::REQUIRED, ParquetType::INT32));
+  arrow_fields.push_back(std::make_shared<Field>("int32", INT32, false));
+
+  std::shared_ptr<KeyValueMetadata> key_value_metadata = nullptr;
+  ASSERT_OK(ConvertSchema(parquet_fields, key_value_metadata));
+
+  auto arrow_metadata = result_schema_->metadata();
+  ASSERT_EQ(arrow_metadata, nullptr);
+}
+
 TEST_F(TestConvertParquetSchema, ParquetFlatDecimals) {
   std::vector<NodePtr> parquet_fields;
   std::vector<std::shared_ptr<Field>> arrow_fields;

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/9adbe6d2/src/parquet/file/metadata.cc
----------------------------------------------------------------------
diff --git a/src/parquet/file/metadata.cc b/src/parquet/file/metadata.cc
index 7120d88..aea7a74 100644
--- a/src/parquet/file/metadata.cc
+++ b/src/parquet/file/metadata.cc
@@ -415,8 +415,9 @@ class FileMetaData::FileMetaDataImpl {
   ApplicationVersion writer_version_;
 
   void InitKeyValueMetadata() {
-    auto metadata = std::make_shared<KeyValueMetadata>();
+    std::shared_ptr<KeyValueMetadata> metadata = nullptr;
     if (metadata_->__isset.key_value_metadata) {
+      metadata = std::make_shared<KeyValueMetadata>();
       for (const auto& it : metadata_->key_value_metadata) {
         metadata->Append(it.key, it.value);
       }


Mime
View raw message