Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a912155
feat(vst-inherit): Phase 1+2 - foundation data structures and grammar
yihaoDeng May 8, 2026
c0b5ef3
feat(vst-inherit): Phase 3 - translator semantic analysis
yihaoDeng May 8, 2026
c4cf839
feat(vst-inherit): Phase 4+5 - mnode DDL processing and system table
yihaoDeng May 8, 2026
09407f5
feat(vst-inherit): add DDL system test for inheritance
yihaoDeng May 8, 2026
72266c8
feat(vst-inherit): SHOW CREATE STABLE with BASE ON clause
yihaoDeng May 8, 2026
64b3550
test(vst-inherit): enhance DDL tests with conflict/cycle/SHOW CREATE …
yihaoDeng May 8, 2026
558e8f6
feat(vst-inherit): add non-leaf VCT creation gate
yihaoDeng May 8, 2026
56db520
chore: remove scratch files from exploration phase
yihaoDeng May 8, 2026
5ea2e0f
feat(inheritance): Phase 6 - non-leaf VST query via UNION ALL expansion
yihaoDeng May 8, 2026
8a40bb0
chore: remove design documents from source tree
yihaoDeng May 8, 2026
8397bce
Revert "chore: remove design documents from source tree"
yihaoDeng May 9, 2026
cdbf8c2
feat(vst-inherit): ALTER ADD/DROP BASE ON column cascade
yihaoDeng May 11, 2026
e70c188
test(vst-inherit): comprehensive ADD/DROP BASE ON cascade tests
yihaoDeng May 11, 2026
208b689
fix: VST inheritance - schema merge, ts position, SDB update, VCT syntax
yihaoDeng May 11, 2026
0f54e89
feat(vst-inheritance): add VCT check via SERIAL transaction before CR…
yihaoDeng May 11, 2026
7809999
test: rewrite VST inheritance cascade test to new pytest framework
yihaoDeng May 12, 2026
2ae6fbe
rewrite test file
yihaoDeng May 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Copilot Instructions for TDengine

## Build Commands

```bash
# Generate build (Debug, with tests enabled)
./build.sh gen

# Build
./build.sh bld

# Install (required before running tests)
./build.sh install

# Quick alternative (from existing debug/ directory)
cd debug && make -j4 && make install

# Build with specific cmake options
cmake -B debug -DBUILD_TEST=true -DBUILD_TOOLS=true -DBUILD_CONTRIB=true
cmake --build debug -j$(nproc)
```

## Testing

```bash
# Run all unit tests (Google Test based, C++)
cd debug/build/bin && ./osTimeTests # single unit test binary

# Run a single Python system test
cd tests/system-test && python3 ./test.py -f 2-query/avg.py

# Run a single legacy TSIM test
cd tests/script && ./test.sh -f tsim/db/basic1.sim

# Run all CI cases
cd tests && ./run_all_ci_cases.sh -b main
```

## Architecture

TDengine is a distributed time-series database. The core is written in C with Python-based system tests.

### Source Layout (`source/`)

- **client/** – Client library (libtaos), CLI (`taos`), stmt2 API
- **dnode/** – Data node process (taosd)
- **mnode/** – Management node (metadata, DDL, cluster coordination)
- **vnode/** – Virtual node (data storage & query execution)
- `meta/` – Table metadata storage
- `tsdb/` – Time-series data engine
- `tq/` – Message queue (subscription/TMQ)
- **qnode/** – Query node (distributed query execution)
- **libs/** – Shared libraries used across components
- **parser/** – SQL parsing & semantic translation (`parTranslater.c` is the main translator)
- **planner/** – Query plan generation (logic → physi → split → scale-out)
- **executor/** – Physical plan operators (scan, join, aggregate, etc.)
- **nodes/** – AST/plan node definitions, clone/serialize/traverse utilities
- **catalog/** – Metadata cache between client and mnode
- **transport/** – RPC framework
- **sync/** – Raft consensus
- **function/** – Built-in and UDF function implementations
- **common/** – Shared data types, time utilities, message definitions
- **os/** – OS abstraction layer
- **util/** – General utilities (hash, array, queue, etc.)

### Headers (`include/`)

- `include/common/tmsg.h` – All inter-node message types and `ENodeType` enum
- `include/libs/nodes/` – Node type definitions:
- `nodes.h` – Base node, list macros (FOREACH, WHERE_EACH, etc.)
- `querynodes.h` – AST expression/statement nodes
- `plannodes.h` – Logical and physical plan nodes
- `cmdnodes.h` – DDL command nodes

### Query Pipeline

SQL → Parser (`parAstCreater.c`) → Translator (`parTranslater.c`) → Logic Plan (`planLogicCreater.c`) → Optimizer (`planOptimizer.c`) → Physical Plan (`planPhysiCreater.c`) → Splitter (`planSpliter.c`) → Scale Out (`planScaleOut.c`) → Executor operators

### Tools (`tools/`)

- **tdgpt/** – AI agent for time-series analytics (Python)
- **shell/** – Interactive CLI (taos)
- **taos-tools/** – taosBenchmark, taosdump (submodule)

## Key Conventions

### Error Handling Pattern

Check failure on line 87 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Headings should be surrounded by blank lines

.github/copilot-instructions.md:87 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Error Handling Pattern"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
Functions return `int32_t` error codes. Use `TSDB_CODE_SUCCESS` (0) for success. Common pattern:
```c

Check failure on line 89 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Fenced code blocks should be surrounded by blank lines

.github/copilot-instructions.md:89 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```c"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
int32_t code = TSDB_CODE_SUCCESS;
// ... operations ...
if (TSDB_CODE_SUCCESS != code) {
goto _end;
}
```

### Node System

Check failure on line 97 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Headings should be surrounded by blank lines

.github/copilot-instructions.md:97 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Node System"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
When adding a new node type:
1. Add enum to `ENodeType` in `include/common/tmsg.h`

Check failure on line 99 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Lists should be surrounded by blank lines

.github/copilot-instructions.md:99 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. Add enum to `ENodeType` in ..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md
2. Define struct in the appropriate header (`querynodes.h`, `plannodes.h`, or `cmdnodes.h`)
3. Add clone logic in `nodesCloneFuncs.c` (use `COPY_SCALAR_FIELD`, `CLONE_NODE_FIELD`, etc.)
4. Add serialization in `nodesCodeFuncs.c`
5. Add creation in `nodesUtilFuncs.c`
6. Add name mapping in `nodesCodeFuncs.c` (`nodesNodeName()`)

### Naming Conventions

Check failure on line 106 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Headings should be surrounded by blank lines

.github/copilot-instructions.md:106 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Naming Conventions"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
- Prefix: `t` or `taos` for public APIs, `td` for internal types

Check failure on line 107 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Lists should be surrounded by blank lines

.github/copilot-instructions.md:107 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Prefix: `t` or `taos` for pu..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md
- Structs: `S` prefix (e.g., `SLogicNode`, `SSelectStmt`)
- Enums: `E` prefix (e.g., `ENodeType`, `EDataOrderLevel`)
- Pointer params: `p` prefix (e.g., `pNode`, `pCxt`)
- Output params: double-pointer `pp` prefix or single pointer with comment

### Code Style

Check failure on line 113 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Headings should be surrounded by blank lines

.github/copilot-instructions.md:113 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Code Style"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
- Configured via `.clang-format` (Google-based, 2-space indent, 120 column limit)

Check failure on line 114 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Lists should be surrounded by blank lines

.github/copilot-instructions.md:114 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Configured via `.clang-forma..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md
- Braces on same line (Attach style)
- Pointer alignment: right-aligned (`char *p`)

### Test Integration

Check failure on line 118 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Headings should be surrounded by blank lines

.github/copilot-instructions.md:118 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Test Integration"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
To add a new test case to CI, edit `tests/parallel_test/cases.task`:
```

Check failure on line 120 in .github/copilot-instructions.md

View workflow job for this annotation

GitHub Actions / check-with-markdownlint

Fenced code blocks should be surrounded by blank lines

.github/copilot-instructions.md:120 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
#priority,rerunTimes,Run with Sanitizer,casePath,caseCommand
,,n,system-test, python3 ./test.py -f 2-query/your_test.py
```
Loading
Loading