Skip to content

Commit 67efe3f

Browse files
authored
Merge branch 'main' into checked-decimal-multiply
2 parents 0118b9e + 600b0ba commit 67efe3f

File tree

399 files changed

+11864
-1897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+11864
-1897
lines changed

.claude/CLAUDE.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# CLAUDE.md
2+
3+
Guidance for Claude Code when working in the Velox repository.
4+
5+
## Overview
6+
7+
Velox is an open source C++ library for composable data processing and
8+
query execution. Licensed under Apache 2.0. Requires C++20, GCC 11+ or
9+
Clang 15+.
10+
11+
## Build
12+
13+
```bash
14+
make debug # debug build
15+
make release # optimized build
16+
```
17+
18+
## Testing
19+
20+
```bash
21+
make unittest # run all tests
22+
cd _build/debug && ctest -j 8 # run all tests in parallel
23+
ctest -R ExprTest # run tests matching a pattern
24+
```
25+
26+
Test files live in `tests/` subdirectories alongside source.
27+
28+
## Formatting
29+
30+
```bash
31+
make format # format all changed files
32+
```
33+
34+
## Coding Style
35+
36+
Read [CODING_STYLE.md](../CODING_STYLE.md) for the complete guide. Key rules
37+
are summarized below.
38+
39+
### Comments
40+
41+
- Use `///` for public API documentation (classes, public methods, public members).
42+
- Use `//` for private/protected members and comments inside code blocks.
43+
- Start comments with active verbs, not "This class…" or "This method…".
44+
-`/// This class builds query plans.`
45+
-`/// Builds query plans.`
46+
- Comments should be full English sentences starting with a capital letter and ending with a period.
47+
- Comment every class, every non-trivial method, every member variable.
48+
- Do not restate the variable name. Either explain the semantic meaning or omit the comment.
49+
-`// A simple counter.` above `size_t count_{0};`
50+
- Avoid redundant comments that repeat what the code already says. Comments should explain *why*, not *what*.
51+
- Use `// TODO: Description.` for future work. Do not include author's username.
52+
53+
### Naming Conventions
54+
55+
- **PascalCase** for types and file names.
56+
- **camelCase** for functions, member and local variables.
57+
- **camelCase_** for private and protected member variables.
58+
- **snake_case** for namespace names and build targets.
59+
- **UPPER_SNAKE_CASE** for macros.
60+
- **kPascalCase** for static constants and enumerators.
61+
- Do not abbreviate. Use full, descriptive names. Well-established abbreviations (`id`, `url`, `sql`, `expr`) are acceptable.
62+
- Prefer `numXxx` over `xxxCount` (e.g. `numRows`, `numKeys`).
63+
64+
### Asserts and CHECKs
65+
66+
- Use `VELOX_CHECK_*` for internal errors, `VELOX_USER_CHECK_*` for user errors.
67+
- Prefer two-argument forms: `VELOX_CHECK_LT(idx, size)` over `VELOX_CHECK(idx < size)`.
68+
- Use `VELOX_FAIL()` / `VELOX_USER_FAIL()` to throw unconditionally.
69+
- Use `VELOX_UNREACHABLE()` for impossible branches, `VELOX_NYI()` for unimplemented paths.
70+
- Put runtime information (names, values, types) at the **end** of error messages, after the static description.
71+
-`VELOX_USER_FAIL("Column '{}' is ambiguous", name);`
72+
-`VELOX_USER_FAIL("Column is ambiguous: {}", name);`
73+
74+
### Variables
75+
76+
- Prefer value types, then `std::optional`, then `std::unique_ptr`.
77+
- Prefer `std::string_view` over `const std::string&` for function parameters.
78+
- Use uniform initialization: `size_t size{0}` over `size_t size = 0`.
79+
- Declare variables in the smallest scope, as close to usage as possible.
80+
- Use digit separators (`'`) for numeric literals with 4 or more digits: `10'000`, not `10000`.
81+
82+
### API Design
83+
84+
- Keep the public API surface small.
85+
- Prefer free functions in `.cpp` (anonymous namespace) over private/static class methods.
86+
- Keep method implementations in `.cpp` except for trivial one-liners.
87+
- Avoid default arguments when all callers can pass values explicitly.
88+
89+
### Tests
90+
91+
- Place new tests next to related existing tests, not at the end of the file. Group tests by topic (e.g., place `tryCast` next to `types`, `notBetween` next to `ifClause` which uses `between`).
92+
93+
Use gtest container matchers (`testing::ElementsAre`, etc.) for verifying collections:
94+
95+
```cpp
96+
// ❌ Avoid - multiple individual assertions
97+
EXPECT_EQ(result.size(), 3);
98+
EXPECT_EQ(result[0], "a");
99+
EXPECT_EQ(result[1], "b");
100+
EXPECT_EQ(result[2], "c");
101+
102+
// ✅ Prefer - single matcher assertion
103+
EXPECT_THAT(result, testing::ElementsAre("a", "b", "c"));
104+
```
105+
106+
Common matchers:
107+
- `ElementsAre(...)` - exact ordered match
108+
- `UnorderedElementsAre(...)` - exact unordered match
109+
- `Contains(...)` - at least one element matches
110+
- `IsEmpty()` - collection is empty
111+
- `SizeIs(n)` - collection has n elements
112+
113+
Requires `#include <gmock/gmock.h>`.

0 commit comments

Comments
 (0)