You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "cryptoe (via GitHub)" <gi...@apache.org> on 2023/07/19 12:49:22 UTC
[PR] Adding null fix for rows and col stats information. (druid)
cryptoe opened a new pull request, #14617:
URL: https://github.com/apache/druid/pull/14617
Null pointer fix for sql statement endpoint for "replace/Insert" q's. Since we donot populate the size counters for segment generation stage, the value is always null. Adjusted the code to be more defensive.
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #14617:
URL: https://github.com/apache/druid/pull/14617#discussion_r1268256699
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -536,8 +536,8 @@ private Optional<ResultSetInformation> getSampleResults(
rows = 0L;
size = 0L;
for (PageInformation pageInformation : pageList.get()) {
- rows += pageInformation.getNumRows();
- size += pageInformation.getSizeInBytes();
+ rows += pageInformation.getNumRows() != null ? pageInformation.getNumRows() : 0L;
Review Comment:
Good catch. Will do that in the next PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "LakshSingla (via GitHub)" <gi...@apache.org>.
LakshSingla commented on code in PR #14617:
URL: https://github.com/apache/druid/pull/14617#discussion_r1268041878
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -536,8 +536,8 @@ private Optional<ResultSetInformation> getSampleResults(
rows = 0L;
size = 0L;
for (PageInformation pageInformation : pageList.get()) {
- rows += pageInformation.getNumRows();
- size += pageInformation.getSizeInBytes();
+ rows += pageInformation.getNumRows() != null ? pageInformation.getNumRows() : 0L;
Review Comment:
nit:
From the code, it seems like numRows can't be null, so can we modify the `PageInformation` instead to remove the `Nullable` tag for `numRows`, convert it to a long, and remove the check here?
Similarly, with this change, we aren't using the nullity of `PageInformation::sizeOfBytes()` anywhere apart from this check, therefore can we convert it to a primitive long, populate it as 0 instead of `null`, remove the `Nullable` and clean up the special handling here?
Since we don't require any special ability of the boxed types, it seems better to clean them up. WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe merged PR #14617:
URL: https://github.com/apache/druid/pull/14617
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #14617:
URL: https://github.com/apache/druid/pull/14617#discussion_r1268087681
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -536,8 +536,8 @@ private Optional<ResultSetInformation> getSampleResults(
rows = 0L;
size = 0L;
for (PageInformation pageInformation : pageList.get()) {
- rows += pageInformation.getNumRows();
- size += pageInformation.getSizeInBytes();
+ rows += pageInformation.getNumRows() != null ? pageInformation.getNumRows() : 0L;
Review Comment:
Since page information is serialized as json in the `SqlStatementResult`, I prefer `PageInformation#numRows` and `sizeOfBytes` to be Long. That way if they are not populated for whatever reason, they are not sent across to the end users.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "LakshSingla (via GitHub)" <gi...@apache.org>.
LakshSingla commented on code in PR #14617:
URL: https://github.com/apache/druid/pull/14617#discussion_r1268218555
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -536,8 +536,8 @@ private Optional<ResultSetInformation> getSampleResults(
rows = 0L;
size = 0L;
for (PageInformation pageInformation : pageList.get()) {
- rows += pageInformation.getNumRows();
- size += pageInformation.getSizeInBytes();
+ rows += pageInformation.getNumRows() != null ? pageInformation.getNumRows() : 0L;
Review Comment:
In that case, please add `@JsonInclude(JsonInclude.Include.NON_NULL)` to the Jackson annotations of the members of `PageInformation`. By default, we do serialize and present null values to the user. So per the current behavior, page information would get serialized as `{"numRows":null,"sizeInBytes":null,"id":5}`.
Approving the PR since the fix is not related to the current change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Adding null fix for rows and col stats information. (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on PR #14617:
URL: https://github.com/apache/druid/pull/14617#issuecomment-1642336836
Thanks @LakshSingla for the review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org