Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.3k
ARROW-15089: [C++][Compute] Implement kernel to lookup a MapArray item for a given key#12162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e4d04ef
MapArray basic rough outline.
dhruv9vats bbfad8e
Use non-recursive scalar check for the time being
dhruv9vats c069729
Second pass: correct basic implementation.
dhruv9vats 2558786
Use helper function and offsets instead
dhruv9vats b35acf3
Add basic templated test
f0473fa
Even more templated tests
dhruv9vats 6e371b8
Try and refactor MapArrayLookup kernels
dhruv9vats 012ff35
Pass references to helper to reduce (un)/boxing
dhruv9vats 8f287a2
Use offsets and refactor for ALL
dhruv9vats dadc4bf
Template kernel
dhruv9vats fbe0e1f
Handle more types and refactor
dhruv9vats 1095695
Add autocomplete helper
dhruv9vats a1a019a
Add docs
dhruv9vats ecded80
Handle null keys
dhruv9vats 87a6086
Remove unused header
dhruv9vats 8704599
Use ListBuilder
dhruv9vats 1302a47
Add python bindings
dhruv9vats 9268994
Rearrange docs
dhruv9vats 10d108d
Linting
dhruv9vats 3891afd
Update bindings and inline helper
dhruv9vats a4164d4
Rename to MapLookup
dhruv9vats 313ce8e
Tiny lint
dhruv9vats a8c5af5
Update type resolver
dhruv9vats 92f8610
Remove unnecessary tests
dhruv9vats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -470,6 +470,30 @@ class ARROW_EXPORT RandomOptions : public FunctionOptions { | ||
| uint64_t seed; | ||
| }; | ||
| /// Options for map_lookup function | ||
| class ARROW_EXPORT MapLookupOptions : public FunctionOptions { | ||
| public: | ||
| enum Occurrence { | ||
| /// Return the first matching value | ||
| FIRST, | ||
| /// Return the last matching value | ||
| LAST, | ||
| /// Return all matching values | ||
| ALL | ||
| }; | ||
| explicit MapLookupOptions(std::shared_ptr<Scalar> query_key, Occurrence occurrence); | ||
| MapLookupOptions(); | ||
| constexpr static char const kTypeName[] = "MapLookupOptions"; | ||
| /// The key to lookup in the map | ||
| std::shared_ptr<Scalar> query_key; | ||
| /// Whether to return the first, last, or all matching values | ||
| Occurrence occurrence; | ||
| }; | ||
| /// @} | ||
| /// \brief Get the absolute value of a value. | ||
| @@ -1350,5 +1374,20 @@ ARROW_EXPORT Result<Datum> AssumeTimezone(const Datum& values, | ||
| AssumeTimezoneOptions options, | ||
| ExecContext* ctx = NULLPTR); | ||
| /// \brief Finds either the FIRST, LAST, or ALL items with a key that matches the given | ||
| /// query key in a map. | ||
| /// | ||
| /// Returns an array of items for FIRST and LAST, and an array of list of items for ALL. | ||
| /// | ||
| /// \param[in] map to look in | ||
| /// \param[in] options to pass a query key and choose which matching keys to return | ||
| /// (FIRST, LAST or ALL) | ||
| /// \param[in] ctx the function execution context, optional | ||
| /// \return the resulting datum | ||
lidavidm marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /// | ||
| /// \since 8.0.0 | ||
| /// \note API not yet finalized | ||
| ARROW_EXPORT Result<Datum> MapLookup(const Datum& map, MapLookupOptions options, | ||
| ExecContext* ctx = NULLPTR); | ||
| } // namespace compute | ||
| } // namespace arrow | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.