diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/catalog/functions/transformFunctions.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/catalog/functions/transformFunctions.scala index c4207fd3e0920..5cdb900901056 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/catalog/functions/transformFunctions.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/catalog/functions/transformFunctions.scala @@ -92,20 +92,12 @@ object BucketFunction extends ScalarFunction[Int] with ReducibleFunction[Int, In otherNumBuckets: Int): Reducer[Int, Int] = { if (otherFunc == BucketFunction) { - if ((thisNumBuckets > otherNumBuckets) - && (thisNumBuckets % otherNumBuckets == 0)) { - BucketReducer(thisNumBuckets, otherNumBuckets) - } else { - val gcd = this.gcd(thisNumBuckets, otherNumBuckets) - if (gcd != thisNumBuckets) { - BucketReducer(thisNumBuckets, gcd) - } else { - null - } + val gcd = this.gcd(thisNumBuckets, otherNumBuckets) + if (gcd != thisNumBuckets) { + return BucketReducer(thisNumBuckets, gcd) } - } else { - null } + null } private def gcd(a: Int, b: Int): Int = BigInt(a).gcd(BigInt(b)).toInt