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

[BugFix] fix setDouble issue in jdbc with prepare stmt #51811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ShaoxunLi
Copy link
Contributor

@ShaoxunLi ShaoxunLi commented Oct 11, 2024

Why I'm doing:

fix setDouble issue in jdbc with prepare stmt:
image

the result is wrong:
image

the reason is wrong type processing in FloatLiteral::parseMysqlParam.
For example, the data is of double type, but the getFloat method is used to obtain the data, result in wrong value.

What I'm doing:

When a new floatLiteral object is created, its type should be specified explicitly, not based on its numeric size.
Otherwise, when the data is small, it will be processed as the float type, even if the value is assigned by setDouble method in JDBC.

image

ths result is right:
image

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

satanson
satanson previously approved these changes Oct 12, 2024
LiShuMing
LiShuMing previously approved these changes Oct 12, 2024
@satanson satanson enabled auto-merge (squash) October 12, 2024 06:22
@ShaoxunLi ShaoxunLi changed the title [Bugfix] fix setDouble issue in jdbc with prepare stmt [BugFix] fix setDouble issue in jdbc with prepare stmt Oct 12, 2024
auto-merge was automatically disabled October 12, 2024 09:16

Head branch was pushed to by a user without write access

@ShaoxunLi ShaoxunLi dismissed stale reviews from LiShuMing and satanson via 3f409d0 October 12, 2024 09:16
@ShaoxunLi ShaoxunLi force-pushed the fix_set_double branch 3 times, most recently from e5eab85 to 631836c Compare October 12, 2024 09:39
@ShaoxunLi
Copy link
Contributor Author

ShaoxunLi commented Oct 12, 2024

AnalysisException is deprecated, but the old method returns this exception.
How can I solve the codecheck error? @LiShuMing @satanson Thanks
image

@LiShuMing
Copy link
Contributor

AnalysisException is deprecated, but the old method returns this exception. How can I solve the codecheck error? @LiShuMing @satanson Thanks image

  1. This should not affect this PR, right? This is just a reminder from your IDE?
  2. Since AnalysisException is Deprecated, SemanticException is preferred in the future. But there are a lot of old codes left which are not changed.

@ShaoxunLi
Copy link
Contributor Author

ShaoxunLi commented Oct 14, 2024

AnalysisException is deprecated, but the old method returns this exception. How can I solve the codecheck error? @LiShuMing @satanson Thanks image

  1. This should not affect this PR, right? This is just a reminder from your IDE?
  2. Since AnalysisException is Deprecated, SemanticException is preferred in the future. But there are a lot of old codes left which are not changed.

It causes an error from SonarCloud Code Analysis:
image

and using SemanticException here will lead to lots of code changes

@satanson
Copy link
Contributor

AnalysisException is deprecated, but the old method returns this exception. How can I solve the codecheck error? @LiShuMing @satanson Thanks image

  1. This should not affect this PR, right? This is just a reminder from your IDE?
  2. Since AnalysisException is Deprecated, SemanticException is preferred in the future. But there are a lot of old codes left which are not changed.

The picture is invisible. errors reported by SonarCloud can be ignored

@ShaoxunLi
Copy link
Contributor Author

AnalysisException is deprecated, but the old method returns this exception. How can I solve the codecheck error? @LiShuMing @satanson Thanks image

  1. This should not affect this PR, right? This is just a reminder from your IDE?
  2. Since AnalysisException is Deprecated, SemanticException is preferred in the future. But there are a lot of old codes left which are not changed.

The picture is invisible. errors reported by SonarCloud can be ignored

ok,thank you
There seems to be some unstable test cases, i‘ll re-trigger the CI

@ShaoxunLi ShaoxunLi force-pushed the fix_set_double branch 4 times, most recently from 2a4178a to f0959f7 Compare October 14, 2024 07:25
Copy link

sonarcloud bot commented Oct 14, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 4 / 4 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/analysis/LiteralExpr.java 1 1 100.00% []
🔵 com/starrocks/analysis/FloatLiteral.java 3 3 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

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.

3 participants