Skip to content

fix(starrocks): ingest table comments from StarRocks (#26692) #27030

Closed
SaaiAravindhRaja wants to merge 4 commits intoopen-metadata:mainfrom
SaaiAravindhRaja:fix/issue-26692-starrocks-table-comments
Closed

fix(starrocks): ingest table comments from StarRocks (#26692) #27030
SaaiAravindhRaja wants to merge 4 commits intoopen-metadata:mainfrom
SaaiAravindhRaja:fix/issue-26692-starrocks-table-comments

Conversation

@SaaiAravindhRaja
Copy link
Copy Markdown
Contributor

Fixes #26692

Fixes table-level COMMENT not being ingested from StarRocks due to SQLAlchemy MySQL dialect reflection not parsing comments from multi-line CREATE TABLE statements.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Comment thread ingestion/src/metadata/ingestion/source/database/starrocks/metadata.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@SaaiAravindhRaja SaaiAravindhRaja changed the title fix(starrocks): ingest table comments from StarRocks (#26692) fix(starrocks): ingest table comments from StarRocks (#26692) [WIP] Apr 4, 2026
@SaaiAravindhRaja SaaiAravindhRaja marked this pull request as ready for review April 4, 2026 11:16
@SaaiAravindhRaja SaaiAravindhRaja requested a review from a team as a code owner April 4, 2026 11:16
Copilot AI review requested due to automatic review settings April 4, 2026 11:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the StarRocks ingestion logic to reliably ingest table-level COMMENT values by bypassing SQLAlchemy MySQL dialect reflection and querying information_schema.tables directly (fixing #26692).

Changes:

  • Add a StarRocks-specific query (STARROCKS_TABLE_COMMENTS) usage to retrieve TABLE_COMMENT.
  • Replace inspector.get_table_comment(...)-based table description extraction with a direct information_schema query.

@staticmethod
def get_table_description(
schema_name: str, table_name: str, inspector: Inspector
self, schema_name: str, table_name: str, inspector: Inspector
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

inspector parameter is now unused, which will trigger unused-argument linting and makes the signature misleading. Consider renaming it to _inspector or explicitly disabling the unused-argument warning for this method while keeping the parameter to satisfy the base interface.

Suggested change
self, schema_name: str, table_name: str, inspector: Inspector
self, schema_name: str, table_name: str, _inspector: Inspector

Copilot uses AI. Check for mistakes.
Comment on lines +279 to +286
with self.engine.connect() as conn:
rows = conn.execute(
sql.text(STARROCKS_TABLE_COMMENTS),
{"table_name": table_name, "schema": schema_name},
)
for row in rows:
description = row[0]
break
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

This opens a new SQLAlchemy connection for every table description lookup (self.engine.connect()), which can add significant overhead during large ingestions and bypasses the per-thread cached connection provided by CommonDbSourceService.connection (common_db_source.py:754-764). Prefer executing the query via self.connection (or inspector.bind) and fetching a single scalar row (e.g., fetchone/scalar) to avoid iterating the full result set.

Suggested change
with self.engine.connect() as conn:
rows = conn.execute(
sql.text(STARROCKS_TABLE_COMMENTS),
{"table_name": table_name, "schema": schema_name},
)
for row in rows:
description = row[0]
break
row = self.connection.execute(
sql.text(STARROCKS_TABLE_COMMENTS),
{"table_name": table_name, "schema": schema_name},
).fetchone()
if row:
description = row[0]

Copilot uses AI. Check for mistakes.
Comment on lines +274 to +292
def get_table_description(
schema_name: str, table_name: str, inspector: Inspector
self, schema_name: str, table_name: str, inspector: Inspector
) -> Optional[str]:
description = None
try:
table_info: dict = inspector.get_table_comment(table_name, schema_name)
with self.engine.connect() as conn:
rows = conn.execute(
sql.text(STARROCKS_TABLE_COMMENTS),
{"table_name": table_name, "schema": schema_name},
)
for row in rows:
description = row[0]
break
except Exception as exc: # pylint: disable=broad-except
logger.debug(traceback.format_exc())
logger.warning(
f"Table description error for table [{schema_name}.{table_name}]: {exc}"
)
else:
description = table_info.get("text")

if description is None:
return None
if isinstance(description, (list, tuple)) and len(description) > 0:
return description[0]
return description
return description or None
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

New logic for fetching StarRocks table comments is untested. There are existing unit tests for the StarRocks connector (e.g., ingestion/tests/unit/topology/database/test_starrocks.py), but none validating that get_table_description returns the TABLE_COMMENT from information_schema.tables. Adding a unit test that mocks the connection execute result would help prevent regressions for issue #26692.

Copilot generated this review using guidance from repository custom instructions.
@SaaiAravindhRaja SaaiAravindhRaja changed the title fix(starrocks): ingest table comments from StarRocks (#26692) [WIP] fix(starrocks): ingest table comments from StarRocks (#26692) Apr 5, 2026
@ulixius9
Copy link
Copy Markdown
Member

ulixius9 commented Apr 6, 2026

@SaaiAravindhRaja can you please check copilot comments

@SaaiAravindhRaja SaaiAravindhRaja force-pushed the fix/issue-26692-starrocks-table-comments branch from b6ab03d to 8e78525 Compare April 12, 2026 12:58
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@SaaiAravindhRaja
Copy link
Copy Markdown
Contributor Author

@ulixius9 Worked on the copilot comments, thanks for the heads up 😄

@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 12, 2026

Code Review ✅ Approved 1 resolved / 1 findings

Adds table comment ingestion support for StarRocks with a trailing newline correction. No issues found.

✅ 1 resolved
Bug: PR contains no functional change — only a trailing newline added

📄 ingestion/src/metadata/ingestion/source/database/starrocks/metadata.py:529
The PR claims to fix table-level COMMENT ingestion from StarRocks (#26692), but the only change in the diff is a blank line appended after line 528 of metadata.py. There is no functional code change whatsoever.

The commit message says "WIP", which confirms the fix has not actually been implemented yet. This PR should not be merged in its current state.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@PubChimps
Copy link
Copy Markdown
Contributor

Hello @SaaiAravindhRaja, thanks for your pr here, but we have assigned this issue to another pr in progress. Please make sure that you are assigned to an issue but opening a PR to fix it, we will reopen this if needed

@PubChimps PubChimps closed this Apr 16, 2026
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.

[StarRocks] Table comments not ingested / not shown

4 participants