From 1dc268e24979bdd78bd3b4a6e5a2b2125732301b Mon Sep 17 00:00:00 2001 From: Marko Topolnik Date: Mon, 4 Aug 2025 10:19:37 +0200 Subject: [PATCH 1/2] Document new array functions array_min, array_max, array_stddev_* --- .gitignore | 1 + documentation/reference/function/array.md | 105 ++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/.gitignore b/.gitignore index c7b3a98a7..3a7a38573 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ plugins/*/compiled snippets/db snippets/package-lock.json snippets/yarn.lock +CLAUDE.md npm-debug.log* yarn-debug.log* diff --git a/documentation/reference/function/array.md b/documentation/reference/function/array.md index 294578040..4a997d182 100644 --- a/documentation/reference/function/array.md +++ b/documentation/reference/function/array.md @@ -70,6 +70,46 @@ SELECT array_cum_sum(ARRAY[ [1.0, 1.0], [2.0, 2.0] ]); | ---------------------- | | ARRAY[1.0,2.0,4.0,6.0] | +## array_max + +`array_max(array)` returns the maximum value from all the array elements. `NULL` +elements and non-finite values (NaN, Infinity) are ignored. If the array +contains no finite values, the function returns `NULL`. + +#### Parameter + +- `array` — the array + +#### Example + +```questdb-sql +SELECT array_max(ARRAY[ [1.0, 5.0], [3.0, 2.0] ]); +``` + +| array_max | +| --------- | +| 5.0 | + +## array_min + +`array_min(array)` returns the minimum value from all the array elements. `NULL` +elements and non-finite values (NaN, Infinity) are ignored. If the array +contains no finite values, the function returns `NULL`. + +#### Parameter + +- `array` — the array + +#### Example + +```questdb-sql +SELECT array_min(ARRAY[ [1.0, 5.0], [3.0, 2.0] ]); +``` + +| array_min | +| --------- | +| 1.0 | + ## array_position `array_position(array, elem)` returns the position of `elem` inside the 1D `array`. If @@ -112,6 +152,71 @@ SELECT array_sum(ARRAY[ [1.0, 1.0], [2.0, 2.0] ]); | --------- | | 6.0 | +## array_stddev + +`array_stddev(array)` returns the sample standard deviation of all the array +elements. This is an alias for `array_stddev_samp()`. `NULL` elements and +non-finite values (NaN, Infinity) are ignored. If the array contains fewer than +2 finite values, the function returns `NULL`. + +#### Parameter + +- `array` — the array + +#### Example + +```questdb-sql +SELECT array_stddev(ARRAY[ [1.0, 2.0], [3.0, 4.0] ]); +``` + +| array_stddev | +| ------------ | +| 1.29099445 | + +## array_stddev_pop + +`array_stddev_pop(array)` returns the population standard deviation of all the +array elements. `NULL` elements and non-finite values (NaN, Infinity) are +ignored. The population standard deviation uses N in the denominator of the +standard deviation formula. If the array contains no finite values, the function +returns `NULL`. + +#### Parameter + +- `array` — the array + +#### Example + +```questdb-sql +SELECT array_stddev_pop(ARRAY[ [1.0, 2.0], [3.0, 4.0] ]); +``` + +| array_stddev_pop | +| ---------------- | +| 1.11803399 | + +## array_stddev_samp + +`array_stddev_samp(array)` returns the sample standard deviation of all the +array elements. `NULL` elements and non-finite values (NaN, Infinity) are +ignored. The sample standard deviation uses N-1 in the denominator of the +standard deviation formula. If the array contains fewer than 2 finite values, +the function returns `NULL`. + +#### Parameter + +- `array` — the array + +#### Example + +```questdb-sql +SELECT array_stddev_samp(ARRAY[ [1.0, 2.0], [3.0, 4.0] ]); +``` + +| array_stddev_samp | +| ----------------- | +| 1.29099445 | + ## dim_length `dim_length(array, dim)` returns the length of the n-dimensional array along From 74ed001253730e319f9bc9d60e75a5db958fc0a9 Mon Sep 17 00:00:00 2001 From: Marko Topolnik Date: Fri, 8 Aug 2025 13:17:04 +0200 Subject: [PATCH 2/2] Unignore CLAUDE.md --- .gitignore | 1 - CLAUDE.md | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 CLAUDE.md diff --git a/.gitignore b/.gitignore index 3a7a38573..c7b3a98a7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ plugins/*/compiled snippets/db snippets/package-lock.json snippets/yarn.lock -CLAUDE.md npm-debug.log* yarn-debug.log* diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..fde4d0cec --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,97 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +This is a Docusaurus-based documentation site for QuestDB. Key commands: + +### Local Development +- `yarn start` - Start development server on port 3001 +- `yarn build` - Build production version +- `yarn serve` - Serve built site locally + +### Prerequisites +- Node.js and Yarn package manager +- Java (for railroad diagram generation) +- Python (for railroad diagram scripts) + +## Architecture Overview + +### Documentation Structure +- **Source**: Content lives in `/documentation/` directory +- **Static Assets**: Images, diagrams, and files in `/static/` +- **Components**: React components for documentation in `/src/components/` +- **Themes**: Custom Docusaurus theme overrides in `/src/theme/` + +### Key Directories +- `documentation/` - Main documentation content (markdown/MDX files) +- `documentation/reference/` - API and SQL reference documentation +- `documentation/guides/` - User guides and tutorials +- `documentation/concept/` - Conceptual documentation +- `static/images/` - Documentation images and diagrams +- `src/components/` - Custom React components for docs +- `plugins/` - Custom Docusaurus plugins + +### Content Organization +- Documentation uses hierarchical structure with sidebars defined in `documentation/sidebars.js` +- Supports both `.md` and `.mdx` files +- Partial files (`.partial.mdx`) are excluded from routing but can be imported +- Math expressions supported via KaTeX +- Mermaid diagrams supported + +## Documentation Features + +### Special Syntax +- **QuestDB SQL**: Use `questdb-sql` language identifier for syntax highlighting +- **Railroad Diagrams**: SQL syntax diagrams generated via `scripts/railroad.py` +- **Math**: LaTeX-style math between `$` (inline) or `$$` (block) +- **Admonitions**: `:::note`, `:::tip`, `:::info`, `:::warning`, `:::danger` + +### Custom Components +- `` - Include code from other QuestDB repositories +- `` and `` - Tabbed content sections +- Various custom theme components in `src/theme/` + +### Image Optimization +- Lint-staged hook optimizes images automatically +- WebP conversion supported via `scripts/webp-converter.sh` +- Size checking via `scripts/check-size-hook.sh` + +## Development Workflow + +### Creating Railroad Diagrams +1. Use [Railroad online editor](https://www.bottlecaps.de/rr/ui) to design +2. Save syntax to `static/images/docs/diagrams/.railroad` +3. Run `python3 scripts/railroad.py [name]` to generate SVG +4. Include generated markdown in documentation + +### Content Guidelines +- Follow existing file naming conventions +- Use proper admonitions for important information +- Include code examples with appropriate language identifiers +- Optimize images before committing (handled automatically by hooks) + +### Linting and Formatting +- ESLint and Prettier configured for code quality +- JavaScript Standard Style rules enforced +- Format on save recommended in editor +- Webpack handles linting during development + +## Configuration + +### Key Config Files +- `docusaurus.config.js` - Main Docusaurus configuration +- `documentation/sidebars.js` - Documentation navigation structure +- `package.json` - Dependencies and scripts +- `tailwind.config.js` - Tailwind CSS configuration + +### Environment Variables +- `ALGOLIA_APP_ID` and `ALGOLIA_API_KEY` - Search functionality +- `NETLIFY` and `CONTEXT` - Build environment detection + +## Testing and Deployment +- Production builds minify CSS and disable update notifiers +- Preview builds use relaxed error handling +- Algolia search integration for documentation search +- PWA support configured with custom manifest \ No newline at end of file