Fix JDBC parser parameter counting for empty comments and SELECT * EXCEPT - #3067
Open
n200534 wants to merge 1 commit into
Open
Fix JDBC parser parameter counting for empty comments and SELECT * EXCEPT#3067n200534 wants to merge 1 commit into
n200534 wants to merge 1 commit into
Conversation
n200534
marked this pull request as ready for review
August 19, 2026 22:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--is followed immediately by a newline, so later JDBC parameter markers are still discoveredSELECT * EXCEPT (...), including identifier-list and regular-expression formsSELECT * EXCEPT (...)across all three SQL parser backendsCHANGELOG.mdCloses #3052
Root cause
ClickHouseUtils.skipSingleLineCommenttreated a newline located exactly at its start index as if no newline existed, causing the parameter scanner to skip the rest of the SQL. Separately, the bundled ANTLR4 grammar accepted*in a select list but did not model ClickHouse'sEXCEPTmodifier, so the parse-tree-based backend never reached a later?marker.User impact and compatibility
Prepared statements containing either construct now report the correct parameter count and can bind normally instead of failing with
ArrayIndexOutOfBoundsException. This does not change public APIs, configuration, wire protocols, or binary compatibility.Validation
mvn -pl jdbc-v2 -am -DskipTests install— passed under JDK 17mvn -pl jdbc-v2 test— 1,331 tests passedmvn -pl clickhouse-data test— 1,554 tests passed, 113 conditionally skipped, 0 failures/errorsChecklist
--comment;SELECT * EXCEPT (...)), causing ArrayIndexOutOfBoundsException on bind #3052