You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Caideyipi (via GitHub)" <gi...@apache.org> on 2026/05/18 04:12:17 UTC
[PR] Added show create pipe/database [iotdb]
Caideyipi opened a new pull request, #17702:
URL: https://github.com/apache/iotdb/pull/17702
## Description
As the title said.
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error
conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition,
design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design
(or naming) decision point and compare the alternatives with the designs that you've implemented
(or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere
(e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list),
link to that discussion from this PR description and explain what have changed in your final design
compared to your original proposal or the consensus version in the end of the discussion.
If something hasn't changed since the original discussion, you can omit a detailed discussion of
those aspects of the design here, perhaps apart from brief mentioning for the sake of readability
of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, __license__, or notice information
- [ ] 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.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items
apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items
from the checklist above are strictly necessary, but it would be very helpful if you at least
self-review the PR. -->
<hr>
##### Key changed/added classes (or packages if there are too many classes) in this 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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4475282142
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [13 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [3.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database [iotdb]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4474506027
## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/17702?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 `28.16327%` with `176 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 40.37%. Comparing base ([`402e399`](https://app.codecov.io/gh/apache/iotdb/commit/402e399ea2e611239a5609415f45365184dd6f44?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`aca2e13`](https://app.codecov.io/gh/apache/iotdb/commit/aca2e132e1306a459b07be31ecbeb030c68c59c3?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/17702?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...ion/config/executor/ClusterConfigTaskExecutor.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2Fexecutor%2FClusterConfigTaskExecutor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL2V4ZWN1dG9yL0NsdXN0ZXJDb25maWdUYXNrRXhlY3V0b3IuamF2YQ==) | 0.00% | [67 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ig/metadata/relational/ShowCreateDatabaseTask.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2Fmetadata%2Frelational%2FShowCreateDatabaseTask.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL21ldGFkYXRhL3JlbGF0aW9uYWwvU2hvd0NyZWF0ZURhdGFiYXNlVGFzay5qYXZh) | 38.88% | [22 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...config/metadata/relational/ShowCreatePipeTask.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2Fmetadata%2Frelational%2FShowCreatePipeTask.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL21ldGFkYXRhL3JlbGF0aW9uYWwvU2hvd0NyZWF0ZVBpcGVUYXNrLmphdmE=) | 69.86% | [22 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...engine/plan/relational/sql/ast/ShowCreatePipe.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fsql%2Fast%2FShowCreatePipe.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL3NxbC9hc3QvU2hvd0NyZWF0ZVBpcGUuamF2YQ==) | 0.00% | [22 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ne/plan/relational/sql/ast/ShowCreateDatabase.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fsql%2Fast%2FShowCreateDatabase.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL3NxbC9hc3QvU2hvd0NyZWF0ZURhdGFiYXNlLmphdmE=) | 0.00% | [20 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...plan/relational/sql/util/DataNodeSqlFormatter.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fsql%2Futil%2FDataNodeSqlFormatter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL3NxbC91dGlsL0RhdGFOb2RlU3FsRm9ybWF0dGVyLmphdmE=) | 0.00% | [8 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [.../plan/execution/config/TableConfigTaskVisitor.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2FTableConfigTaskVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL1RhYmxlQ29uZmlnVGFza1Zpc2l0b3IuamF2YQ==) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...yengine/plan/relational/sql/parser/AstBuilder.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fsql%2Fparser%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL3NxbC9wYXJzZXIvQXN0QnVpbGRlci5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ueryengine/common/header/DatasetHeaderFactory.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fcommon%2Fheader%2FDatasetHeaderFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvY29tbW9uL2hlYWRlci9EYXRhc2V0SGVhZGVyRmFjdG9yeS5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ne/plan/relational/analyzer/StatementAnalyzer.java](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fanalyzer%2FStatementAnalyzer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL2FuYWx5emVyL1N0YXRlbWVudEFuYWx5emVyLmphdmE=) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| ... and [1 more](https://app.codecov.io/gh/apache/iotdb/pull/17702?src=pr&el=tree-more&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 #17702 +/- ##
============================================
+ Coverage 40.26% 40.37% +0.11%
- Complexity 2574 2575 +1
============================================
Files 5179 5183 +4
Lines 349659 349904 +245
Branches 44688 44707 +19
============================================
+ Hits 140798 141288 +490
+ Misses 208861 208616 -245
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/iotdb/pull/17702?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
Re: [PR] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4569909722
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [13 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [3.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database/topic [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#discussion_r3434099410
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -2742,6 +2749,65 @@ public SettableFuture<ConfigTaskResult> showPipes(
return future;
}
+ @Override
+ public SettableFuture<ConfigTaskResult> showCreatePipe(
+ final String pipeName, final String userName) {
+ final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+ try (final ConfigNodeClient configNodeClient =
+ CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
+ final TShowPipeReq tShowPipeReq =
+ new TShowPipeReq().setPipeName(pipeName).setIsTableModel(true);
+ if (Objects.nonNull(userName)) {
+ tShowPipeReq.setUserName(userName);
+ }
+ final TShowPipeResp showPipeResp = configNodeClient.showPipe(tShowPipeReq);
+ if (showPipeResp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ future.setException(new IoTDBException(showPipeResp.getStatus()));
+ return future;
+ }
+ if (!showPipeResp.isSetPipeInfoList() || showPipeResp.getPipeInfoList().isEmpty()) {
+ future.setException(
+ new IoTDBException(
+ String.format("Failed to show create pipe %s, the pipe does not exist.", pipeName),
+ TSStatusCode.PIPE_NOT_EXIST_ERROR.getStatusCode()));
+ return future;
+ }
+
+ final TGetAllPipeInfoResp getAllPipeInfoResp = configNodeClient.getAllPipeInfo();
+ if (getAllPipeInfoResp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ future.setException(
+ new IoTDBException(
+ String.format(
+ "Failed to get pipe info from config node, status is %s.",
+ getAllPipeInfoResp.getStatus()),
+ TSStatusCode.PIPE_ERROR.getStatusCode()));
+ return future;
+ }
Review Comment:
What is the point of TShowPipeResp?
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -2742,6 +2749,65 @@ public SettableFuture<ConfigTaskResult> showPipes(
return future;
}
+ @Override
+ public SettableFuture<ConfigTaskResult> showCreatePipe(
+ final String pipeName, final String userName) {
+ final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+ try (final ConfigNodeClient configNodeClient =
+ CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
+ final TShowPipeReq tShowPipeReq =
+ new TShowPipeReq().setPipeName(pipeName).setIsTableModel(true);
+ if (Objects.nonNull(userName)) {
+ tShowPipeReq.setUserName(userName);
+ }
+ final TShowPipeResp showPipeResp = configNodeClient.showPipe(tShowPipeReq);
+ if (showPipeResp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ future.setException(new IoTDBException(showPipeResp.getStatus()));
+ return future;
+ }
+ if (!showPipeResp.isSetPipeInfoList() || showPipeResp.getPipeInfoList().isEmpty()) {
+ future.setException(
+ new IoTDBException(
+ String.format("Failed to show create pipe %s, the pipe does not exist.", pipeName),
+ TSStatusCode.PIPE_NOT_EXIST_ERROR.getStatusCode()));
Review Comment:
i18n
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/sys/subscription/ShowCreateTopicTask.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.plan.execution.config.sys.subscription;
+
+import org.apache.iotdb.commons.pipe.config.constant.SystemConstant;
+import org.apache.iotdb.commons.schema.column.ColumnHeader;
+import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant;
+import org.apache.iotdb.commons.subscription.meta.topic.TopicMeta;
+import org.apache.iotdb.db.queryengine.common.header.DatasetHeader;
+import org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
+import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
+import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
+import org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
+import org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowCreateTableTask;
+import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCreateTopic;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+import org.apache.tsfile.common.conf.TSFileConfig;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.read.common.block.TsBlockBuilder;
+import org.apache.tsfile.utils.Binary;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
+
+public class ShowCreateTopicTask implements IConfigTask {
+
+ private final String topicName;
+
+ public ShowCreateTopicTask(final ShowCreateTopic showCreateTopic) {
+ this.topicName = showCreateTopic.getTopicName();
+ }
+
+ @Override
+ public ListenableFuture<ConfigTaskResult> execute(final IConfigTaskExecutor configTaskExecutor)
+ throws InterruptedException {
+ return configTaskExecutor.showCreateTopic(topicName);
+ }
+
+ public static void buildTsBlock(
+ final TopicMeta topicMeta, final SettableFuture<ConfigTaskResult> future) {
+ final List<TSDataType> outputDataTypes =
+ ColumnHeaderConstant.showCreateTopicColumnHeaders.stream()
+ .map(ColumnHeader::getColumnType)
+ .collect(Collectors.toList());
+
+ final TsBlockBuilder builder = new TsBlockBuilder(outputDataTypes);
+ builder.getTimeColumnBuilder().writeLong(0L);
+ builder
+ .getColumnBuilder(0)
+ .writeBinary(new Binary(topicMeta.getTopicName(), TSFileConfig.STRING_CHARSET));
+ builder
+ .getColumnBuilder(1)
+ .writeBinary(new Binary(getShowCreateTopicSQL(topicMeta), TSFileConfig.STRING_CHARSET));
+ builder.declarePosition();
+
+ final DatasetHeader datasetHeader = DatasetHeaderFactory.getShowCreateTopicColumnHeader();
+ future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS, builder.build(), datasetHeader));
+ }
+
+ public static String getShowCreateTopicSQL(final TopicMeta topicMeta) {
+ final StringBuilder builder =
+ new StringBuilder("CREATE TOPIC ")
+ .append(ShowCreateTableTask.getIdentifier(topicMeta.getTopicName()));
+
+ final Map<String, String> sanitizedAttributes =
+ sanitizeTopicAttributes(topicMeta.getConfig().getAttribute());
+ if (!sanitizedAttributes.isEmpty()) {
+ final List<String> pairs = new ArrayList<>(sanitizedAttributes.size());
+ for (final Map.Entry<String, String> entry : sanitizedAttributes.entrySet()) {
+ pairs.add(
+ ShowCreateTableTask.getString(entry.getKey())
+ + "="
+ + ShowCreateTableTask.getString(entry.getValue()));
+ }
+ builder.append(" WITH (").append(String.join(",", pairs)).append(")");
+ }
+
+ return builder.toString();
+ }
+
+ private static Map<String, String> sanitizeTopicAttributes(final Map<String, String> attributes) {
+ final Map<String, String> result = new TreeMap<>(attributes);
+ result
+ .entrySet()
+ .removeIf(entry -> entry.getKey().startsWith(SystemConstant.SYSTEM_PREFIX_KEY));
+ result.entrySet().removeIf(entry -> entry.getKey().startsWith(SystemConstant.AUDIT_PREFIX_KEY));
+ return result;
+ }
Review Comment:
Remove authentication-related attributes too.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -4160,6 +4264,46 @@ public SettableFuture<ConfigTaskResult> countDatabases(
return future;
}
+ @Override
+ public SettableFuture<ConfigTaskResult> showCreateDatabase(final String database) {
+ final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+ if (InformationSchema.INFORMATION_DATABASE.equals(database)) {
+ future.setException(
+ new IoTDBException(
+ "The system database does not support show create.",
+ TSStatusCode.SEMANTIC_ERROR.getStatusCode()));
+ return future;
+ }
Review Comment:
And the audit db?
--
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] Added show create pipe/database/topic [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 merged PR #17702:
URL: https://github.com/apache/iotdb/pull/17702
--
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] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4563493508
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [13 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [3.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4609921261
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [12 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [4.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4795140646
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [18 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [4.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4474306204
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [11 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [4.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database/topic [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#issuecomment-4570607420
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702) **Quality Gate passed**
Issues
 [11 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17702&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17702&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_coverage&view=list)
 [3.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17702&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17702)
--
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] Added show create pipe/database/topic [iotdb]
Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on code in PR #17702:
URL: https://github.com/apache/iotdb/pull/17702#discussion_r3309381229
##########
integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java:
##########
@@ -285,6 +285,51 @@ public void testManageDatabase() {
}
}
+ @Test
+ public void testShowCreateDatabase() throws SQLException {
Review Comment:
testShowCreateDatabase asserts exact CREATE DATABASE text including region group defaults. If defaults change between releases, consider matching on key substrings to reduce brittle IT failures.
--
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