Skip to content

API: Convert statement switches to arrow switches - #17534

Closed
uros-b wants to merge 1 commit into
apache:mainfrom
uros-b:api-convert-statement-switch-to-arrow-switch
Closed

uros-b wants to merge 1 commit into
apache:mainfrom
uros-b:api-convert-statement-switch-to-arrow-switch

Conversation

@uros-b

@uros-b uros-b commented Aug 5, 2026

Copy link
Copy Markdown
Member

Converts the statement-form switch blocks in iceberg-api to expression form, clearing the 89 StatementSwitchToExpressionSwitch ErrorProne warnings the module emits and removing the risk of accidental fall-through in the converted code.

Converts the statement-form switch blocks in iceberg-api to expression
form, clearing the 89 StatementSwitchToExpressionSwitch ErrorProne
warnings the module emits and removing the risk of accidental
fall-through in the converted code.
@github-actions github-actions Bot added the API label Aug 5, 2026

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I first spotted this in api/src/main/java/org/apache/iceberg/types/TypeUtil.java, but after a full API module sweep, it seems there are many occurrences... Perhaps this can be split up into a few PRs instead of doing all at once; or if it's too invasive, we can drop the changes altogether - WDYT @szehon-ho?

@uros-b

uros-b commented Aug 16, 2026

Copy link
Copy Markdown
Member Author

cc @huaxingao

@uros-b

uros-b commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

cc @nastra

@nssalian

Copy link
Copy Markdown
Collaborator

#16881 did this and we reverted based on the discussion that we should do this individually as PRs go in rather than 1 full sweep.

@uros-b

uros-b commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

Thank you @nssalian, I agree and this was my concern above as well. How about splitting into per-package PRs so that each is smaller and independently reviewable/revertible, rather than one big sweep (like the current PR)? Please see these 5 PRs: #17729, #17730, #17731, #17732, #17733.

@uros-b

uros-b commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@nssalian do you have any thoughts about the alternative approach with a couple of PRs? the aim is to eventually reach a holistic state of improved code across the repo, but we don't have to do all at once, we can do it in parts instead

@uros-b

uros-b commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

cc @szehon-ho

@nssalian

nssalian commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@uros-b The community consensus in the other PR I mentioned is that we don't create one-off PRs for these changes, since they're sometimes cosmetic and touch a large surface area of code at once. My understanding was that these changes would go in as part of other PRs that might be features/bug fixes, and reviewers would use their discretion while reviewing and merging. I'll defer to @szehon-ho and @RussellSpitzer

@uros-b

uros-b commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Thank you for the input @nssalian, I don't have any strong opinion here, just looking for the best way to scope clearing the 89 existing StatementSwitchToExpressionSwitch ErrorProne warnings, let's get committer's opinion here as well

@uros-b

uros-b commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

On another note, these are already big changes touching a lot of files, so I'm not sure whether mixing them with feature work would really help... I think that would probably make it even more messy.

Also, I would be happy to close these PRs if the maintainers suggest so, but in that case - why don't we also disable the StatementSwitchToExpressionSwitch warnings?

Right now it seems like a bit of a conundrum, we have repo wide warnings in place for a known issue that we're not acting on. Seems like we should be able to figure out a good way forward to either resolve these warnings or get rid of them

@nssalian

nssalian commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

On another note, these are already big changes touching a lot of files, so I'm not sure whether mixing them with feature work would really help... I think that would probably make it even more messy.

I should clarify: I meant modifying just the surface of the code that new features/ fixes add. Not addressing all at once. Again, this was left to reviewer/maintainer discretion while reviewing the code changes. The whole idea was not to do this in one go. I don't think there was objection to doing the changes themselves.

Also, I would be happy to close these PRs if the maintainers suggest so, but in that case - why don't we also disable the StatementSwitchToExpressionSwitch warnings?

This might be a good intermediate solution. I do think we should do a pass and figure out how to add newer JDK features - records, switch statements as a community overall, but that's a larger discussion. @uros-b there are past threads on this; feel free to restart them or start a new topic so we can discuss it on the mailing list.

@uros-b

uros-b commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@RussellSpitzer @szehon-ho what are your thoughts here?

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants