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-841: Version number being incorrectly written for v1 files
Date Wed, 25 Jan 2017 03:44:56 GMT
Repository: parquet-cpp
Updated Branches:
  refs/heads/master 248094206 -> df59ffcf6


PARQUET-841: Version number being incorrectly written for v1 files

In introduced this bug recently and it wasn't properly being tested.

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

Closes #225 from wesm/PARQUET-839 and squashes the following commits:

96d663f [Wes McKinney] Version number being incorrectly written for v1.0


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

Branch: refs/heads/master
Commit: df59ffcf62874faeb2bd252247dde219638eac81
Parents: 2480942
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Tue Jan 24 22:44:49 2017 -0500
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Tue Jan 24 22:44:49 2017 -0500

----------------------------------------------------------------------
 src/parquet/file/file-metadata-test.cc | 25 +++++++++++++++++++++++++
 src/parquet/file/metadata.cc           |  2 ++
 2 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/df59ffcf/src/parquet/file/file-metadata-test.cc
----------------------------------------------------------------------
diff --git a/src/parquet/file/file-metadata-test.cc b/src/parquet/file/file-metadata-test.cc
index 79e2bb1..9b9fffd 100644
--- a/src/parquet/file/file-metadata-test.cc
+++ b/src/parquet/file/file-metadata-test.cc
@@ -157,6 +157,31 @@ TEST(Metadata, TestBuildAccess) {
   ASSERT_EQ(26, rg2_column2->data_page_offset());
 }
 
+TEST(Metadata, TestV1Version) {
+  // PARQUET-839
+  parquet::schema::NodeVector fields;
+  parquet::schema::NodePtr root;
+  parquet::SchemaDescriptor schema;
+
+  WriterProperties::Builder prop_builder;
+
+  std::shared_ptr<WriterProperties> props =
+      prop_builder.version(ParquetVersion::PARQUET_1_0)->build();
+
+  fields.push_back(parquet::schema::Int32("int_col", Repetition::REQUIRED));
+  fields.push_back(parquet::schema::Float("float_col", Repetition::REQUIRED));
+  root = parquet::schema::GroupNode::Make("schema", Repetition::REPEATED, fields);
+  schema.Init(root);
+
+  auto f_builder = FileMetaDataBuilder::Make(&schema, props);
+
+  // Read the metadata
+  auto f_accessor = f_builder->Finish();
+
+  // file metadata
+  ASSERT_EQ(ParquetVersion::PARQUET_1_0, f_accessor->version());
+}
+
 TEST(FileVersion, Basics) {
   FileMetaData::Version version("parquet-mr version 1.2.8");
 

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/df59ffcf/src/parquet/file/metadata.cc
----------------------------------------------------------------------
diff --git a/src/parquet/file/metadata.cc b/src/parquet/file/metadata.cc
index 1545efe..d9acf41 100644
--- a/src/parquet/file/metadata.cc
+++ b/src/parquet/file/metadata.cc
@@ -678,8 +678,10 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
     switch (properties_->version()) {
       case ParquetVersion::PARQUET_1_0:
         file_version = 1;
+        break;
       case ParquetVersion::PARQUET_2_0:
         file_version = 2;
+        break;
       default:
         break;
     }


Mime
View raw message