-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
GH-40280: [C++] Specialize ResolvedChunk::Value on value-specific types instead of entire class #40281
Conversation
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.
LGTM, thank you
// The target array in chunked array. | ||
const Array* array; | ||
// The index in the target array. | ||
const int64_t index; | ||
|
||
ResolvedChunk(const Array* array, int64_t index) : array(array), index(index) {} | ||
|
||
public: |
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.
I may misread, but I think we're already in a public section given that this is a struct?
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.
I mean to make it a class and the members private. I should have done it in this PR, but forgotten.
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.
I'm removing it in another PR now.
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 214378b. There was 1 benchmark result indicating a performance regression:
The full Conbench report has more details. It also includes information about 4 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…ic types instead of entire class (apache#40281) ### Rationale for this change Less template-specialization without any loss in efficiency. ### What changes are included in this PR? - `ChunkedResolver` tweak - Explicitly declare copy constructors of `ChunkedResolver` - at the moment they are necessary because `ChunkedArrayResolver` is copied in compute kernel code - Make `ChunkedArrayResolver` re-use `ChunkResolver` via composition instead of inheritance - This will allow the `ChunkResolver` API to evolve in ways that might not make sense if it's a sub-class of `ChunkedArrayResolver` - Use `std::enable_if` instead of duplicating the `ResolvedChunk` implementation and template-specializing - Only specialize `ResolvedChunk::Value` on value-type-specific types preserving the same type-safety checks (static and runtime) ### Are these changes tested? Yes, by existing tests. ### Are there any user-facing changes? No, because these are API are under the internal namespace at the moment even though there are plans to make it public. These changes are preparation for that if we end up making them public. * GitHub Issue: apache#40280 Authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com> Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Rationale for this change
Less template-specialization without any loss in efficiency.
What changes are included in this PR?
ChunkedResolver
tweakChunkedResolver
ChunkedArrayResolver
is copied in compute kernel codeChunkedArrayResolver
re-useChunkResolver
via composition instead of inheritanceChunkResolver
API to evolve in ways that might not make sense if it's a sub-class ofChunkedArrayResolver
std::enable_if
instead of duplicating theResolvedChunk
implementation and template-specializingResolvedChunk::Value
on value-type-specific types preserving the same type-safety checks (static and runtime)Are these changes tested?
Yes, by existing tests.
Are there any user-facing changes?
No, because these are API are under the internal namespace at the moment even though there are plans to make it public. These changes are preparation for that if we end up making them public.