-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-17966: [C++] Adjust to new format for Substrait optional arguments #14415
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
Merged
westonpace
merged 14 commits into
apache:master
from
westonpace:feature/ARROW-17966--dont-require-optional-args
Nov 25, 2022
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f52939a
ARROW-17966: Updated to latest Substrait version. Switched from opti…
westonpace 8523535
ARROW-17966: Add version to python substrait examples. Fix version h…
westonpace 5c123c1
ARROW-17966: Update cpp/src/arrow/engine/substrait/extension_set.cc
westonpace 3596a7d
ARROW-17966: Update cpp/src/arrow/engine/substrait/extension_set.cc
westonpace 2b99035
ARROW-17966: Update cpp/src/arrow/engine/substrait/extension_set.cc
westonpace d1c44fb
ARROW-17966: Update cpp/src/arrow/engine/substrait/extension_set.cc
westonpace 988dcd2
ARROW-17966: Display the available choices when a user enters a valid…
westonpace 45e7fb3
ARROW-17966: Simplify parsing boilerplate per review comments
westonpace a6dac84
ARROW-17966: Gracefully error if the user does not supply any prefere…
westonpace 3446801
ARROW-17966: Prefer range loops where possible
westonpace e2da03b
ARROW-17966: Rebase cleanup
westonpace e642091
ARROW-17966: Minor fix to failing unit tests: remove enum="unspecified"
bkietz 5e01780
ARROW-17966: Switched from temp substrait hard-coded hash to version …
westonpace be691d4
ARROW-17966: Adjusted newly added functions after rebase
westonpace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |||||||||||||||||||||
| #include "arrow/engine/substrait/expression_internal.h" | ||||||||||||||||||||||
| #include "arrow/util/hash_util.h" | ||||||||||||||||||||||
| #include "arrow/util/hashing.h" | ||||||||||||||||||||||
| #include "arrow/util/string.h" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| namespace arrow { | ||||||||||||||||||||||
| namespace engine { | ||||||||||||||||||||||
|
|
@@ -121,7 +122,7 @@ class IdStorageImpl : public IdStorage { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| std::unique_ptr<IdStorage> IdStorage::Make() { return std::make_unique<IdStorageImpl>(); } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Result<std::optional<std::string_view>> SubstraitCall::GetEnumArg(uint32_t index) const { | ||||||||||||||||||||||
| Result<std::string_view> SubstraitCall::GetEnumArg(int index) const { | ||||||||||||||||||||||
| if (index >= size_) { | ||||||||||||||||||||||
| return Status::Invalid("Expected Substrait call to have an enum argument at index ", | ||||||||||||||||||||||
| index, " but it did not have enough arguments"); | ||||||||||||||||||||||
|
|
@@ -134,16 +135,16 @@ Result<std::optional<std::string_view>> SubstraitCall::GetEnumArg(uint32_t index | |||||||||||||||||||||
| return enum_arg_it->second; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| bool SubstraitCall::HasEnumArg(uint32_t index) const { | ||||||||||||||||||||||
| bool SubstraitCall::HasEnumArg(int index) const { | ||||||||||||||||||||||
| return enum_args_.find(index) != enum_args_.end(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| void SubstraitCall::SetEnumArg(uint32_t index, std::optional<std::string> enum_arg) { | ||||||||||||||||||||||
| void SubstraitCall::SetEnumArg(int index, std::string enum_arg) { | ||||||||||||||||||||||
| size_ = std::max(size_, index + 1); | ||||||||||||||||||||||
| enum_args_[index] = std::move(enum_arg); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Result<compute::Expression> SubstraitCall::GetValueArg(uint32_t index) const { | ||||||||||||||||||||||
| Result<compute::Expression> SubstraitCall::GetValueArg(int index) const { | ||||||||||||||||||||||
| if (index >= size_) { | ||||||||||||||||||||||
| return Status::Invalid("Expected Substrait call to have a value argument at index ", | ||||||||||||||||||||||
| index, " but it did not have enough arguments"); | ||||||||||||||||||||||
|
|
@@ -156,15 +157,32 @@ Result<compute::Expression> SubstraitCall::GetValueArg(uint32_t index) const { | |||||||||||||||||||||
| return value_arg_it->second; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| bool SubstraitCall::HasValueArg(uint32_t index) const { | ||||||||||||||||||||||
| bool SubstraitCall::HasValueArg(int index) const { | ||||||||||||||||||||||
| return value_args_.find(index) != value_args_.end(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| void SubstraitCall::SetValueArg(uint32_t index, compute::Expression value_arg) { | ||||||||||||||||||||||
| void SubstraitCall::SetValueArg(int index, compute::Expression value_arg) { | ||||||||||||||||||||||
| size_ = std::max(size_, index + 1); | ||||||||||||||||||||||
| value_args_[index] = std::move(value_arg); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| std::optional<std::vector<std::string> const*> SubstraitCall::GetOption( | ||||||||||||||||||||||
| std::string_view option_name) const { | ||||||||||||||||||||||
| auto opt = options_.find(std::string(option_name)); | ||||||||||||||||||||||
| if (opt == options_.end()) { | ||||||||||||||||||||||
| return std::nullopt; | ||||||||||||||||||||||
|
||||||||||||||||||||||
| std::optional<std::vector<std::string> const*> SubstraitCall::GetOption( | |
| std::string_view option_name) const { | |
| auto opt = options_.find(std::string(option_name)); | |
| if (opt == options_.end()) { | |
| return std::nullopt; | |
| const std::vector<std::string>* SubstraitCall::GetOption( | |
| std::string_view option_name) const { | |
| auto opt = options_.find(std::string(option_name)); | |
| if (opt == options_.end()) { | |
| return nullptr; |
bkietz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
bkietz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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
Oops, something went wrong.
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.