[ 
https://issues.apache.org/jira/browse/PARQUET-1168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277329#comment-16277329
 ] 

ASF GitHub Bot commented on PARQUET-1168:
-----------------------------------------

cpcloud closed pull request #422: PARQUET-1168: [C++] Table::Make no longer 
exists in Arrow
URL: https://github.com/apache/parquet-cpp/pull/422
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/parquet/arrow/arrow-reader-writer-benchmark.cc 
b/src/parquet/arrow/arrow-reader-writer-benchmark.cc
index edeef1ed..4efb62ed 100644
--- a/src/parquet/arrow/arrow-reader-writer-benchmark.cc
+++ b/src/parquet/arrow/arrow-reader-writer-benchmark.cc
@@ -114,7 +114,7 @@ std::shared_ptr<::arrow::Table> TableFromVector(
   auto field = ::arrow::field("column", type, nullable);
   auto schema = ::arrow::schema({field});
   auto column = std::make_shared<::arrow::Column>(field, array);
-  return ::arrow::Table::Make(schema, {column});
+  return std::make_shared<::arrow::Table>(schema, 
std::vector<decltype(column)>{column});
 }
 
 template <>
@@ -137,7 +137,7 @@ std::shared_ptr<::arrow::Table> 
TableFromVector<BooleanType>(const std::vector<b
   auto schema = std::make_shared<::arrow::Schema>(
       std::vector<std::shared_ptr<::arrow::Field>>({field}));
   auto column = std::make_shared<::arrow::Column>(field, array);
-  return ::arrow::Table::Make(schema, {column});
+  return std::make_shared<::arrow::Table>(schema, 
std::vector<decltype(column)>{column});
 }
 
 template <bool nullable, typename ParquetType>
diff --git a/src/parquet/arrow/arrow-reader-writer-test.cc 
b/src/parquet/arrow/arrow-reader-writer-test.cc
index a8d38241..25e639fd 100644
--- a/src/parquet/arrow/arrow-reader-writer-test.cc
+++ b/src/parquet/arrow/arrow-reader-writer-test.cc
@@ -1145,7 +1145,7 @@ void MakeDateTimeTypesTable(std::shared_ptr<Table>* out, 
bool nanos_as_micros =
       std::make_shared<Column>("f0", a0), std::make_shared<Column>("f1", a1),
       std::make_shared<Column>("f2", a2), std::make_shared<Column>("f3", a3),
       std::make_shared<Column>("f4", a4), std::make_shared<Column>("f5", a5)};
-  *out = Table::Make(schema, columns);
+  *out = std::make_shared<::arrow::Table>(schema, columns);
 }
 
 TEST(TestArrowReadWrite, DateTimeTypes) {
@@ -1196,30 +1196,29 @@ TEST(TestArrowReadWrite, CoerceTimestamps) {
   ArrayFromVector<::arrow::TimestampType, int64_t>(t_ns, is_valid, ns_values, 
&a_ns);
 
   // Input table, all data as is
-  auto s1 = std::shared_ptr<::arrow::Schema>(
-      new ::arrow::Schema({field("f_s", t_s), field("f_ms", t_ms), 
field("f_us", t_us),
-                           field("f_ns", t_ns)}));
-  auto input = Table::Make(
+  auto s1 = ::arrow::schema(
+      {field("f_s", t_s), field("f_ms", t_ms), field("f_us", t_us), 
field("f_ns", t_ns)});
+  auto input = std::make_shared<::arrow::Table>(
       s1,
-      {std::make_shared<Column>("f_s", a_s), std::make_shared<Column>("f_ms", 
a_ms),
+      ColumnVector{std::make_shared<Column>("f_s", a_s), 
std::make_shared<Column>("f_ms", a_ms),
        std::make_shared<Column>("f_us", a_us), 
std::make_shared<Column>("f_ns", a_ns)});
 
   // Result when coercing to milliseconds
-  auto s2 = std::shared_ptr<::arrow::Schema>(
-      new ::arrow::Schema({field("f_s", t_ms), field("f_ms", t_ms), 
field("f_us", t_ms),
-                           field("f_ns", t_ms)}));
-  auto ex_milli_result = Table::Make(
+  auto s2 = ::arrow::schema(
+      {field("f_s", t_ms), field("f_ms", t_ms), field("f_us", t_ms),
+                           field("f_ns", t_ms)});
+  auto ex_milli_result = std::make_shared<::arrow::Table>(
       s2,
-      {std::make_shared<Column>("f_s", a_ms), std::make_shared<Column>("f_ms", 
a_ms),
+      ColumnVector{std::make_shared<Column>("f_s", a_ms), 
std::make_shared<Column>("f_ms", a_ms),
        std::make_shared<Column>("f_us", a_ms), 
std::make_shared<Column>("f_ns", a_ms)});
 
   // Result when coercing to microseconds
-  auto s3 = std::shared_ptr<::arrow::Schema>(
-      new ::arrow::Schema({field("f_s", t_us), field("f_ms", t_us), 
field("f_us", t_us),
-                           field("f_ns", t_us)}));
-  auto ex_micro_result = Table::Make(
+  auto s3 = ::arrow::schema(
+      {field("f_s", t_us), field("f_ms", t_us), field("f_us", t_us),
+                           field("f_ns", t_us)});
+  auto ex_micro_result = std::make_shared<::arrow::Table>(
       s3,
-      {std::make_shared<Column>("f_s", a_us), std::make_shared<Column>("f_ms", 
a_us),
+      ColumnVector{std::make_shared<Column>("f_s", a_us), 
std::make_shared<Column>("f_ms", a_us),
        std::make_shared<Column>("f_us", a_us), 
std::make_shared<Column>("f_ns", a_us)});
 
   std::shared_ptr<Table> milli_result;
@@ -1263,20 +1262,20 @@ TEST(TestArrowReadWrite, CoerceTimestampsLosePrecision) 
{
   ArrayFromVector<::arrow::TimestampType, int64_t>(t_us, is_valid, us_values, 
&a_us);
   ArrayFromVector<::arrow::TimestampType, int64_t>(t_ns, is_valid, ns_values, 
&a_ns);
 
-  auto s1 = std::shared_ptr<::arrow::Schema>(new ::arrow::Schema({field("f_s", 
t_s)}));
-  auto s2 = std::shared_ptr<::arrow::Schema>(new 
::arrow::Schema({field("f_ms", t_ms)}));
-  auto s3 = std::shared_ptr<::arrow::Schema>(new 
::arrow::Schema({field("f_us", t_us)}));
-  auto s4 = std::shared_ptr<::arrow::Schema>(new 
::arrow::Schema({field("f_ns", t_ns)}));
+  auto s1 = ::arrow::schema({field("f_s", t_s)});
+  auto s2 = ::arrow::schema({field("f_ms", t_ms)});
+  auto s3 = ::arrow::schema({field("f_us", t_us)});
+  auto s4 = ::arrow::schema({field("f_ns", t_ns)});
 
   auto c1 = std::make_shared<Column>("f_s", a_s);
   auto c2 = std::make_shared<Column>("f_ms", a_ms);
   auto c3 = std::make_shared<Column>("f_us", a_us);
   auto c4 = std::make_shared<Column>("f_ns", a_ns);
 
-  auto t1 = Table::Make(s1, {c1});
-  auto t2 = Table::Make(s2, {c2});
-  auto t3 = Table::Make(s3, {c3});
-  auto t4 = Table::Make(s4, {c4});
+  auto t1 = std::make_shared<::arrow::Table>(s1, ColumnVector{c1});
+  auto t2 = std::make_shared<::arrow::Table>(s2, ColumnVector{c2});
+  auto t3 = std::make_shared<::arrow::Table>(s3, ColumnVector{c3});
+  auto t4 = std::make_shared<::arrow::Table>(s4, ColumnVector{c4});
 
   auto sink = std::make_shared<InMemoryOutputStream>();
 
@@ -1324,7 +1323,7 @@ TEST(TestArrowReadWrite, ConvertedDateTimeTypes) {
 
   std::vector<std::shared_ptr<::arrow::Column>> columns = {
       std::make_shared<Column>("f0", a0), std::make_shared<Column>("f1", a1)};
-  auto table = Table::Make(schema, columns);
+  auto table = std::make_shared<::arrow::Table>(schema, columns);
 
   // Expected schema and values
   auto e0 = field("f0", ::arrow::date32());
@@ -1338,7 +1337,7 @@ TEST(TestArrowReadWrite, ConvertedDateTimeTypes) {
 
   std::vector<std::shared_ptr<::arrow::Column>> ex_columns = {
       std::make_shared<Column>("f0", x0), std::make_shared<Column>("f1", x1)};
-  auto ex_table = Table::Make(ex_schema, ex_columns);
+  auto ex_table = std::make_shared<::arrow::Table>(ex_schema, ex_columns);
 
   std::shared_ptr<Table> result;
   DoSimpleRoundtrip(table, 1, table->num_rows(), {}, &result);
@@ -1369,7 +1368,7 @@ void MakeDoubleTable(int num_columns, int num_rows, int 
nchunks,
     fields[i] = column->field();
   }
   auto schema = std::make_shared<::arrow::Schema>(fields);
-  *out = Table::Make(schema, columns);
+  *out = std::make_shared<::arrow::Table>(schema, columns);
 }
 
 TEST(TestArrowReadWrite, MultithreadedRead) {
@@ -1457,7 +1456,7 @@ TEST(TestArrowReadWrite, ReadColumnSubset) {
   }
 
   auto ex_schema = ::arrow::schema(ex_fields);
-  auto expected = Table::Make(ex_schema, ex_columns);
+  auto expected = std::make_shared<::arrow::Table>(ex_schema, ex_columns);
   AssertTablesEqual(*expected, *result);
 }
 
@@ -1498,7 +1497,7 @@ void MakeListTable(int num_rows, std::shared_ptr<Table>* 
out) {
   auto f1 = ::arrow::field("a", ::arrow::list(::arrow::int8()));
   auto schema = ::arrow::schema({f1});
   std::vector<std::shared_ptr<Array>> arrays = {list_array};
-  *out = Table::Make(schema, arrays);
+  *out = std::make_shared<::arrow::Table>(schema, arrays);
 }
 
 TEST(TestArrowReadWrite, ListLargeRecords) {
@@ -1541,7 +1540,7 @@ TEST(TestArrowReadWrite, ListLargeRecords) {
   auto chunked_col =
       std::make_shared<::arrow::Column>(table->schema()->field(0), chunked);
   std::vector<std::shared_ptr<::arrow::Column>> columns = {chunked_col};
-  auto chunked_table = Table::Make(table->schema(), columns);
+  auto chunked_table = std::make_shared<::arrow::Table>(table->schema(), 
columns);
 
   ASSERT_TRUE(table->Equals(*chunked_table));
 }
diff --git a/src/parquet/arrow/reader.cc b/src/parquet/arrow/reader.cc
index e13a094d..97e57e33 100644
--- a/src/parquet/arrow/reader.cc
+++ b/src/parquet/arrow/reader.cc
@@ -431,7 +431,7 @@ Status FileReader::Impl::ReadRowGroup(int row_group_index,
     RETURN_NOT_OK(ParallelFor(nthreads, num_columns, ReadColumnFunc));
   }
 
-  *out = Table::Make(schema, columns);
+  *out = std::make_shared<::arrow::Table>(schema, columns);
   return Status::OK();
 }
 
@@ -466,7 +466,7 @@ Status FileReader::Impl::ReadTable(const std::vector<int>& 
indices,
     RETURN_NOT_OK(ParallelFor(nthreads, num_fields, ReadColumnFunc));
   }
 
-  *table = Table::Make(schema, columns);
+  *table = std::make_shared<::arrow::Table>(schema, columns);
   return Status::OK();
 }
 
diff --git a/src/parquet/arrow/test-util.h b/src/parquet/arrow/test-util.h
index 7264324d..8611a303 100644
--- a/src/parquet/arrow/test-util.h
+++ b/src/parquet/arrow/test-util.h
@@ -414,7 +414,7 @@ std::shared_ptr<::arrow::Table> MakeSimpleTable(const 
std::shared_ptr<Array>& va
   std::vector<std::shared_ptr<::arrow::Column>> columns({column});
   std::vector<std::shared_ptr<::arrow::Field>> fields({column->field()});
   auto schema = std::make_shared<::arrow::Schema>(fields);
-  return ::arrow::Table::Make(schema, columns);
+  return std::make_shared<::arrow::Table>(schema, columns);
 }
 
 template <typename T>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [C++] Table::Make no longer exists in Arrow
> -------------------------------------------
>
>                 Key: PARQUET-1168
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1168
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-cpp
>    Affects Versions: cpp-1.2.0
>            Reporter: Phillip Cloud
>            Assignee: Phillip Cloud
>             Fix For: cpp-1.3.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to