Skip to content

Commit 31c8bfa

Browse files
committed
Test to Map data type
1 parent cedceb5 commit 31c8bfa

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

cpp/src/arrow/acero/asof_join_node.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@ class AsofJoinNode : public ExecNode {
12321232
case Type::LIST:
12331233
case Type::FIXED_SIZE_LIST:
12341234
case Type::STRUCT:
1235+
case Type::MAP:
12351236
return Status::OK();
12361237
default:
12371238
return Status::Invalid("Unsupported type for data field ", field->name(), " : ",

cpp/src/arrow/acero/asof_join_node_test.cc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,5 +1855,35 @@ TEST(AsofJoinTest, StructTestDataType) {
18551855
])");
18561856
AssertExecBatchesEqual(result.schema, {exp_batch}, result.batches);
18571857
}
1858+
1859+
TEST(AsofJoinTest, MapTestDataType) {
1860+
auto map_type = map(int64(), int64());
1861+
1862+
auto left_batch = ExecBatchFromJSON({int64()}, R"([[1], [2], [3]])");
1863+
auto right_batch = ExecBatchFromJSON({map_type, int64()}, R"([
1864+
[[[11, 111], [22, 222]], 2],
1865+
[[[33, 333], [44, 444], [77, 777]], 3],
1866+
[[[55, 555], [66, 666]], 4]
1867+
])");
1868+
1869+
Declaration left{"exec_batch_source",
1870+
ExecBatchSourceNodeOptions(schema({field("on", int64())}),
1871+
{std::move(left_batch)})};
1872+
Declaration right{
1873+
"exec_batch_source",
1874+
ExecBatchSourceNodeOptions(schema({field("col", map_type), field("on", int64())}),
1875+
{std::move(right_batch)})};
1876+
AsofJoinNodeOptions asof_join_opts({{{"on"}, {}}, {{"on"}, {}}}, 1);
1877+
Declaration asof_join{
1878+
"asofjoin", {std::move(left), std::move(right)}, std::move(asof_join_opts)};
1879+
1880+
ASSERT_OK_AND_ASSIGN(auto result, DeclarationToExecBatches(std::move(asof_join)));
1881+
auto exp_batch = ExecBatchFromJSON({int64(), map_type}, R"([
1882+
[1, [[11, 111], [22, 222]]],
1883+
[2, [[11, 111], [22, 222]]],
1884+
[3, [[33, 333], [44, 444], [77, 777]]]
1885+
])");
1886+
AssertExecBatchesEqual(result.schema, {exp_batch}, result.batches);
1887+
}
18581888
} // namespace acero
18591889
} // namespace arrow

cpp/src/arrow/acero/unmaterialized_table_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class UnmaterializedCompositeTable {
116116
MATERIALIZE_CASE(FIXED_SIZE_LIST)
117117
MATERIALIZE_CASE(LIST)
118118
MATERIALIZE_CASE(STRUCT)
119+
MATERIALIZE_CASE(MAP)
119120
default:
120121
return arrow::Status::Invalid("Unsupported data type ",
121122
field->type()->ToString(), " for field ",

0 commit comments

Comments
 (0)