arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-283: [C++] Account for upstream changes in parquet-cpp
Date Wed, 07 Sep 2016 04:20:58 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 637584bec -> 214b861ae


ARROW-283: [C++] Account for upstream changes in parquet-cpp

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

Closes #131 from wesm/ARROW-283 and squashes the following commits:

52dfb28 [Wes McKinney] Update arrow_parquet for API changes in parquet-cpp


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/214b861a
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/214b861a
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/214b861a

Branch: refs/heads/master
Commit: 214b861ae8f40f5fba544247d40c8995b93eca83
Parents: 637584b
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Wed Sep 7 00:20:51 2016 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed Sep 7 00:20:51 2016 -0400

----------------------------------------------------------------------
 cpp/src/arrow/parquet/reader.cc | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/214b861a/cpp/src/arrow/parquet/reader.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/parquet/reader.cc b/cpp/src/arrow/parquet/reader.cc
index 9f62125..440ec84 100644
--- a/cpp/src/arrow/parquet/reader.cc
+++ b/cpp/src/arrow/parquet/reader.cc
@@ -149,11 +149,13 @@ bool FileReader::Impl::CheckForFlatColumn(const ::parquet::ColumnDescriptor*
des
 }
 
 Status FileReader::Impl::GetFlatColumn(int i, std::unique_ptr<FlatColumnReader>* out)
{
-  if (!CheckForFlatColumn(reader_->descr()->Column(i))) {
+  const ::parquet::SchemaDescriptor* schema = reader_->metadata()->schema_descriptor();
+
+  if (!CheckForFlatColumn(schema->Column(i))) {
     return Status::Invalid("The requested column is not flat");
   }
   std::unique_ptr<FlatColumnReader::Impl> impl(
-      new FlatColumnReader::Impl(pool_, reader_->descr()->Column(i), reader_.get(),
i));
+      new FlatColumnReader::Impl(pool_, schema->Column(i), reader_.get(), i));
   *out = std::unique_ptr<FlatColumnReader>(new FlatColumnReader(std::move(impl)));
   return Status::OK();
 }
@@ -161,16 +163,20 @@ Status FileReader::Impl::GetFlatColumn(int i, std::unique_ptr<FlatColumnReader>*
 Status FileReader::Impl::ReadFlatColumn(int i, std::shared_ptr<Array>* out) {
   std::unique_ptr<FlatColumnReader> flat_column_reader;
   RETURN_NOT_OK(GetFlatColumn(i, &flat_column_reader));
-  return flat_column_reader->NextBatch(reader_->num_rows(), out);
+  return flat_column_reader->NextBatch(reader_->metadata()->num_rows(), out);
 }
 
 Status FileReader::Impl::ReadFlatTable(std::shared_ptr<Table>* table) {
-  const std::string& name = reader_->descr()->schema()->name();
+  auto descr = reader_->metadata()->schema_descriptor();
+
+  const std::string& name = descr->schema()->name();
   std::shared_ptr<Schema> schema;
-  RETURN_NOT_OK(FromParquetSchema(reader_->descr(), &schema));
+  RETURN_NOT_OK(FromParquetSchema(descr, &schema));
+
+  int num_columns = reader_->metadata()->num_columns();
 
-  std::vector<std::shared_ptr<Column>> columns(reader_->num_columns());
-  for (int i = 0; i < reader_->num_columns(); i++) {
+  std::vector<std::shared_ptr<Column>> columns(num_columns);
+  for (int i = 0; i < num_columns; i++) {
     std::shared_ptr<Array> array;
     RETURN_NOT_OK(ReadFlatColumn(i, &array));
     columns[i] = std::make_shared<Column>(schema->field(i), array);
@@ -375,7 +381,7 @@ Status FlatColumnReader::Impl::NextBatch(int batch_size, std::shared_ptr<Array>*
 }
 
 void FlatColumnReader::Impl::NextRowGroup() {
-  if (next_row_group_ < reader_->num_row_groups()) {
+  if (next_row_group_ < reader_->metadata()->num_row_groups()) {
     column_reader_ = reader_->RowGroup(next_row_group_)->Column(column_index_);
     next_row_group_++;
   } else {


Mime
View raw message