Skip to content

Commit

Permalink
Support UNKNOWN type in map_concat function (facebookincubator#10795)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookincubator#10795

Reviewed By: zacw7

Differential Revision: D61609911

Pulled By: kewang1024

fbshipit-source-id: ea9faa297cf70c7206f530d5b861dc15c4c7b9fd
  • Loading branch information
kewang1024 authored and facebook-github-bot committed Aug 22, 2024
1 parent 2796200 commit 024d10d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion velox/functions/lib/MapConcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MapConcatFunction : public exec::VectorFunction {
static std::vector<std::shared_ptr<exec::FunctionSignature>> signatures() {
// map(K,V), map(K,V), ... -> map(K,V)
return {exec::FunctionSignatureBuilder()
.knownTypeVariable("K")
.typeVariable("K")
.typeVariable("V")
.returnType("map(K,V)")
.argumentType("map(K,V)")
Expand Down
11 changes: 11 additions & 0 deletions velox/functions/lib/tests/MapConcatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,14 @@ TEST_F(MapConcatTest, nullEntry) {
ASSERT_EQ(result->size(), 1);
EXPECT_EQ(result->sizeAt(0), 0);
}

TEST_F(MapConcatTest, unknownType) {
// MAP_CONCAT(MAP[], MAP[])
auto emptyMapVector =
VectorTestBase::makeMapVector<UnknownValue, UnknownValue>({{}});
auto expectedMap =
VectorTestBase::makeMapVector<UnknownValue, UnknownValue>({{}});
auto result = evaluate(
"map_concat(c0, c1)", makeRowVector({emptyMapVector, emptyMapVector}));
facebook::velox::test::assertEqualVectors(expectedMap, result);
}

0 comments on commit 024d10d

Please sign in to comment.