westonpace commented on code in PR #41335:
URL: https://github.com/apache/arrow/pull/41335#discussion_r1598538825
##########
cpp/src/arrow/compute/key_hash_internal.h:
##########
@@ -161,6 +167,12 @@ class ARROW_EXPORT Hashing64 {
static void HashMultiColumn(const std::vector<KeyColumnArray>& cols,
LightContext* ctx,
uint64_t* hashes);
+ // Clarify the max temp stack usage for HashBatch so the caller could
reserve enough
+ // size in advance.
+ static constexpr auto kHashBatchTempStackUsage =
+ (sizeof(uint16_t) + sizeof(uint64_t) + /*extra=*/1) *
Review Comment:
Minor nit: but why does this constant have 2 `sizeof` calls in the
calculation but the previous constant has 3 `sizeof` calls?
##########
cpp/src/arrow/compute/row/compare_internal.h:
##########
@@ -32,6 +32,13 @@ namespace compute {
class ARROW_EXPORT KeyCompare {
public:
+ // Clarify the max temp stack usage for CompareColumnsToRows so the caller
could reserve
+ // enough size in advance.
+ constexpr static int64_t CompareColumnsToRowsTempStackUsage(int64_t
num_rows) {
+ return (sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint8_t)) * num_rows +
Review Comment:
Maybe add comments in these blocks explaining what each of the parts is?
Also, elsewhere we multiple by `kMiniBatchLength` but here it seems we are
adding `kMiniBatchLength`. Why the difference?
##########
cpp/src/arrow/compute/key_hash_internal.h:
##########
@@ -48,6 +48,12 @@ class ARROW_EXPORT Hashing32 {
static void HashMultiColumn(const std::vector<KeyColumnArray>& cols,
LightContext* ctx,
uint32_t* out_hash);
+ // Clarify the max temp stack usage for HashBatch so the caller could
reserve enough
+ // size in advance.
Review Comment:
I'm not sure I understand this comment.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]