-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add project helpful info readme for AI Coding model #17229
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
Open
JackieTien97
wants to merge
5
commits into
master
Choose a base branch
from
AGENTMD
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| <!-- | ||
|
|
||
| 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. Many of these rules are enforced by CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`), while others are conventions that contributors are expected to follow. | ||
|
|
||
| ## 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 all modules (skip tests) | ||
| 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, including integration tests) | ||
| mvn spotless:check -P with-integration-tests | ||
| mvn spotless:apply -P with-integration-tests | ||
| ``` | ||
|
|
||
| # Running Tests | ||
|
|
||
| ```bash | ||
| # Unit tests for a specific module | ||
| 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 | ||
|
|
||
| # Integration tests — Simple mode (1 ConfigNode + 1 DataNode, tree model) | ||
| mvn clean verify -DskipUTs -pl integration-test -am -P with-integration-tests | ||
|
|
||
| # Single IT test class — Simple mode (1 ConfigNode + 1 DataNode, tree model) | ||
| mvn clean verify -DskipUTs -Dit.test=ClassName -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -P with-integration-tests -am -PSimpleIT | ||
|
|
||
| # Integration tests — Cluster mode (1 ConfigNode + 3 DataNodes, tree model) | ||
| mvn clean verify -DskipUTs -pl integration-test -am -PClusterIT -P with-integration-tests | ||
|
|
||
| # Single IT test class — Cluster mode (1 ConfigNode + 3 DataNodes, tree model) | ||
| mvn clean verify -DskipUTs -Dit.test=ClassName -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -P with-integration-tests -am -PClusterIT | ||
|
|
||
| # Integration tests — Table model simple | ||
| mvn clean verify -DskipUTs -pl integration-test -am -PTableSimpleIT -P with-integration-tests | ||
|
|
||
| # Single IT test class — Table model simple | ||
| mvn clean verify -DskipUTs -Dit.test=ClassName -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -P with-integration-tests -am -PTableSimpleIT | ||
|
|
||
| # Integration tests — Table model cluster | ||
| mvn clean verify -DskipUTs -pl integration-test -am -PTableClusterIT -P with-integration-tests | ||
|
|
||
| # Single IT test class — Table model cluster | ||
| mvn clean verify -DskipUTs -Dit.test=ClassName -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -P with-integration-tests -am -PTableClusterIT | ||
|
|
||
|
|
||
| # Before running ITs in IDE for the first time (generates template-node): | ||
| mvn clean package -DskipTests -pl integration-test -am -P with-integration-tests | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!-- | ||
|
|
||
| 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. | ||
|
|
||
| --> | ||
|
|
||
| See [AGENTS.md](./AGENTS.md) for all project guidelines, code style rules, build commands, and test instructions. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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.