cayenne
cayenne copied to clipboard
CAY-2847 Improve duplicate select column detection when using order by
The current implementation has three problems:
- It fails when a column has an alias
- It builds the whole SQL column string before comparing
- It doesn't seem very robust in preventing false results
This PR replaces the current implementation with a visitor pattern that fails fast. The visitor extracts each node's parts into a List which is progressively compared to the parts extracted from the order node. Each item must match in position and content in both lists for them to match and will abort comparing as soon as possible.