Skip to content

Chore: Code hygiene - warn-numeric-widen - #2588

Closed
andy-hf-kwok wants to merge 10 commits into
apache:mainfrom
andy-hf-kwok:ft-hf-chore-numeric-widen
Closed

andy-hf-kwok wants to merge 10 commits into
apache:mainfrom
andy-hf-kwok:ft-hf-chore-numeric-widen

Conversation

@andy-hf-kwok

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

This PR aims to address the -Wnumeric-widen warning in the codebase.
As the overall scope of strict-warning compliance is quite large, this change focuses on resolving this specific warning type as a first step. Future PRs will continue addressing other warning incrementally.

Partially closes #. #2255

Rationale for this change

To clean up the code as per static check with the hope to resolve all warning and promote the restrict warning profile for the default CI build to uphold Scala code quality.

What changes are included in this PR?

To perform explicit type conversion instead of relying on runtime implicit cast.

How are these changes tested?

  • Code can now compile with -Wnumeric-widen option on.
  • CI continue to pass

@codecov-commenter

codecov-commenter commented Oct 16, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 58.45%. Comparing base (f09f8af) to head (4fa23a7).
⚠️ Report is 709 commits behind head on main.

Files with missing lines Patch % Lines
...e/spark/sql/comet/CometBroadcastExchangeExec.scala 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2588      +/-   ##
============================================
+ Coverage     56.12%   58.45%   +2.33%     
- Complexity      976     1456     +480     
============================================
  Files           119      159      +40     
  Lines         11743    13892    +2149     
  Branches       2251     2375     +124     
============================================
+ Hits           6591     8121    +1530     
- Misses         4012     4570     +558     
- Partials       1140     1201      +61     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pom.xml Resolved
record.add(0, i % 2 == 0)
record.add(1, i.toByte)
record.add(2, i.toShort)
record.add(1, i.toByte.toInt)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

its probably can be directly casted to int?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe overflow behaviour will be different and lead to unexpected and incorrect results

@andy-hf-kwok andy-hf-kwok Nov 8, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually I think if the test suite is mean to examine the behaviour when Byte or Short being passed, then we should keep it as it is.
I have reverted some .toInt on test suites for this purpose and add a suppression annotation instead.
@comphead @EmilyMatt

record.add(0, i % 2 == 0)
record.add(1, i.toByte)
record.add(2, i.toShort)
record.add(1, i.toByte.toInt)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same, can be probably converted directly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

see above reply, I believe in this case it's more appropriate to keep it as it is, so that we can assert the implicit conversation behaviour on test suites.

@andy-hf-kwok
andy-hf-kwok force-pushed the ft-hf-chore-numeric-widen branch from a1f1b3c to c1b4b86 Compare November 8, 2025 23:50
@andy-hf-kwok
andy-hf-kwok force-pushed the ft-hf-chore-numeric-widen branch from c047bd0 to 8712bde Compare November 8, 2025 23:56
@andy-hf-kwok

Copy link
Copy Markdown
Contributor Author

@comphead @mbutrovich I have removed some explicit conversions and added a suppression instead, as it seems more appropriate.
Would you mind to trigger the CI for this PR?
Thx!

@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Feb 12, 2026
@github-actions github-actions Bot closed this Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants