Skip to content

Commit e8f7ccf

Browse files
committed
Test to Map data type
1 parent f3acf1a commit e8f7ccf

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

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
@@ -1912,5 +1912,35 @@ TEST(AsofJoinTest, StructTestDataType) {
19121912
])");
19131913
AssertExecBatchesEqual(result.schema, {exp_batch}, result.batches);
19141914
}
1915+
1916+
TEST(AsofJoinTest, MapTestDataType) {
1917+
auto map_type = map(int64(), int64());
1918+
1919+
auto left_batch = ExecBatchFromJSON({int64()}, R"([[1], [2], [3]])");
1920+
auto right_batch = ExecBatchFromJSON({map_type, int64()}, R"([
1921+
[[[11, 111], [22, 222]], 2],
1922+
[[[33, 333], [44, 444], [77, 777]], 3],
1923+
[[[55, 555], [66, 666]], 4]
1924+
])");
1925+
1926+
Declaration left{"exec_batch_source",
1927+
ExecBatchSourceNodeOptions(schema({field("on", int64())}),
1928+
{std::move(left_batch)})};
1929+
Declaration right{
1930+
"exec_batch_source",
1931+
ExecBatchSourceNodeOptions(schema({field("col", map_type), field("on", int64())}),
1932+
{std::move(right_batch)})};
1933+
AsofJoinNodeOptions asof_join_opts({{{"on"}, {}}, {{"on"}, {}}}, 1);
1934+
Declaration asof_join{
1935+
"asofjoin", {std::move(left), std::move(right)}, std::move(asof_join_opts)};
1936+
1937+
ASSERT_OK_AND_ASSIGN(auto result, DeclarationToExecBatches(std::move(asof_join)));
1938+
auto exp_batch = ExecBatchFromJSON({int64(), map_type}, R"([
1939+
[1, [[11, 111], [22, 222]]],
1940+
[2, [[11, 111], [22, 222]]],
1941+
[3, [[33, 333], [44, 444], [77, 777]]]
1942+
])");
1943+
AssertExecBatchesEqual(result.schema, {exp_batch}, result.batches);
1944+
}
19151945
} // namespace acero
19161946
} // 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)