mbutrovich commented on code in PR #21468:
URL: https://github.com/apache/datafusion/pull/21468#discussion_r3065352325
##########
datafusion/functions/src/math/gcd.rs:
##########
@@ -126,18 +126,23 @@ fn compute_gcd_for_arrays(a: &ArrayRef, b: &ArrayRef) ->
Result<ColumnarValue> {
}
fn compute_gcd_with_scalar(arr: &ArrayRef, scalar: Option<i64>) ->
Result<ColumnarValue> {
+ let prim = arr.as_primitive::<Int64Type>();
match scalar {
+ Some(scalar_value) if scalar_value != 0 && scalar_value != i64::MIN =>
{
+ // The gcd result divides both inputs' absolute values. When the
Review Comment:
This is a slick optimization.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]