'Merging Tables in Apache Arrow

I have two arrow:Tables where table 1 is:

colA        colB
1           2
3           4

and table 2 is,

colC        colD
i           j
k           l

where both table 1 and 2 have the same number of rows. I would like to join them side-by-side as

colA        colB        colC        coldD
1           2           i           j
3           4           k           l

I'm trying to use arrow::ConcatenateTables as follows, but I'm getting a bunch of nulls in my output (not shown)

t1 = ... \\ std::shared_ptr<arrow::Table>
t2 = ... \\ std::shared_ptr<arrow::Table>
arrow::ConcatenateTablesOptions options;
options.unify_schemas = true;
options.field_merge_options.promote_nullability = true;
auto merged = arrow::ConcatenateTables({t1, t2}, options);

How do I obtain the expected output?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source