You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "fangchenli (via GitHub)" <gi...@apache.org> on 2026/06/18 23:17:48 UTC
[PR] [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
fangchenli opened a new pull request, #50224:
URL: https://github.com/apache/arrow/pull/50224
### Rationale for this change
Grouper rejected `string_view` and `binary_view` group keys with `NotImplemented: Keys of type string_view`, so `Table.group_by` on a view-typed key failed.
### What changes are included in this PR?
- Add `BinaryViewKeyEncoder` in `row_encoder_internal.{h,cc}`. It encodes view keys using the existing variable-length row format and decodes them into a fresh view array of the original type.
- `GrouperImpl::Make` dispatches view keys to the new encoder.
- `GrouperFastImpl::CanUse` rejects view keys, so they fall back to GrouperImpl.
### Are these changes tested?
Yes, unit tests added.
### Are there any user-facing changes?
Yes. `Table.group_by` now accepts `string_view` and `binary_view` group keys
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #50224:
URL: https://github.com/apache/arrow/pull/50224#issuecomment-4797791626
@zanmato1984 Do you also want to take a look at this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "zanmato1984 (via GitHub)" <gi...@apache.org>.
zanmato1984 commented on PR #50224:
URL: https://github.com/apache/arrow/pull/50224#issuecomment-4800643173
I can look into this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #50224:
URL: https://github.com/apache/arrow/pull/50224#issuecomment-4911962276
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 723937960de67dd62fbf4e6dfeff590efe19ecdd.
There were no benchmark performance regressions. 🎉
The [full Conbench report](https://github.com/apache/arrow/runs/85801775848) has more details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #50224:
URL: https://github.com/apache/arrow/pull/50224#issuecomment-4746933092
:warning: GitHub issue #50223 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #50224:
URL: https://github.com/apache/arrow/pull/50224#issuecomment-4746917511
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
See also:
* [Other pull requests](https://github.com/apache/arrow/pulls/)
* [Contribution Guidelines - Contributing Overview](https://arrow.apache.org/docs/developers/overview.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #50224:
URL: https://github.com/apache/arrow/pull/50224#discussion_r3473298339
##########
cpp/src/arrow/compute/row/row_encoder_internal.h:
##########
@@ -252,6 +252,31 @@ struct VarLengthKeyEncoder : KeyEncoder {
std::shared_ptr<DataType> type_;
};
+// Encodes BinaryView/StringView keys in the same variable-length row format as
+// VarLengthKeyEncoder. The encoded row copies the key bytes, so Decode builds a
+// fresh view array rather than aliasing the input's variadic buffers.
Review Comment:
Since the encode path is the same as for `VarLengthKeyEncoder` (only the decoding differs), can we factor out the encoding methods in a common base class?
##########
cpp/src/arrow/compute/row/grouper_test.cc:
##########
@@ -913,6 +927,42 @@ TEST(Grouper, StringKey) {
}
}
+TEST(Grouper, StringViewKey) {
+ // Mix inline (<=12 byte) and out-of-line view keys.
+ for (auto ty : {utf8_view(), binary_view()}) {
+ ARROW_SCOPED_TRACE("key type = ", *ty);
+ {
+ TestGrouper g({ty});
+ g.ExpectConsume(R"([["eh"], ["eh"]])", "[0, 0]");
+ g.ExpectConsume(R"([["eh"], ["eh"]])", "[0, 0]");
+ g.ExpectConsume(R"([["be"], [null]])", "[1, 2]");
+ g.ExpectConsume(R"([["a long out-of-line view"], ["a long out-of-line view"]])",
+ "[3, 3]");
+ g.ExpectUniques(R"([["eh"], ["be"], [null], ["a long out-of-line view"]])");
Review Comment:
Test with several different out-of-line views as well?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-50223: [C++][Compute] Support string_view/binary_view keys in the hash-aggregate Grouper [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou merged PR #50224:
URL: https://github.com/apache/arrow/pull/50224
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org