Skip to content

[CALCITE-5651] Inferred scale for decimal should not exceed maximum allowed scale#3156

Merged
rubenada merged 1 commit into
apache:mainfrom
mihaibudiu:issue5651
Apr 21, 2023
Merged

[CALCITE-5651] Inferred scale for decimal should not exceed maximum allowed scale#3156
rubenada merged 1 commit into
apache:mainfrom
mihaibudiu:issue5651

Conversation

@mihaibudiu
Copy link
Copy Markdown
Contributor

This PR includes the fix in #3155 as well, because it depends on it.

@rubenada rubenada self-assigned this Apr 17, 2023
@rubenada
Copy link
Copy Markdown
Contributor

@mbudiu-vmw I think the PR makes sense. There are some style errors though, could you please take care of them?

int maxScale = factory.getTypeSystem().getMaxNumericScale();
// scale should not greater than precision.
int scale = maxPrecision / 2;
int scale = Math.min(maxPrecision / 2, maxScale);
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.

Personally I think that the choice of maxPrecision/2 is rather arbitrary, but I didn't want to change too many things at once. This used to be maxScale, and that should always be smaller than maxPrecision.

@mihaibudiu mihaibudiu force-pushed the issue5651 branch 2 times, most recently from 3650f79 to 6ec977a Compare April 17, 2023 21:48
@zabetak
Copy link
Copy Markdown
Member

zabetak commented Apr 18, 2023

@mbudiu-vmw Small tip: it's better to avoid force-pushes after a review has started cause it makes review history hard to follow; no big deal for this change but it can be a pain in larger changes.

@rubenada rubenada added LGTM-will-merge-soon Overall PR looks OK. Only minor things left. and removed LGTM-will-merge-soon Overall PR looks OK. Only minor things left. labels Apr 18, 2023
@rubenada
Copy link
Copy Markdown
Contributor

@zabetak this PR needs CALCITE-5650; if I understand correctly, you plan to take care of that, so I'll pause the merge of the current PR until then, ok?

@zabetak
Copy link
Copy Markdown
Member

zabetak commented Apr 18, 2023

@rubenada Sounds good let's do that!

@rubenada
Copy link
Copy Markdown
Contributor

CALCITE-5650; has been merged (thanks @zabetak); @mbudiu-vmw could you please revisit this PR?

@mihaibudiu
Copy link
Copy Markdown
Contributor Author

I have rebased. How does one run the style checkers locally before submission?
I couldn't find this in the https://calcite.apache.org/develop/#contributing guidelines.

@rubenada
Copy link
Copy Markdown
Contributor

I have rebased. How does one run the style checkers locally before submission? I couldn't find this in the https://calcite.apache.org/develop/#contributing guidelines.

If I am not mistaken a local gradlew build should include the verification of the code style

@rubenada
Copy link
Copy Markdown
Contributor

LGTM.
Thanks @mbudiu-vmw for rebasing. Could you please amend the commit message to simply its ticket number and title: [CALCITE-5651] Inferred scale for decimal should not exceed maximum allowed scale ?

@rubenada rubenada added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Apr 20, 2023
@mihaibudiu
Copy link
Copy Markdown
Contributor Author

Changed the commit message.

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@rubenada rubenada merged commit 1fe1ce8 into apache:main Apr 21, 2023
@mihaibudiu mihaibudiu deleted the issue5651 branch December 6, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants