Commits


Omer Ozarslan authored and Uwe L. Korn committed d6bc0b6f597
ARROW-6326: [C++] Nullable fields when converting std::tuple to Table `std::optional` isn't used for representing nullable fields in Arrow's current STL conversion API since it requires C++17. Also there are other ways to represent an optional field other than `std::optional` such as using pointers or external implementations of optional (`boost::optional`, `type_safe::optional` and alike). Since it is hard to maintain so many different kinds of specializations, introducing an `Optional` concept covering these classes solve this issue and allow implementing nullable fields consistently. For a type `T` to be considered as an `Optional`: 1) It should be convertible (implicitly or explicitly) to bool, i.e. it implements `[explicit] operator bool()`, 2) It should be dereferencable, i.e. it implements `operator*()`. If a type conforms to above `Optional` requirements, it will be automatically converted to a nullable field when used with `TableFromTupleRange`. This PR doesn't cover setting a tuple value from an optional value read from a table (i.e.` TupleRangeFromTable`). Inner type used for the field will be inferred from that of the return type of dereferencing optional (e.g. `int32_t` for `std::optional<int32_t>`, which would be represented by `Int32Type`). Closes #5171 from ozars/arrow-6326 and squashes the following commits: cd842fdaa <Omer Ozarslan> Fail if mock optional is casted more than once 07c9e2bfe <Omer Ozarslan> Fix usage of void_t 1419a706d <Omer Ozarslan> Add note about optional mock's assumption 04ef1c455 <Omer Ozarslan> Address review 0a981f537 <Omer Ozarslan> Fix formatting 8a2130f23 <Omer Ozarslan> Remove debugging artifact 31e0e0169 <Omer Ozarslan> Test mock optional object b7b3a24c2 <Omer Ozarslan> Test adding optional-compatible types to Table 179a6a915 <Omer Ozarslan> Implement traits for optional-compatible types ec44c305c <Omer Ozarslan> Add missing sstream header in stl.h Authored-by: Omer Ozarslan <omer@utdallas.edu> Signed-off-by: Uwe L. Korn <uwelk@xhochy.com>