Skip to content

Commit

Permalink
Velox Array Join Unknown support (facebookincubator#12584)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookincubator#12584

Add support for Unknown type in Velox Array Join Function

Reviewed By: amitkdutta

Differential Revision: D70812360

fbshipit-source-id: 6d40808a1654496d4a44f69520be00493aa2f54d
  • Loading branch information
natashasehgal authored and facebook-github-bot committed Mar 11, 2025
1 parent 47aa2b5 commit c2eb47b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion velox/expression/fuzzer/ExpressionFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ int main(int argc, char** argv) {
// from_unixtime can generate timestamps out of the supported range that
// make other functions throw VeloxRuntimeErrors.
"from_unixtime",
};
// JSON not supported, Real doesn't match exactly, etc.
"array_join"};
size_t initialSeed = FLAGS_seed == 0 ? std::time(nullptr) : FLAGS_seed;

std::unordered_map<std::string, std::shared_ptr<ArgTypesGenerator>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ void registerArrayFunctions(const std::string& prefix) {
registerArrayJoinFunctions<Timestamp>(prefix);
registerArrayJoinFunctions<Date>(prefix);
registerArrayJoinFunctions<Json>(prefix);
registerArrayJoinFunctions<UnknownValue>(prefix);

registerFunction<ArrayAverageFunction, double, Array<double>>(
{prefix + "array_average"});
Expand Down
12 changes: 12 additions & 0 deletions velox/functions/prestosql/tests/ArrayJoinTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,16 @@ TEST_F(ArrayJoinTest, jsonTest) {
false,
true);
}

TEST_F(ArrayJoinTest, unknownTest) {
testArrayJoinNoReplacement<UnknownValue>(
{std::nullopt, std::nullopt, std::nullopt}, ","_sv, ""_sv);

testArrayJoinReplacement<UnknownValue>(
{std::nullopt, std::nullopt, std::nullopt},
","_sv,
"null"_sv,
"null,null,null"_sv);
}

} // namespace

0 comments on commit c2eb47b

Please sign in to comment.