You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Wei-hao-Li (via GitHub)" <gi...@apache.org> on 2026/03/24 08:57:29 UTC

[PR] Add extra client_ip and timeout columns for show queries [iotdb]

Wei-hao-Li opened a new pull request, #17350:
URL: https://github.com/apache/iotdb/pull/17350

   <img width="1105" height="306" alt="image" src="https://github.com/user-attachments/assets/f202bb0e-e359-4b7e-bb11-995611d9be57" />
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "Wei-hao-Li (via GitHub)" <gi...@apache.org>.
Wei-hao-Li merged PR #17350:
URL: https://github.com/apache/iotdb/pull/17350


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #17350:
URL: https://github.com/apache/iotdb/pull/17350#discussion_r2980159600


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/IQueryExecution.java:
##########
@@ -70,6 +70,8 @@ public interface IQueryExecution {
    */
   long getTotalExecutionTime();
 

Review Comment:
   The new `getTimeout()` method has no contract documented (unit, meaning of 0/negative/Long.MAX_VALUE, whether it’s per-query or session-level, etc.). Since this value is now surfaced via `SHOW QUERIES`/information_schema, please add Javadoc specifying at least the unit (ms) and semantics so callers don’t misinterpret it.
   ```suggestion
   
     /**
      * Returns the timeout for this query execution in milliseconds.
      *
      * <p>The returned value applies to this query execution instance only (per-query timeout).
      *
      * <p>Semantics of special values:
      * <ul>
      *   <li>{@code timeout > 0}: maximum allowed execution time in milliseconds for this query.</li>
      *   <li>{@code timeout <= 0}: no timeout is configured for this query (unlimited).</li>
      *   <li>{@code Long.MAX_VALUE}: effectively treated as no timeout.</li>
      * </ul>
      *
      * @return the configured timeout in milliseconds for this query
      */
   ```



##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java:
##########
@@ -645,10 +648,12 @@ private ColumnHeaderConstant() {
 
   public static final List<ColumnHeader> showQueriesColumnHeaders =
       ImmutableList.of(
-          new ColumnHeader(QUERY_ID, TSDataType.TEXT),
+          new ColumnHeader(QUERY_ID, TSDataType.STRING),
           new ColumnHeader(DATA_NODE_ID, TSDataType.INT32),
           new ColumnHeader(ELAPSED_TIME, TSDataType.FLOAT),
-          new ColumnHeader(STATEMENT, TSDataType.TEXT));
+          new ColumnHeader(STATEMENT, TSDataType.STRING),
+          new ColumnHeader(CLIENT_IP_TREE_MODEL, TSDataType.STRING),

Review Comment:
   `showQueriesColumnHeaders` switches string columns (e.g., QueryId/Statement/ClientIp) from `TSDataType.TEXT` to `TSDataType.STRING`. This changes the result schema of the TREE-model `SHOW QUERIES` statement and can break compatibility with older clients/components that only expect `TEXT` in show-statement outputs. Consider keeping existing columns as `TEXT` and only adding the new columns, also as `TEXT`, unless there is a hard requirement to return `STRING` here.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ShowQueriesOperator.java:
##########
@@ -150,6 +150,8 @@ private TsBlock buildTsBlock() {
               (float) (currTime - queryExecution.getStartExecutionTime()) / 1000);
           columnBuilders[3].writeBinary(
               BytesUtils.valueOf(queryExecution.getExecuteSQL().orElse("UNKNOWN")));
+          columnBuilders[4].writeBinary(BytesUtils.valueOf(queryExecution.getClientHostname()));
+          columnBuilders[5].writeLong(queryExecution.getTimeout());

Review Comment:
   This populates the new `ClientIp` column using `getClientHostname()`. If the value isn’t guaranteed to be an IP address (e.g., could be a hostname), consider normalizing it to an IP (or renaming the column/accessor) to avoid misleading output from `SHOW QUERIES`.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java:
##########
@@ -283,6 +283,8 @@ protected void constructLine() {
         columnBuilders[4].writeBinary(
             BytesUtils.valueOf(queryExecution.getExecuteSQL().orElse("UNKNOWN")));
         columnBuilders[5].writeBinary(BytesUtils.valueOf(queryExecution.getUser()));
+        columnBuilders[6].writeBinary(BytesUtils.valueOf(queryExecution.getClientHostname()));
+        columnBuilders[7].writeLong(queryExecution.getTimeout());

Review Comment:
   The new `client_ip` / `ClientIp` columns are populated from `queryExecution.getClientHostname()`. The naming suggests an IP address, but the API returns a “hostname”/`cliHostname`; if this can be a DNS name (or includes port), the column name is misleading. Either ensure the stored value is a normalized IP address (and ideally rename the accessor accordingly) or consider exposing it as `client_host`/`client_hostname` instead.



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17350:
URL: https://github.com/apache/iotdb/pull/17350#issuecomment-4116519591

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [29.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17350&metric=new_duplicated_lines_density&view=list) (required ≤ 5%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350)
   
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17350:
URL: https://github.com/apache/iotdb/pull/17350#issuecomment-4124504814

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [21.7% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17350&metric=new_duplicated_lines_density&view=list) (required ≤ 5%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350)
   
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17350:
URL: https://github.com/apache/iotdb/pull/17350#issuecomment-4116938903

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [29.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17350&metric=new_duplicated_lines_density&view=list) (required ≤ 5%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17350)
   
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add extra client_ip and timeout columns for show queries [iotdb]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #17350:
URL: https://github.com/apache/iotdb/pull/17350#issuecomment-4117319560

   ## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/17350?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `63.63636%` with `4 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 39.75%. Comparing base ([`9be854c`](https://app.codecov.io/gh/apache/iotdb/commit/9be854c0e7099f9527b89197ece0b7531a42cee9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8f45c1c`](https://app.codecov.io/gh/apache/iotdb/commit/8f45c1c4e1e4236d93cc67e3522e0aed299baa05?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/17350?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...ional/InformationSchemaContentSupplierFactory.java](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fexecution%2Foperator%2Fsource%2Frelational%2FInformationSchemaContentSupplierFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvZXhlY3V0aW9uL29wZXJhdG9yL3NvdXJjZS9yZWxhdGlvbmFsL0luZm9ybWF0aW9uU2NoZW1hQ29udGVudFN1cHBsaWVyRmFjdG9yeS5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../db/queryengine/plan/execution/QueryExecution.java](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2FQueryExecution.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vUXVlcnlFeGVjdXRpb24uamF2YQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...yengine/plan/execution/config/ConfigExecution.java](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2FConfigExecution.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL0NvbmZpZ0V4ZWN1dGlvbi5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #17350      +/-   ##
   ============================================
   + Coverage     39.72%   39.75%   +0.03%     
     Complexity      312      312              
   ============================================
     Files          5126     5126              
     Lines        346242   346252      +10     
     Branches      44085    44085              
   ============================================
   + Hits         137551   137666     +115     
   + Misses       208691   208586     -105     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/iotdb/pull/17350?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org