Commits


Korn, Uwe authored and Uwe L. Korn committed 240c46959ac
ARROW-4265: [C++] Automatic conversion between Table and std::vector<std::tuple<..>> This enables conversions between a `std::vector<std::tuple<…>>` like and `arrow::Table`. tuple to Table: ```cpp std::vector<std::tuple<double, std::string>> rows = .. std::shared_ptr<Table> table; if (!arrow::stl::TableFromTupleRange( arrow::default_memory_pool(), rows, names, &table).ok() ) { // Error handling code should go here. } ``` Table to tuple: ```cpp // An important aspect here is that the table columns need to be in the // same order as the columns will later appear in the tuple. As the tuple // is unnamed, matching is done on positions. std::shared_ptr<Table> table = .. // The range needs to be pre-allocated to the respective amount of rows. // This allows us to pass in an arbitrary range object, not only // `std::vector`. std::vector<std::tuple<double, std::string>> rows(2); if (!arrow::stl::TupleRangeFromTable(*table, &rows).ok()) { // Error handling code should go here. } ``` Author: Korn, Uwe <Uwe.Korn@blue-yonder.com> Author: Uwe L. Korn <uwelk@xhochy.com> Closes #3404 from xhochy/stl-extension and squashes the following commits: 4856260a <Korn, Uwe> Cast to size_t to compare on equal signedness aaeacfd1 <Uwe L. Korn> docker-compose run clang-format 386e5bc9 <Korn, Uwe> Check size of target 8b472da8 <Korn, Uwe> Update documentation 1a3743e0 <Korn, Uwe> Allow building shared libs without tests 9a08a3eb <Korn, Uwe> Use full path to checked_cast e037507c <Korn, Uwe> Use ArrayFromJSON 1ab23f87 <Korn, Uwe> Move to type_singleton 30e66f9e <Korn, Uwe> Add additional STL conversions