Skip to content

Minor cleanups in SqlFormatter#9501

Merged
losipiuk merged 1 commit intotrinodb:masterfrom
losipiuk:lo/indent-checks
Oct 11, 2021
Merged

Minor cleanups in SqlFormatter#9501
losipiuk merged 1 commit intotrinodb:masterfrom
losipiuk:lo/indent-checks

Conversation

@losipiuk
Copy link
Member

@losipiuk losipiuk commented Oct 5, 2021

No description provided.

@martint
Copy link
Member

martint commented Oct 5, 2021

What’s the purpose of those assertions? Indent can’t be anything other than 0 already, since that’s how the visitor gets called in the first place, and it’s private to this class, so it can’t be misused.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkArgument? (and below)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Sequence of private methods fooled me. We are already past public interface.

@losipiuk
Copy link
Member Author

losipiuk commented Oct 6, 2021

What’s the purpose of those assertions? Indent can’t be anything other than 0 already, since that’s how the visitor gets called in the first place, and it’s private to this class, so it can’t be misused.

Just a sanity check. It is not obvious from the code flow that we can not land in the visitXXX method which ignores indent param as a result of calling out to process(currentNode.getSomething(), indent + 1).
If that would be the case we would end up with misformatted SQL - having an error is better IMO.

@losipiuk
Copy link
Member Author

I dropped checks as thy do play well with PREPARE ...

@losipiuk losipiuk merged commit 60eb474 into trinodb:master Oct 11, 2021
@github-actions github-actions bot added this to the 364 milestone Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants