forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Author: Uwe L. Korn <[email protected]> Closes apache#3404 from xhochy/stl-extension and squashes the following commits: 4856260 <Korn, Uwe> Cast to size_t to compare on equal signedness aaeacfd <Uwe L. Korn> docker-compose run clang-format 386e5bc <Korn, Uwe> Check size of target 8b472da <Korn, Uwe> Update documentation 1a3743e <Korn, Uwe> Allow building shared libs without tests 9a08a3e <Korn, Uwe> Use full path to checked_cast e037507 <Korn, Uwe> Use ArrayFromJSON 1ab23f8 <Korn, Uwe> Move to type_singleton 30e66f9 <Korn, Uwe> Add additional STL conversions
- Loading branch information
Showing
10 changed files
with
561 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.