Skip to content

Conversation

@xxsc0529
Copy link

@xxsc0529 xxsc0529 commented Nov 20, 2025

OceanBase Database is a distributed relational database.
It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster.
Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability.
Close #10638

Oceanbase supports vector storage and querying, and has strong vector ecological capabilities
image

Summary by CodeRabbit

  • New Features

    • OceanBase vector store integration with configurable connection, indexing, embedding, ingest and search capabilities.
    • OceanBase UI icon added for visual identification.
  • Improvements

    • Enhanced validation and clearer user-facing error messages for database connectivity and setup.
  • Tests

    • Comprehensive unit tests added covering build, search, indexing parameters, and error scenarios.
  • Chores

    • Added runtime dependency for OceanBase integration.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the community Pull Request from an external contributor label Nov 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds OceanBase support: dependency declaration, frontend icon components for the OceanBase logo, a lazy-export wrapper, a new OceanBaseVectorStoreComponent with connectivity/indexing/search logic, and unit tests covering build/search/error cases.

Changes

Cohort / File(s) Summary
Dependency Addition
pyproject.toml
Added dependency langchain-oceanbase>=0.2.0.
Frontend Icon Components
src/frontend/src/icons/OceanBase/OceanBase.jsx, src/frontend/src/icons/OceanBase/index.tsx
New SvgOceanBase React SVG component and OceanBaseIcon forwardRef wrapper exported for frontend use.
Backend Lazy Export
src/lfx/src/lfx/components/oceanbase/__init__.py
Added lazy-import registry and runtime loader exposing OceanBaseVectorStoreComponent via __all__, _dynamic_imports, __getattr__, and __dir__ with TYPE_CHECKING support.
Backend Vector Store Component
src/lfx/src/lfx/components/oceanbase/oceanbase.py
New OceanBaseVectorStoreComponent class: metadata, extensive inputs, build_vector_store, _get_index_params, _get_search_params, and search_documents with pymysql connectivity checks, ingestion, index param assembly, embedding usage, and score-threshold filtering.
Unit Tests
src/backend/tests/unit/components/vectorstores/test_oceanbase.py
Added comprehensive tests for building/searching/error paths, index param handling, pymysql absence, and parameter validation (mocks for OceanbaseVectorStore and pymysql).

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant OceanBaseComponent
    participant pymysql
    participant Embedding
    participant OceanbaseVectorStore

    Caller->>OceanBaseComponent: build_vector_store(args)
    OceanBaseComponent->>pymysql: open/test connection
    alt connection error
        pymysql-->>OceanBaseComponent: error
        OceanBaseComponent-->>Caller: raise ValueError
    else success
        OceanBaseComponent->>OceanBaseComponent: prepare documents & index params
        OceanBaseComponent->>Embedding: compute embeddings (if needed)
        OceanBaseComponent->>OceanbaseVectorStore: create via from_texts(...) or init(...)
        OceanbaseVectorStore-->>OceanBaseComponent: store instance
        OceanBaseComponent-->>Caller: return store
    end

    Caller->>OceanBaseComponent: search_documents(query, params)
    OceanBaseComponent->>OceanbaseVectorStore: perform similarity search / retriever
    OceanbaseVectorStore-->>OceanBaseComponent: docs + scores
    alt similarity_score_threshold set
        OceanBaseComponent->>OceanBaseComponent: filter by score
    end
    OceanBaseComponent-->>Caller: List[Data]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus:
    • src/lfx/src/lfx/components/oceanbase/oceanbase.py: index parameter assembly for HNSW/IVF/IVF_PQ/FLAT and defaults.
    • pymysql import and connection validation/error messages.
    • build vs from_texts creation paths and embedding/metadata handling.
    • Lazy import behavior and caching in src/lfx/src/lfx/components/oceanbase/init.py.
    • Unit tests alignment with production behavior and mocked interfaces.

Suggested reviewers

  • italojohnny

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR lacks test coverage for frontend icon components (SvgOceanBase, OceanBaseIcon) despite new public exports, violating project's established testing conventions. Add frontend unit tests for icon components at src/frontend/src/icons/OceanBase/tests/ following project conventions.
Test Quality And Coverage ⚠️ Warning Tests have linting violations (TRY003 and EM101) in test_oceanbase.py lines 155-158 and FLAT index type is tested but missing from UI options list in oceanbase.py line 40. Fix linting violations in test_oceanbase.py lines 155-158, add FLAT to index_type options in oceanbase.py line 40, run linting checks, and verify all test fixtures properly mock dependencies.
Test File Naming And Structure ⚠️ Warning The test file src/backend/tests/unit/components/vectorstores/test_oceanbase.py referenced in the PR summary does not exist in the repository. Create and commit the test file at the specified path with all 16 test methods in a TestOceanBaseVectorStoreComponent class following pytest conventions.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add oceanbase vector store support' directly and clearly describes the main change: adding OceanBase as a new vector store backend.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements: adds OceanBase vector store component with multiple indexing strategies (HNSW, IVF, FLAT), integrates UI components, adds dependencies, and enables vector search capabilities.
Out of Scope Changes check ✅ Passed All changes are scoped to OceanBase integration: dependency addition, icon components, lazy-loaded vector store component, comprehensive tests, and configuration. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.
Excessive Mock Usage Warning ✅ Passed Mock usage is appropriate and follows good testing practices. All mocked objects are external dependencies properly isolated from the unit tests.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 20, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)

19-20: Reconsider priority and recommended settings for a new component.

Setting priority = 0 and recommended = True makes this component appear first and marked as recommended. For a newly added community contribution, consider using default priority values and letting the component prove itself before marking it as recommended.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5645d and 395ee3b.

⛔ Files ignored due to path filters (2)
  • src/frontend/src/assets/oceanbase_logo.png is excluded by !**/*.png
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • pyproject.toml (1 hunks)
  • src/backend/tests/unit/components/vectorstores/test_oceanbase.py (1 hunks)
  • src/frontend/src/icons/OceanBase/OceanBase.jsx (1 hunks)
  • src/frontend/src/icons/OceanBase/index.tsx (1 hunks)
  • src/lfx/src/lfx/components/oceanbase/__init__.py (1 hunks)
  • src/lfx/src/lfx/components/oceanbase/oceanbase.py (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
📚 Learning: 2025-06-16T11:14:04.200Z
Learnt from: dolfim-ibm
Repo: langflow-ai/langflow PR: 8394
File: src/frontend/src/icons/Docling/index.tsx:4-6
Timestamp: 2025-06-16T11:14:04.200Z
Learning: The Langflow codebase consistently uses `React.PropsWithChildren<{}>` as the prop type for all icon components using forwardRef, rather than `React.SVGProps<SVGSVGElement>`. This is an established pattern across hundreds of icon files in src/frontend/src/icons/.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
  • src/frontend/src/icons/OceanBase/OceanBase.jsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
🧬 Code graph analysis (4)
src/lfx/src/lfx/components/oceanbase/__init__.py (1)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)
  • OceanBaseVectorStoreComponent (9-260)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (3)
src/backend/base/langflow/helpers/data.py (1)
  • docs_to_data (14-23)
src/lfx/src/lfx/inputs/inputs.py (7)
  • BoolInput (418-431)
  • DropdownInput (470-496)
  • FloatInput (382-415)
  • HandleInput (74-85)
  • IntInput (346-379)
  • SecretStrInput (287-343)
  • StrInput (126-182)
src/lfx/src/lfx/schema/data.py (2)
  • Data (26-288)
  • to_lc_document (142-152)
src/frontend/src/icons/OceanBase/index.tsx (1)
src/frontend/src/icons/OceanBase/OceanBase.jsx (2)
  • SvgOceanBase (3-26)
  • SvgOceanBase (3-26)
src/backend/tests/unit/components/vectorstores/test_oceanbase.py (2)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (5)
  • OceanBaseVectorStoreComponent (9-260)
  • build_vector_store (93-188)
  • _get_index_params (190-214)
  • _get_search_params (216-227)
  • search_documents (229-260)
src/lfx/src/lfx/schema/data.py (1)
  • Data (26-288)
🪛 GitHub Actions: Ruff Style Check
src/backend/tests/unit/components/vectorstores/test_oceanbase.py

[error] 157-157: Ruff lint error: TRY003 Avoid specifying long messages outside the exception class.

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/tests/unit/components/vectorstores/test_oceanbase.py

[failure] 157-157: Ruff (EM101)
src/backend/tests/unit/components/vectorstores/test_oceanbase.py:157:35: EM101 Exception must not use a string literal, assign to variable first


[failure] 157-157: Ruff (TRY003)
src/backend/tests/unit/components/vectorstores/test_oceanbase.py:157:23: TRY003 Avoid specifying long messages outside the exception class

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Test Docker Images / Test docker images
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Run Frontend Unit Tests / Frontend Jest Unit Tests
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Lint Backend / Run Mypy (3.12)
  • GitHub Check: Test Starter Templates
  • GitHub Check: Update Component Index
🔇 Additional comments (10)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (4)

190-214: Well-implemented index parameter logic.

The method correctly handles all supported index types with appropriate parameters and provides a sensible fallback to HNSW for unknown types.


216-227: Good search parameter handling.

The method correctly provides index-specific search parameters with a sensible fallback, consistent with the _get_index_params approach.


229-260: Robust search implementation.

The method handles query validation, score threshold parsing with proper error handling, and correctly uses the vector store's retriever API with appropriate search parameters.


126-132: Port conversion to string is correct and matches library requirements.

The langchain-oceanbase library expects the port as a string in connection_args (e.g., "2881"), and the code correctly converts it using str(self.port) at line 128. This implementation aligns with the documented examples and requirements.

src/lfx/src/lfx/components/oceanbase/__init__.py (1)

1-34: LGTM! Standard lazy loading pattern.

The implementation follows the established lazy loading pattern in the codebase with proper error handling and caching.

src/backend/tests/unit/components/vectorstores/test_oceanbase.py (1)

1-453: Excellent test coverage.

The test suite comprehensively covers building vector stores, error scenarios, parameter handling for different index types, and search functionality including edge cases like empty queries and invalid score thresholds.

src/frontend/src/icons/OceanBase/index.tsx (1)

1-10: LGTM! Follows established icon patterns.

The component correctly uses forwardRef with React.PropsWithChildren<{}> as the prop type, consistent with the codebase convention for icon components.

Based on learnings

src/frontend/src/icons/OceanBase/OceanBase.jsx (2)

3-26: Icon component structure looks good.

The SVG wrapper correctly embeds the logo image with appropriate sizing and preserveAspectRatio settings. The filter: "none" style prevents unwanted CSS filter inheritance.


1-1: No issues found—asset exists at the expected path.

The verification confirms that oceanbase_logo.png is present at src/frontend/src/assets/, matching the import path in the code. The import statement is valid.

pyproject.toml (1)

93-93: No issues found.

The package langchain-oceanbase exists on PyPI with multiple released versions including 0.2.0. The dependency constraint >=0.2.0 is valid, and no security vulnerabilities were reported for this package.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 21, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 21, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 21, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 21, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant