Skip to content

Commit 343a25b

Browse files
alekjarmovcloud-fan
authored andcommitted
[SPARK-53868][SQL] Use array length check instead of direct reference check in V2ExpressionBuilder
### What changes were proposed in this pull request? apache#52573 here I did a slight refactor to `visitAggregate`, but I used direct reference check to compare arrays, this works as it's the same reference, but we should make the check more generic to any empty array. ### Why are the changes needed? If someone were to use different reference in CountStar it would fail, which is not the best behavior as any empty array shuold work. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#52587 from alekjarmov/improve-check. Authored-by: alekjarmov <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
1 parent 264ca4d commit 343a25b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ protected String visitSQLFunction(String funcName, String[] inputs) {
287287
protected String visitAggregateFunction(
288288
String funcName, boolean isDistinct, Expression[] inputs) {
289289
// CountStar has no children but should return with a star
290-
if (funcName.equals("COUNT") && inputs == Expression.EMPTY_EXPRESSION) {
290+
if (funcName.equals("COUNT") && inputs.length == 0) {
291291
return visitAggregateFunction(funcName, isDistinct, new String[]{"*"});
292292
}
293293
return visitAggregateFunction(funcName, isDistinct, expressionsToStringArray(inputs));

0 commit comments

Comments
 (0)