Copilot commented on code in PR #17229:
URL: https://github.com/apache/iotdb/pull/17229#discussion_r2867124665


##########
AGENTS.md:
##########
@@ -0,0 +1,196 @@
+<!--
+
+    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.
+
+-->
+
+# Project Overview
+
+Apache IoTDB is a distributed time-series database written in Java. Version 
2.0.x supports both tree-model (time-series paths) and table-model (relational) 
data access. It uses a ConfigNode/DataNode architecture with pluggable 
consensus protocols.
+
+
+# IoTDB Java Code Style Guide
+
+This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. These rules are enforced by 
CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`).
+
+## Imports
+
+1. **Star imports are forbidden**: Never use `import xxx.*` or `import static 
xxx.*`. Always list each required class or static member explicitly.
+2. **Import ordering** (enforced by Spotless):
+   ```
+   org.apache.iotdb.*
+                          ← blank line
+   Other third-party packages (e.g. org.apache.arrow, com.google, etc.)
+                          ← blank line
+   javax.*
+   java.*
+                          ← blank line
+   static imports
+   ```
+3. **Remove unused imports**.
+
+## Formatting
+
+- Use **Google Java Format** (GOOGLE style).
+- Indent with **2 spaces**, no tabs.
+- Line width limit is **100 characters** (except `package`, `import`, and URL 
lines).
+- Use **UNIX (LF)** line endings.
+
+## Naming Conventions
+
+| Type | Rule | Example |
+|------|------|---------| 
+| Package | All lowercase, dot-separated | `org.apache.iotdb.flight` |
+| Class | UpperCamelCase | `TsBlockToArrowConverter` |
+| Method | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9_]*$`) | 
`fillVectorSchemaRoot` |
+| Member variable | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9]*$`) | 
`allocator` |
+| Parameter | lowerCamelCase | `tsBlock` |
+| Constant | UPPER_SNAKE_CASE, at most 1 consecutive uppercase letter in 
abbreviations | `MAX_RETRY_COUNT` |
+
+## Code Structure
+
+- Only one top-level class per `.java` file.
+- `switch` statements must have a `default` branch.
+- Empty `try`/`catch`/`if`/`else`/`switch` blocks are not allowed (unless they 
contain a comment).
+- Exception variables in empty `catch` blocks must be named `expected`.
+- `if`/`else`/`for`/`while`/`do` must use braces `{}`.
+
+## License Header
+
+Every file must start with the Apache License 2.0 header, java file:
+
+```java
+/*
+ * 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.
+ */
+```
+
+md or xml file:
+
+```xml
+<!--
+
+    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.
+
+-->
+```
+
+## Verification Commands
+
+```bash
+# Format code
+mvn spotless:apply -P with-integration-tests
+
+# Check style
+mvn checkstyle:check -P with-integration-tests
+```
+
+# Integration Test Rules
+
+- When writing integration tests, always use `SessionConfig.DEFAULT_USER` and 
`SessionConfig.DEFAULT_PASSWORD` for the user and password instead of 
hardcoding values.
+
+# Build Commands
+
+```bash
+# Full build (produces distribution in distribution/target/)
+mvn clean package -pl distribution -am -DskipTests
+
+# Build server only

Review Comment:
   The “Build server only” command (`mvn clean package -DskipTests`) actually 
builds the full multi-module reactor (including distribution/example/etc.), not 
just the server modules. Consider either renaming this to something like “Build 
all modules (skip tests)” or changing the command to target the server modules 
(e.g., `-pl iotdb-core -am`).
   ```suggestion
   # Build all modules (skip tests)
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,196 @@
+<!--
+
+    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.
+
+-->
+
+# Project Overview
+
+Apache IoTDB is a distributed time-series database written in Java. Version 
2.0.x supports both tree-model (time-series paths) and table-model (relational) 
data access. It uses a ConfigNode/DataNode architecture with pluggable 
consensus protocols.
+
+
+# IoTDB Java Code Style Guide
+
+This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. These rules are enforced by 
CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`).
+
+## Imports
+
+1. **Star imports are forbidden**: Never use `import xxx.*` or `import static 
xxx.*`. Always list each required class or static member explicitly.
+2. **Import ordering** (enforced by Spotless):
+   ```
+   org.apache.iotdb.*

Review Comment:
   This import-order example uses `org.apache.iotdb.*` in the diagram, which 
reads like a star import and conflicts with the earlier “Star imports are 
forbidden” rule. Consider changing the diagram to indicate “imports with prefix 
org.apache.iotdb” (without `*`) or otherwise clarifying it’s a grouping rule 
rather than a literal import statement.
   ```suggestion
      Imports with prefix org.apache.iotdb
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,196 @@
+<!--
+
+    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.
+
+-->
+
+# Project Overview
+
+Apache IoTDB is a distributed time-series database written in Java. Version 
2.0.x supports both tree-model (time-series paths) and table-model (relational) 
data access. It uses a ConfigNode/DataNode architecture with pluggable 
consensus protocols.
+
+
+# IoTDB Java Code Style Guide
+
+This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. These rules are enforced by 
CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`).
+
+## Imports
+
+1. **Star imports are forbidden**: Never use `import xxx.*` or `import static 
xxx.*`. Always list each required class or static member explicitly.
+2. **Import ordering** (enforced by Spotless):
+   ```
+   org.apache.iotdb.*
+                          ← blank line
+   Other third-party packages (e.g. org.apache.arrow, com.google, etc.)
+                          ← blank line
+   javax.*
+   java.*
+                          ← blank line
+   static imports
+   ```
+3. **Remove unused imports**.
+
+## Formatting
+
+- Use **Google Java Format** (GOOGLE style).
+- Indent with **2 spaces**, no tabs.
+- Line width limit is **100 characters** (except `package`, `import`, and URL 
lines).
+- Use **UNIX (LF)** line endings.
+
+## Naming Conventions
+
+| Type | Rule | Example |
+|------|------|---------| 
+| Package | All lowercase, dot-separated | `org.apache.iotdb.flight` |
+| Class | UpperCamelCase | `TsBlockToArrowConverter` |
+| Method | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9_]*$`) | 
`fillVectorSchemaRoot` |
+| Member variable | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9]*$`) | 
`allocator` |
+| Parameter | lowerCamelCase | `tsBlock` |
+| Constant | UPPER_SNAKE_CASE, at most 1 consecutive uppercase letter in 
abbreviations | `MAX_RETRY_COUNT` |
+
+## Code Structure
+
+- Only one top-level class per `.java` file.
+- `switch` statements must have a `default` branch.
+- Empty `try`/`catch`/`if`/`else`/`switch` blocks are not allowed (unless they 
contain a comment).
+- Exception variables in empty `catch` blocks must be named `expected`.
+- `if`/`else`/`for`/`while`/`do` must use braces `{}`.
+
+## License Header
+
+Every file must start with the Apache License 2.0 header, java file:
+
+```java
+/*
+ * 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.
+ */
+```
+
+md or xml file:
+
+```xml
+<!--
+
+    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.
+
+-->
+```
+
+## Verification Commands
+
+```bash
+# Format code
+mvn spotless:apply -P with-integration-tests
+
+# Check style
+mvn checkstyle:check -P with-integration-tests
+```
+
+# Integration Test Rules
+
+- When writing integration tests, always use `SessionConfig.DEFAULT_USER` and 
`SessionConfig.DEFAULT_PASSWORD` for the user and password instead of 
hardcoding values.
+
+# Build Commands
+
+```bash
+# Full build (produces distribution in distribution/target/)
+mvn clean package -pl distribution -am -DskipTests
+
+# Build server only
+mvn clean package -DskipTests
+
+# Build CLI only
+mvn clean package -pl iotdb-client/cli -am -DskipTests
+
+# Code formatting check / auto-fix (Google Java Format via Spotless)
+mvn spotless:check -P with-integration-tests
+mvn spotless:apply -P with-integration-tests
+
+# Format integration test code
+mvn spotless:apply -P with-integration-tests

Review Comment:
   In the Build Commands section, `mvn spotless:apply -P 
with-integration-tests` is listed twice (once under formatting check/auto-fix 
and again under “Format integration test code”). Consider removing the 
duplicate or clarifying the difference to keep the instructions concise.
   ```suggestion
   # Code formatting check / auto-fix (Google Java Format via Spotless, 
including integration tests)
   mvn spotless:check -P with-integration-tests
   mvn spotless:apply -P with-integration-tests
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,196 @@
+<!--
+
+    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.
+
+-->
+
+# Project Overview
+
+Apache IoTDB is a distributed time-series database written in Java. Version 
2.0.x supports both tree-model (time-series paths) and table-model (relational) 
data access. It uses a ConfigNode/DataNode architecture with pluggable 
consensus protocols.
+
+
+# IoTDB Java Code Style Guide
+
+This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. These rules are enforced by 
CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`).
+
+## Imports
+
+1. **Star imports are forbidden**: Never use `import xxx.*` or `import static 
xxx.*`. Always list each required class or static member explicitly.
+2. **Import ordering** (enforced by Spotless):
+   ```
+   org.apache.iotdb.*
+                          ← blank line
+   Other third-party packages (e.g. org.apache.arrow, com.google, etc.)
+                          ← blank line
+   javax.*
+   java.*
+                          ← blank line
+   static imports
+   ```
+3. **Remove unused imports**.
+
+## Formatting
+
+- Use **Google Java Format** (GOOGLE style).
+- Indent with **2 spaces**, no tabs.
+- Line width limit is **100 characters** (except `package`, `import`, and URL 
lines).
+- Use **UNIX (LF)** line endings.
+
+## Naming Conventions
+
+| Type | Rule | Example |
+|------|------|---------| 
+| Package | All lowercase, dot-separated | `org.apache.iotdb.flight` |
+| Class | UpperCamelCase | `TsBlockToArrowConverter` |
+| Method | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9_]*$`) | 
`fillVectorSchemaRoot` |
+| Member variable | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9]*$`) | 
`allocator` |
+| Parameter | lowerCamelCase | `tsBlock` |
+| Constant | UPPER_SNAKE_CASE, at most 1 consecutive uppercase letter in 
abbreviations | `MAX_RETRY_COUNT` |
+
+## Code Structure
+
+- Only one top-level class per `.java` file.
+- `switch` statements must have a `default` branch.
+- Empty `try`/`catch`/`if`/`else`/`switch` blocks are not allowed (unless they 
contain a comment).
+- Exception variables in empty `catch` blocks must be named `expected`.
+- `if`/`else`/`for`/`while`/`do` must use braces `{}`.
+
+## License Header
+
+Every file must start with the Apache License 2.0 header, java file:
+
+```java
+/*
+ * 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.
+ */
+```
+
+md or xml file:
+
+```xml
+<!--
+
+    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.
+
+-->
+```
+
+## Verification Commands
+
+```bash
+# Format code
+mvn spotless:apply -P with-integration-tests
+
+# Check style
+mvn checkstyle:check -P with-integration-tests
+```
+
+# Integration Test Rules
+
+- When writing integration tests, always use `SessionConfig.DEFAULT_USER` and 
`SessionConfig.DEFAULT_PASSWORD` for the user and password instead of 
hardcoding values.
+
+# Build Commands
+
+```bash
+# Full build (produces distribution in distribution/target/)
+mvn clean package -pl distribution -am -DskipTests
+
+# Build server only
+mvn clean package -DskipTests
+
+# Build CLI only
+mvn clean package -pl iotdb-client/cli -am -DskipTests
+
+# Code formatting check / auto-fix (Google Java Format via Spotless)
+mvn spotless:check -P with-integration-tests
+mvn spotless:apply -P with-integration-tests
+
+# Format integration test code
+mvn spotless:apply -P with-integration-tests
+```
+
+# Running Tests
+
+```bash
+# Unit tests for a specific module
+mvn test -pl iotdb-core/datanode
+
+# Single unit test class
+mvn test -pl iotdb-core/datanode -Dtest=ClassName
+
+# Single unit test method
+mvn test -pl iotdb-core/datanode -Dtest=ClassName#methodName

Review Comment:
   The unit-test commands use `-pl iotdb-core/datanode` without `-am`. Since 
the datanode module depends on several other reactor modules (service-rpc, 
node-commons, etc.), this often fails on a fresh checkout unless those 
artifacts are already installed locally. Consider adding `-am` (or noting the 
prerequisite) so the command works reliably.
   ```suggestion
   mvn test -pl iotdb-core/datanode -am
   
   # Single unit test class
   mvn test -pl iotdb-core/datanode -am -Dtest=ClassName
   
   # Single unit test method
   mvn test -pl iotdb-core/datanode -am -Dtest=ClassName#methodName
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,196 @@
+<!--
+
+    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.
+
+-->
+
+# Project Overview
+
+Apache IoTDB is a distributed time-series database written in Java. Version 
2.0.x supports both tree-model (time-series paths) and table-model (relational) 
data access. It uses a ConfigNode/DataNode architecture with pluggable 
consensus protocols.
+
+
+# IoTDB Java Code Style Guide
+
+This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. These rules are enforced by 
CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`).

Review Comment:
   The statement that these rules are enforced by Checkstyle/Spotless seems too 
broad. For example, the current checkstyle.xml doesn’t define a ConstantName 
check, so the constant naming rule in this doc isn’t actually enforced. 
Consider rewording to “many of these rules are enforced” (and/or explicitly 
list which items are enforced) to avoid misleading contributors.
   ```suggestion
   This document defines the coding rules that **must** be followed when 
generating or modifying Java code in this project. Many of these rules are 
enforced by CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`), while 
others are conventions that contributors are expected to follow.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to