Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 committed May 5, 2024
1 parent 0f8790c commit c0b0dfa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion velox/docs/functions/spark/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Map Functions

.. spark:function:: map_from_entries(array(struct(K,V))) -> map(K,V)
Returns a map created from the given array of entries. Keys are not allowed to be null or to contain nulls.
Returns a map created from the given array of entries. Exceptions will be thrown if key is null or contains null.
If null entry exists in the array, return null for this whole array.::

SELECT map_from_entries(array(struct(1, 'a'), struct(2, 'null'))); -- {1 -> 'a', 2 -> 'null'}
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/MapFromEntries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class MapFromEntriesFunction : public exec::VectorFunction {
});

auto resetSize = [&](vector_size_t row) { mutableSizes[row] = 0; };
auto nulls = allocateNulls(rows.size(), context.pool());
auto nulls = allocateNulls(rows.end(), context.pool());
auto* mutableNulls = nulls->asMutable<uint64_t>();

if (decodedRowVector->mayHaveNulls() || keyVector->mayHaveNulls() ||
Expand Down
3 changes: 0 additions & 3 deletions velox/functions/sparksql/tests/MapFromEntriesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
* limitations under the License.
*/
#include <cstdint>
#include <optional>
#include "velox/common/base/tests/GTestUtils.h"
#include "velox/functions/lib/CheckDuplicateKeys.h"
#include "velox/functions/prestosql/ArrayConstructor.h"
#include "velox/functions/sparksql/tests/SparkFunctionBaseTest.h"
#include "velox/vector/tests/TestingDictionaryArrayElementsFunction.h"

using namespace facebook::velox::test;

Expand Down

0 comments on commit c0b0dfa

Please sign in to comment.