Skip to content

Fix DISTINCT traversal and share optional select-item visits - #2577

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/distinct-visitor
Sep 11, 2026
Merged

Fix DISTINCT traversal and share optional select-item visits#2577
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/distinct-visitor

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

SELECT DISTINCT id FROM foo throws a NullPointerException when visited or classified with getFeatures(), because ordinary DISTINCT has no ON list.

Share the null-safe select-item traversal used by DISTINCT ON, the SELECT list and OUTPUT. Preserve callback order and context, and leave the AST unchanged so ordinary DISTINCT cannot become DISTINCT ON ().

Validation: full Gradle check and Maven verify; plain, nested and CTE DISTINCT, DISTINCT ON/ALL controls, feature classification, model/deparser output, and custom SELECT/OUTPUT callbacks.

Fixes #2573.

@manticore-projects
manticore-projects merged commit db61f4b into JSQLParser:master Sep 11, 2026
9 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you for fixing this so fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Statement.getFeatures() throws NullPointerException on plain SELECT DISTINCT

2 participants