-
Notifications
You must be signed in to change notification settings - Fork 994
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
PHOENIX-4864 Fix NullPointerException while Logging some DDL Statements #336
Conversation
@@ -45,7 +45,9 @@ public ResultSet executeQuery() throws SQLException { | |||
|
|||
@Override | |||
public ResultSet getResultSet() throws SQLException { | |||
return new LoggingPhoenixResultSet(super.getResultSet(), phoenixMetricsLog, sql); | |||
ResultSet resultSet = super.getResultSet(); | |||
return (resultSet == null) ? null : new LoggingPhoenixResultSet(super.getResultSet(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a bug. super.getResultSet()
call is not idempotent. You should replace this with resultSet
local variable
8ab0d00
to
f2e3fdd
Compare
Added the corresponding test case. @vincentpoon @karanmehta93 |
mutationWriteMetricsMap.size() == 0); | ||
assertTrue("Mutation read metrics are not logged again.", | ||
mutationReadMetricsMap.size() == 0); | ||
assertTrue("Mutation write metrics are not logged again.", mutationWriteMetricsMap.size() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary diff (in lot of places)
@@ -32,6 +35,7 @@ | |||
|
|||
import static org.junit.Assert.assertTrue; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
@@ -45,7 +45,9 @@ public ResultSet executeQuery() throws SQLException { | |||
|
|||
@Override | |||
public ResultSet getResultSet() throws SQLException { | |||
return new LoggingPhoenixResultSet(super.getResultSet(), phoenixMetricsLog, sql); | |||
ResultSet resultSet = super.getResultSet(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a comment that call to getResultSet()
is not idempotent. Hence we cache and return accordingly.
Nice test coverage @ashuparekh |
f2e3fdd
to
e43db87
Compare
@karanmehta93 Incorporated the above suggestions |
e43db87
to
e498425
Compare
Already merged. |
Fixed the error. Still to add corresponding test case. @vincentpoon @karanmehta93