Skip to content

add support for clickhouse for enterprise logstore tables - #5182

Merged
akshaydeo merged 1 commit into
devfrom
07-14-add_support_for_clickhouse_for_enterprise_logstore_tables
Jul 15, 2026
Merged

add support for clickhouse for enterprise logstore tables#5182
akshaydeo merged 1 commit into
devfrom
07-14-add_support_for_clickhouse_for_enterprise_logstore_tables

Conversation

@SahilChoudhary22

Copy link
Copy Markdown
Contributor

Summary

Briefly explain the purpose of this PR and the problem it solves.

Changes

  • What was changed and why
  • Any notable design decisions or trade-offs

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Describe the steps to validate this change. Include commands and expected outcomes.

# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

If adding new configs or environment variables, document them here.

Screenshots/Recordings

If UI changes, add before/after screenshots or short clips.

Breaking changes

  • Yes
  • No

If yes, describe impact and migration instructions.

Related issues

Link related issues and discussions. Example: Closes #123

Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 71a27a60-17d9-4efa-a2f4-7288fd4da9de

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe15e8 and 2bbe767.

📒 Files selected for processing (2)
  • framework/logstore/clickhouseextension.go
  • framework/logstore/clickhousestore_test.go
📝 Walkthrough

Walkthrough

Adds ClickHouse extension-table creation and column reconciliation to direct and hybrid log stores, with validation for identifiers and ordering options. An integration test covers table options, hybrid delegation, row queries, and generated ClickHouse DDL.

Changes

ClickHouse extension-table management

Layer / File(s) Summary
Extension-table schema management
framework/logstore/clickhouseextension.go
Adds the schema-store interface and conformance checks, validates extension-table inputs, creates tables with configured options, reconciles columns, and delegates hybrid-store calls.
Extension-table integration validation
framework/logstore/clickhousestore_test.go
Tests invalid table-name rejection, configured table creation, hybrid delegation, row querying, and generated engine, TTL, and index definitions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant HybridLogStore
  participant ClickHouseLogStore
  participant ClickHouse
  Caller->>HybridLogStore: EnsureClickHouseTable(...)
  HybridLogStore->>ClickHouseLogStore: Delegate extension-table request
  ClickHouseLogStore->>ClickHouse: Create table with partition, order, TTL, and indexes
  ClickHouseLogStore->>ClickHouse: Reconcile model columns
  ClickHouse-->>Caller: Return success or error
Loading

Suggested reviewers: danpiths, akshaydeo

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only the unfilled template and lacks a real summary, changes, testing steps, and related issues. Replace the placeholder template with concrete details for each required section, especially summary, changes, testing, related issues, and security considerations.
Linked Issues check ⚠️ Warning The PR implements ClickHouse logstore table support, not File API support for uploads, RAG, or /v1/files. Revise the code to add File API endpoints and storage flows for uploads, retrieval, and fine-tuning support, or relink the PR to the correct issue.
Out of Scope Changes check ⚠️ Warning The changes add ClickHouse schema management and tests, which are unrelated to the linked Files API support objective. Remove the unrelated ClickHouse work or split it into a separate PR tied to the correct issue.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main ClickHouse logstore table support change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@SahilChoudhary22
SahilChoudhary22 force-pushed the 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables branch from 90d34f7 to 1fe15e8 Compare July 14, 2026 10:48
@SahilChoudhary22
SahilChoudhary22 marked this pull request as ready for review July 14, 2026 10:49
@coderabbitai
coderabbitai Bot requested review from akshaydeo and danpiths July 14, 2026 10:50
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

This is close, but the DDL fragment boundary should be fixed before merging.

  • Extension table names are now checked against the current core ClickHouse tables.
  • Raw partition, TTL, and skip-index clauses can still be passed into table creation unchanged.
  • Config-driven extension callers can still make table creation fail or generate unintended DDL.

framework/logstore/clickhouseextension.go

Security Review

Raw ClickHouse DDL fragments can still pass through the exported extension-table API without validation when callers populate them from config.

Important Files Changed

Filename Overview
framework/logstore/clickhouseextension.go Adds the extension-table schema API, hybrid delegation, and validation for table names.
framework/logstore/clickhousestore_test.go Adds ClickHouse tests for extension table creation, hybrid delegation, reserved names, and valid ClickHouse syntax.

Reviews (3): Last reviewed commit: "add support for clickhouse for enterpris..." | Re-trigger Greptile

Comment thread framework/logstore/clickhouseextension.go Outdated
Comment thread framework/logstore/clickhouseextension.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
framework/logstore/clickhousestore_test.go (1)

94-95: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing negative test for the "unsupported inner store" branch.

The test only exercises the success path of HybridLogStore.EnsureClickHouseTable delegation. The !ok branch (inner store doesn't implement clickHouseSchemaStore) in framework/logstore/clickhouseextension.go lines 49-55 has no coverage here. Consider wrapping a store that doesn't implement clickHouseSchemaStore (if one is available in this package, e.g. a bare RDBLogStore) and asserting the "does not support ClickHouse extension tables" error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/logstore/clickhousestore_test.go` around lines 94 - 95, Extend the
tests for HybridLogStore.EnsureClickHouseTable with a negative case using an
inner store that does not implement clickHouseSchemaStore, such as a bare
RDBLogStore if available. Assert that the call returns the expected “does not
support ClickHouse extension tables” error, while preserving the existing
successful delegation test.
framework/logstore/clickhouseextension.go (1)

12-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider an options struct instead of 4 positional strings.

table, partitionBy, orderBy, ttl are all string and adjacent in the signature — easy for a caller to accidentally transpose two arguments with no compiler help. The package already has chTableOpts (in clickhousemigrate.go) with the same shape; exposing an equivalent public struct for EnsureClickHouseTable's parameters would remove this footgun for future callers.

♻️ Sketch of an options-struct signature
-type clickHouseSchemaStore interface {
-	EnsureClickHouseTable(ctx context.Context, model any, table, partitionBy, orderBy, ttl string, skipIndexes []string) error
-}
+type ClickHouseExtensionTableOptions struct {
+	Table       string
+	PartitionBy string
+	OrderBy     string
+	TTL         string
+	SkipIndexes []string
+}
+
+type clickHouseSchemaStore interface {
+	EnsureClickHouseTable(ctx context.Context, model any, opts ClickHouseExtensionTableOptions) error
+}

Also applies to: 23-23

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/logstore/clickhouseextension.go` around lines 12 - 14, Replace the
adjacent string parameters in clickHouseSchemaStore.EnsureClickHouseTable with a
public options struct equivalent to chTableOpts, while retaining ctx, model, and
skipIndexes as appropriate. Update the interface, implementation, and all call
sites to pass the named options fields, preserving the existing table,
partitionBy, orderBy, and ttl values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@framework/logstore/clickhouseextension.go`:
- Around line 12-14: Replace the adjacent string parameters in
clickHouseSchemaStore.EnsureClickHouseTable with a public options struct
equivalent to chTableOpts, while retaining ctx, model, and skipIndexes as
appropriate. Update the interface, implementation, and all call sites to pass
the named options fields, preserving the existing table, partitionBy, orderBy,
and ttl values.

In `@framework/logstore/clickhousestore_test.go`:
- Around line 94-95: Extend the tests for HybridLogStore.EnsureClickHouseTable
with a negative case using an inner store that does not implement
clickHouseSchemaStore, such as a bare RDBLogStore if available. Assert that the
call returns the expected “does not support ClickHouse extension tables” error,
while preserving the existing successful delegation test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 776107ee-97d1-4eb6-a4fc-7075f6a779be

📥 Commits

Reviewing files that changed from the base of the PR and between f4f4039 and 1fe15e8.

📒 Files selected for processing (2)
  • framework/logstore/clickhouseextension.go
  • framework/logstore/clickhousestore_test.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
@SahilChoudhary22
SahilChoudhary22 force-pushed the 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables branch from 1fe15e8 to 2c581a3 Compare July 14, 2026 11:20
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
Comment thread framework/logstore/clickhouseextension.go Outdated
@SahilChoudhary22
SahilChoudhary22 force-pushed the 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables branch from 2c581a3 to 2bbe767 Compare July 14, 2026 11:38
Comment thread framework/logstore/clickhouseextension.go

akshaydeo commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jul 15, 4:59 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 15, 4:59 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 91558a5 into dev Jul 15, 2026
16 checks passed
@akshaydeo
akshaydeo deleted the 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables branch July 15, 2026 04:59
@akshaydeo
akshaydeo restored the 07-14-add_support_for_clickhouse_for_enterprise_logstore_tables branch July 15, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files API Support

3 participants