diff --git a/velox/functions/prestosql/MapFunctions.h b/velox/functions/prestosql/MapFunctions.h index c319f4f0e327..ec34e1d3b81e 100644 --- a/velox/functions/prestosql/MapFunctions.h +++ b/velox/functions/prestosql/MapFunctions.h @@ -32,4 +32,21 @@ struct MapKeyExists { } }; +template +struct MapRemoveNullValues { + VELOX_DEFINE_FUNCTION_TYPES(TExec); + + void call( + out_type, Generic>>& out, + const arg_type, Generic>>& inputMap) { + for (const auto& entry : inputMap) { + if (entry.second.has_value()) { + auto [keyWriter, valueWriter] = out.add_item(); + keyWriter.copy_from(entry.first); + valueWriter.copy_from(entry.second.value()); + } + } + } +}; + } // namespace facebook::velox::functions diff --git a/velox/functions/prestosql/MapRemoveNullValues.h b/velox/functions/prestosql/MapRemoveNullValues.h deleted file mode 100644 index 97a781f34154..000000000000 --- a/velox/functions/prestosql/MapRemoveNullValues.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include "velox/expression/ComplexViewTypes.h" -#include "velox/functions/Udf.h" - -namespace facebook::velox::functions { - -template -struct MapRemoveNullValues { - VELOX_DEFINE_FUNCTION_TYPES(TExec); - - void call( - out_type, Generic>>& out, - const arg_type, Generic>>& inputMap) { - for (const auto& entry : inputMap) { - if (entry.second.has_value()) { - auto [keyWriter, valueWriter] = out.add_item(); - keyWriter.copy_from(entry.first); - valueWriter.copy_from(entry.second.value()); - } - } - } -}; - -} // namespace facebook::velox::functions diff --git a/velox/functions/prestosql/registration/MapFunctionsRegistration.cpp b/velox/functions/prestosql/registration/MapFunctionsRegistration.cpp index 33a72fc917fa..e38518634871 100644 --- a/velox/functions/prestosql/registration/MapFunctionsRegistration.cpp +++ b/velox/functions/prestosql/registration/MapFunctionsRegistration.cpp @@ -21,7 +21,6 @@ #include "velox/functions/prestosql/MapFunctions.h" #include "velox/functions/prestosql/MapKeysByTopNValues.h" #include "velox/functions/prestosql/MapNormalize.h" -#include "velox/functions/prestosql/MapRemoveNullValues.h" #include "velox/functions/prestosql/MapSubset.h" #include "velox/functions/prestosql/MapTopN.h" #include "velox/functions/prestosql/MapTopNKeys.h"