kszucs commented on code in PR #45001:
URL: https://github.com/apache/arrow/pull/45001#discussion_r3969124718


##########
cpp/src/arrow/compute/api_scalar.h:
##########
@@ -1807,5 +1807,46 @@ ARROW_EXPORT Result<Datum> NanosecondsBetween(const 
Datum& left, const Datum& ri
 /// \note API not yet finalized
 ARROW_EXPORT Result<Datum> MapLookup(const Datum& map, MapLookupOptions 
options,
                                      ExecContext* ctx = NULLPTR);
+
+/// \brief Construct a hash value for each row of the input.
+///
+/// The result has the same length and shape as the input (Array in, Array out;
+/// ChunkedArray in, ChunkedArray out), but with element type UInt32. For a 
nested
+/// input type (struct, list, map, etc.), each row's child values are combined 
into a
+/// single hash for that row, recursively. A null input row produces a null 
output row;
+/// within a struct, a null field makes that whole row null, while within a 
list or map a
+/// null element does not (only the row's own validity matters there). Hash 
values are not
+/// guaranteed to be stable across different versions of the library, and this 
function
+/// does not currently take options, though these may be added in the future.
+///
+/// \param[in] input_array input data to hash
+/// \param[in] ctx function execution context, optional
+/// \return elementwise hash values
+///
+/// \since 26.0.0
+/// \note API not yet finalized
+ARROW_EXPORT
+Result<Datum> Hash32(const Datum& input_array, ExecContext* ctx = NULLPTR);
+
+/// \brief Construct a hash value for each row of the input.
+///
+/// The result has the same length and shape as the input (Array in, Array out;
+/// ChunkedArray in, ChunkedArray out), but with element type UInt64. For a 
nested

Review Comment:
   Fixed in 80c4abf2cd — both docstrings now read "Scalar in, Scalar out; Array 
in, Array out; ChunkedArray in, ChunkedArray out".



##########
docs/source/cpp/compute.rst:
##########
@@ -1282,6 +1282,27 @@ Containment tests
 * \(8) Output is true iff :member:`MatchSubstringOptions::pattern`
   matches the corresponding input element at any position.
 
+Hash Functions
+~~~~~~~~~~~~~~
+
+Not to be confused with the "group by" functions, hash functions produce an 
array of hash
+values corresponding to the length of the input. Currently, these functions 
take a single
+array as input.

Review Comment:
   Fixed in 80c4abf2cd — the section now states the result matches the 
argument's shape for all three Datum kinds instead of claiming array-only 
input. The chunked shape had no test either, so I added `ChunkedArrayInput` 
alongside it.



-- 
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]

Reply via email to