This is an automated email from the ASF dual-hosted git repository.
wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 343a25b72b22 [SPARK-53868][SQL] Use array length check instead of
direct reference check in V2ExpressionBuilder
343a25b72b22 is described below
commit 343a25b72b220c2ac0c94730f1bd3887d2dc6d51
Author: alekjarmov <[email protected]>
AuthorDate: Mon Oct 13 23:13:57 2025 +0800
[SPARK-53868][SQL] Use array length check instead of direct reference check
in V2ExpressionBuilder
### What changes were proposed in this pull request?
https://github.com/apache/spark/pull/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 #52587 from alekjarmov/improve-check.
Authored-by: alekjarmov <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
---
.../org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java
index 877cf3dd765c..e3b875469169 100644
---
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java
+++
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java
@@ -287,7 +287,7 @@ public class V2ExpressionSQLBuilder {
protected String visitAggregateFunction(
String funcName, boolean isDistinct, Expression[] inputs) {
// CountStar has no children but should return with a star
- if (funcName.equals("COUNT") && inputs == Expression.EMPTY_EXPRESSION) {
+ if (funcName.equals("COUNT") && inputs.length == 0) {
return visitAggregateFunction(funcName, isDistinct, new String[]{"*"});
}
return visitAggregateFunction(funcName, isDistinct,
expressionsToStringArray(inputs));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]