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

refactor: check if null in PreparedStatement #1795

Merged
merged 5 commits into from
May 11, 2022
Merged

Conversation

vighnesh-kadam
Copy link
Contributor

@vighnesh-kadam vighnesh-kadam commented May 11, 2022

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    PR checks if "currentRow" variable value is NULL and its checked before calling GetSchema method. If it's null, throws an exception.
    Also another if statement previously on line 279 is deleted.
    close check if null in PreparedStatement #1759

  • What is the current behavior? (You can also link to an open issue here)
    check if null in PreparedStatement #1759

  • What is the new behavior (if this is a feature change)?
    As directed by @vagetablechicken "if" statement is placed to check for null value of "currentRow" variable and if value is null exception is thrown.

@github-actions github-actions bot added the sdk openmldb java/python sdk label May 11, 2022
// TODO(hw): check if null
if (this.currentRow == null) {
throw new SQLException("failed to build data with row");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

hi @vighnesh-kadam the line of 275 and 277 also need to add indentation

Copy link
Collaborator

Choose a reason for hiding this comment

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

good job! And throw statement looks indenting more space, it also need to remove redundant space before throw word. thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i will do it

Copy link
Collaborator

Choose a reason for hiding this comment

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

WX20220511-152322
it seems having more space compared with other statement.

Copy link
Collaborator

Choose a reason for hiding this comment

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

there is Tab before throw ? replace it with space

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes its done now

@@ -272,13 +272,12 @@ protected void dataBuild() throws SQLException {
columnTypes.AddColumnType(types.get(i + 1));
}
this.currentRow = SQLRequestRow.CreateSQLRequestRowFromColumnTypes(columnTypes);
// TODO(hw): check if null
if (this.currentRow == null) {
throw new SQLException("failed to build data with row");
Copy link
Collaborator

Choose a reason for hiding this comment

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

exception message should be fail to create sql request row from column types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok editing it

@github-actions
Copy link
Contributor

SDK Test Report

  74 files    74 suites   5m 59s ⏱️
175 tests 172 ✔️ 3 💤 0
216 runs  213 ✔️ 3 💤 0

Results for commit d731af8.

@github-actions
Copy link
Contributor

Linux Test Report

       57 files       186 suites   1h 12m 11s ⏱️
  8 472 tests   8 464 ✔️ 8 💤 0
12 423 runs  12 415 ✔️ 8 💤 0

Results for commit d731af8.

@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #1795 (d731af8) into main (d963b5a) will increase coverage by 0.02%.
The diff coverage is 96.34%.

@@             Coverage Diff              @@
##               main    #1795      +/-   ##
============================================
+ Coverage     73.73%   73.75%   +0.02%     
  Complexity      347      347              
============================================
  Files           614      614              
  Lines        120240   120318      +78     
  Branches       1015     1015              
============================================
+ Hits          88653    88744      +91     
+ Misses        31378    31365      -13     
  Partials        209      209              
Impacted Files Coverage Δ
hybridse/src/vm/runner.cc 67.85% <ø> (-0.02%) ⬇️
...om/_4paradigm/openmldb/jdbc/PreparedStatement.java 21.45% <0.00%> (ø)
src/cmd/sql_cmd_test.cc 99.55% <98.70%> (-0.06%) ⬇️
hybridse/src/vm/aggregator.h 88.33% <100.00%> (+0.09%) ⬆️
hybridse/include/base/spin_lock.h 66.66% <0.00%> (-33.34%) ⬇️
...s/query_response_time/deploy_query_response_time.h 81.25% <0.00%> (-18.75%) ⬇️
...atistics/query_response_time/query_response_time.h 78.26% <0.00%> (-4.35%) ⬇️
.../query_response_time/deploy_query_response_time.cc 97.10% <0.00%> (-2.90%) ⬇️
src/nameserver/name_server_impl.cc 42.85% <0.00%> (+0.09%) ⬆️
src/client/tablet_client.cc 49.74% <0.00%> (+0.10%) ⬆️
... and 5 more

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 f105a59...d731af8. Read the comment docs.

@dl239 dl239 merged commit 3701cc2 into 4paradigm:main May 11, 2022
@vighnesh-kadam
Copy link
Contributor Author

vighnesh-kadam commented May 11, 2022

@dl239 Thank you for merging my PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk openmldb java/python sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check if null in PreparedStatement
3 participants