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
GH-41329: [C++][Gandiva] Fix gandiva cache size env var#41330
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
73f3603156bb1d7f712fd78e7640915d731064bb78fdca72d77a71a7032169e869945ed3aa5e90b491bceaaa659File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -20,14 +20,27 @@ | ||
| #include <cstdlib> | ||
| #include <mutex> | ||
| #include "arrow/util/macros.h" | ||
| #include "gandiva/lru_cache.h" | ||
| #include "gandiva/visibility.h" | ||
| namespace gandiva { | ||
| namespace internal { | ||
| // Only called once by GetCacheCapacity(). | ||
| // Do the actual work of getting the cache capacity from env var. | ||
| // Also makes the testing easier. | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not possible in google test to re-initialize a static variable. So have this dedicated function to do the actual work eagerly, then we can test it instead of | ||
| GANDIVA_EXPORT | ||
| int GetCacheCapacityFromEnvVar(); | ||
| } // namespace internal | ||
| ARROW_DEPRECATED("Deprecated in 17.0.0. Use GetCacheCapacity instead.") | ||
| GANDIVA_EXPORT | ||
| int GetCapacity(); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be called ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it can. But is this public API? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea :-) You could deprecate the old API if we want to ensure a smoother migration. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed with deprecating old API and adding renamed one. | ||
| GANDIVA_EXPORT | ||
| int GetCacheCapacity(); | ||
| GANDIVA_EXPORT | ||
| void LogCacheSize(size_t capacity); | ||
| @@ -36,7 +49,7 @@ class Cache { | ||
| public: | ||
| explicit Cache(size_t capacity) : cache_(capacity) { LogCacheSize(capacity); } | ||
| Cache() : Cache(GetCapacity()) {} | ||
| Cache() : Cache(GetCacheCapacity()) {} | ||
| ValueType GetObjectCode(const KeyType& cache_key) { | ||
| std::optional<ValueType> result; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the parsing according to the recommendation from #41335 (comment)