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

[KYUUBI #670] KyuubiSQLException support sqlState and errorCode #674

Closed
wants to merge 3 commits into from

Conversation

pan3793
Copy link
Member

@pan3793 pan3793 commented Jun 8, 2021

Why are the changes needed?

#670

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@pan3793 pan3793 self-assigned this Jun 8, 2021
@pan3793 pan3793 added the enhance label Jun 8, 2021
@pan3793 pan3793 added this to the v1.3.0 milestone Jun 8, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2021

Codecov Report

Merging #674 (e0808bc) into master (e57a434) will increase coverage by 0.30%.
The diff coverage is 100.00%.

❗ Current head e0808bc differs from pull request most recent head 08c9591. Consider uploading reports for the commit 08c9591 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #674      +/-   ##
==========================================
+ Coverage   80.10%   80.41%   +0.30%     
==========================================
  Files         120      120              
  Lines        4709     4717       +8     
  Branches      572      573       +1     
==========================================
+ Hits         3772     3793      +21     
+ Misses        611      601      -10     
+ Partials      326      323       -3     
Impacted Files Coverage Δ
...n/scala/org/apache/kyuubi/KyuubiSQLException.scala 87.20% <100.00%> (+0.62%) ⬆️
...org/apache/kyuubi/operation/log/OperationLog.scala 97.72% <100.00%> (ø)
...e/authentication/KyuubiAuthenticationFactory.scala 78.57% <100.00%> (ø)
...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala 91.78% <0.00%> (+0.47%) ⬆️
.../org/apache/kyuubi/session/KyuubiSessionImpl.scala 93.61% <0.00%> (+4.25%) ⬆️
...ain/scala/org/apache/kyuubi/engine/EngineRef.scala 76.11% <0.00%> (+8.95%) ⬆️
...g/apache/kyuubi/session/KyuubiSessionManager.scala 96.96% <0.00%> (+15.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e57a434...08c9591. Read the comment docs.

* (which is saved for later retrieval by the `getCause()` method);
* may be null indicating the cause is non-existent or unknown.
*/
class KyuubiSQLException(msg: String, cause: Throwable, sqlState: String, errorCode: Int)
Copy link
Member

Choose a reason for hiding this comment

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

the constructor paras order is not the same with SQLException and the comment

Copy link
Member Author

Choose a reason for hiding this comment

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

will align SQLException

def apply(msg: String,
cause: Throwable = null,
sqlState: String = null,
errorCode: Int = 0): KyuubiSQLException = {
Copy link
Member

Choose a reason for hiding this comment

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

maybe venderCode is more accurate?

Copy link
Member

Choose a reason for hiding this comment

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

ident

msg: String,
cause: Throwable = null,
sqlState: String = null,
vendorCode: Int = 0): KyuubiSQLException = {
Copy link
Member Author

Choose a reason for hiding this comment

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

reorder the parameters to simplify method overwrite

@pan3793 pan3793 changed the title KyuubiSQLException support sqlState and errorCode [KYUUBI #670] KyuubiSQLException support sqlState and errorCode Jun 8, 2021
msg: String,
cause: Throwable = null,
sqlState: String = null,
vendorCode: Int = 0): KyuubiSQLException = {
Copy link
Contributor

Choose a reason for hiding this comment

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

vendorCode: Int = 0

Why we use 0 as the default code, seems 0 is success. use -1 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

nvm, SQLException also use 0 ..

@ulysses-you
Copy link
Contributor

thanks, merging to master for v1.3.0

@pan3793 pan3793 deleted the sql-error-code branch June 9, 2021 11:46
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.

None yet

4 participants