Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-11860 fixed bug in ResultSetRecordSet affecting decimalScale whe… #7545

Closed
wants to merge 1 commit into from

Conversation

TamasNeumer
Copy link

@TamasNeumer TamasNeumer commented Jul 31, 2023

…n resultSetScale was zero.

Summary

NIFI-11860

Tracking

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
  • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for addressing this issue @TamasNeumer.

In light of the extensive usage of this class, did you consider adding or a modifying a unit test to verify the corrected behavior? There are a number of existing unit tests in ResultSetRecordSetTest that should provide a helpful starting point.

Copy link
Contributor

@pgyori pgyori left a comment

Choose a reason for hiding this comment

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

I agree with the change.
I checked the PR for https://issues.apache.org/jira/browse/NIFI-3958 and it makes sense to comply with the behavior of JdbcCommon class.
I would also encourage adding a test case where the default scale is > 0 and the DB returns scale = 0.

@mattyb149
Copy link
Contributor

I agree with the change and the request for a unit test to illustrate this. I will merge once the unit test is in place.

@TamasNeumer
Copy link
Author

Thanks, I will add the test tomorrow and let you know.

@TamasNeumer
Copy link
Author

TamasNeumer commented Aug 2, 2023

@pgyori

When creating the ResultSetRecordSet object, the default defaultScale was 0.
Previously if the resultSetScale was 0 then the default (0) defaultScale was applied.

Therefore I created a new test (testCreateSchemaWhenScaleIsNonDefault), where the scale is set. With the old code (decimalScale = resultSetScale > 0 ? resultSetScale : defaultScale;) the test fails, whereas with the fix (decimalScale = resultSetScale >= 0 ? resultSetScale : defaultScale;) it passes.

I hope this is sufficient.

@mattyb149
Copy link
Contributor

+1 LGTM, thanks for the fix! Merging to main and support/nifi-1.x

@mattyb149 mattyb149 closed this in 80e7106 Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants