This is an automated email from the ASF dual-hosted git repository.
uros-b pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new ade7ae075403 [MINOR][SQL] Simplify redundant boolean ternary in
visitDeclareCursorStatement
ade7ae075403 is described below
commit ade7ae0754036f7ae9961f02d24cc5abd71ce9ff
Author: Uros Bojanic <[email protected]>
AuthorDate: Tue Jul 28 10:10:14 2026 +0000
[MINOR][SQL] Simplify redundant boolean ternary in
visitDeclareCursorStatement
### What changes were proposed in this pull request?
Simplifies a redundant boolean ternary in `visitDeclareCursorStatement`:
`if (ctx.INSENSITIVE() != null) false else true` becomes `ctx.INSENSITIVE() ==
null`.
### Why are the changes needed?
The ternary maps a null check to a negated boolean; the direct comparison
has the identical truth table and reads more clearly (asensitive is true
exactly when the INSENSITIVE token is absent).
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Behavior-preserving one-line simplification; existing parser tests cover
it. No new tests needed.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
Closes #57595 from uros-b/refactor-declarecursor-boolean.
Lead-authored-by: Uros Bojanic <[email protected]>
Co-authored-by: Uros Bojanic <[email protected]>
Signed-off-by: Uros Bojanic <[email protected]>
(cherry picked from commit a6c3eb21763fb6196a150087672aa7437e8a8bda)
Signed-off-by: Uros Bojanic <[email protected]>
---
.../main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
index 5febb00e7cd9..262c0882138e 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
@@ -7786,7 +7786,7 @@ class AstBuilder extends DataTypeAstBuilder
// Extract original SQL text to preserve parameter markers
val queryText = getOriginalText(ctx.query())
- val asensitive = if (ctx.INSENSITIVE() != null) false else true
+ val asensitive = ctx.INSENSITIVE() == null
DeclareCursor(cursorName, queryText, asensitive)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]