Skip to content

feat: add MongoDB external table scan - #26424

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:m-26229
Jul 31, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:m-26229

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

Add tenant-scoped MongoDB connection DDL and catalog metadata, secure driver-backed scanning, conversion and predicate semantics, downstream aggregation support, and complete ALTER/DROP/account lifecycle handling across CNs. Include one connector E2E CI job, regression coverage, and customer-neutral operational templates.

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #26229

What this PR does / why we need it:

feat: add MongoDB external table scan

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Jul 30, 2026

@XuPeng-SH XuPeng-SH 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.

Blocking correctness issue: the external-table DDL accepts NOT NULL, but ParseTableMappingSpec drops planned.Typ.NotNullable when it builds ColumnMapping (mapping.go:137-144), and the runtime converter unconditionally appends NULL for missing/BSON null/undefined values and for try_null conversion failures (converter.go:138-143, 153-164). I reproduced this end to end at the component boundary with CREATE EXTERNAL TABLE t (v BIGINT NOT NULL MONGODB_CONVERT "try_null") ...: mapping succeeds with the plan column marked NotNullable=true, then an empty BSON document produces a NULL in the output vector. This violates a planner-visible schema invariant and can make nullability-based rewrites/join reasoning unsound. Please either reject NOT NULL (and other unenforceable constraints) on MongoDB external columns, or carry nullability through catalog/plan metadata and make the converter fail rather than emit NULL for a non-nullable mapping. Add coverage for missing, explicit BSON null, and try_null conversion failure on a declared NOT NULL column.

@fengttt fengttt 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.

Wait, why does mongo db has anything to do with frontend?

@XuPeng-SH XuPeng-SH 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.

Deep re-reviewed exact head b7ec571875852b6d691a7543ef8dd9f422b88af8: no blocking findings. The previous NOT NULL correctness blocker is closed end to end: declared nullability is captured from the planned TableDef, persisted in catalog mapping JSON, preserved through protobuf plan conversion, and enforced by the runtime converter for missing paths, BSON null/undefined, invalid traversal, and try_null conversion failures. Error rollback restores every vector and the batch row count, so a rejected document cannot leave a partial row.

Fresh local evidence: converter/catalog NOT NULL tests pass under -race -count=10, the planner DDL round-trip test passes, and go build plus go vet pass for pkg/sql/mongodb, pkg/sql/colexec/mongoscan, and pkg/sql/plan. Final diff is clean, latest CI is green, and the PR remains MERGEABLE.

@XuPeng-SH

Copy link
Copy Markdown
Contributor

@iamlinjunhong conflict

Add tenant-scoped MongoDB connection DDL and catalog metadata, secure driver-backed scanning, conversion and predicate semantics, downstream aggregation support, and complete ALTER/DROP/account lifecycle handling across CNs. Include one connector E2E CI job, regression coverage, and customer-neutral operational templates.
@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@iamlinjunhong conflict

fixed

@mergify

mergify Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-31 03:32 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-31 04:09 UTC · at 1bd0cd39cb09ddfa81b3cc57aec5a031aeed78cf · squash

This pull request spent 37 minutes 12 seconds in the queue, including 36 minutes 54 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants