Skip to content

fix: unaligned metric signature#27370

Merged
TeddyCr merged 11 commits intoopen-metadata:mainfrom
TeddyCr:ISSUE-27207
Apr 17, 2026
Merged

fix: unaligned metric signature#27370
TeddyCr merged 11 commits intoopen-metadata:mainfrom
TeddyCr:ISSUE-27207

Conversation

@TeddyCr
Copy link
Copy Markdown
Collaborator

@TeddyCr TeddyCr commented Apr 14, 2026

Describe your changes:

Fixes #27207

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@TeddyCr TeddyCr requested a review from a team as a code owner April 14, 2026 22:21
Copilot AI review requested due to automatic review settings April 14, 2026 22:21
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Apr 14, 2026
IceS2
IceS2 previously approved these changes Apr 14, 2026
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

Aligns MariaDB and SingleStore profiler percentile/window metric overrides with the base metric call signature to prevent runtime TypeError during metric computation (fixes #27207 in the ingestion profiler).

Changes:

  • Updated MariaDB and SingleStore median/first_quartile/third_quartile _compute_sqa_fn overrides to accept the optional dimension_col argument.
  • Added a unit test suite to assert database-specific metric overrides remain signature-compatible with their parents.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/median.py Align MariaDB median override signature with base metric call-site.
ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/first_quartile.py Align MariaDB first quartile override signature.
ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/third_quartile.py Align MariaDB third quartile override signature.
ingestion/src/metadata/profiler/source/database/single_store/metrics/window/median.py Align SingleStore median override signature with base metric call-site.
ingestion/src/metadata/profiler/source/database/single_store/metrics/window/first_quartile.py Align SingleStore first quartile override signature.
ingestion/src/metadata/profiler/source/database/single_store/metrics/window/third_quartile.py Align SingleStore third quartile override signature.
ingestion/tests/unit/observability/profiler/sqlalchemy/test_inherited_metrics/test_metric_signatures.py New unit tests guarding signature compatibility across DB-specific overrides.
ingestion/tests/unit/observability/profiler/sqlalchemy/test_inherited_metrics/init.py Adds test package init for the new test module.


class MariaDBMedian(Median):
def _compute_sqa_fn(self, column, table, percentile):
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

dimension_col is now part of the override signature but it is unused in the function body, which will trigger unused-argument in pylint (W0613) for this file. Consider either incorporating dimension_col into the returned function expression (e.g., pass it through when not None) or explicitly disabling the warning for this method if the argument is intentionally ignored.

Suggested change
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
def _compute_sqa_fn( # pylint: disable=unused-argument
self, column, table, percentile, dimension_col=None
):

Copilot uses AI. Check for mistakes.
class MariaDBThirdQuartile(ThirdQuartile):
def _compute_sqa_fn(self, column, table, percentile):
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
"""Generic method to compute the quartile using sqlalchemy"""
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

dimension_col is now part of the override signature but it is unused in the function body, which will trigger unused-argument in pylint (W0613) for this file. Consider either incorporating dimension_col into the returned function expression (e.g., pass it through when not None) or explicitly disabling the warning for this method if the argument is intentionally ignored.

Suggested change
"""Generic method to compute the quartile using sqlalchemy"""
"""Generic method to compute the quartile using sqlalchemy"""
_ = dimension_col

Copilot uses AI. Check for mistakes.

class SingleStoreMedian(Median):
def _compute_sqa_fn(self, column, table, percentile):
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

dimension_col is now part of the override signature but it is unused in the function body, which will trigger unused-argument in pylint (W0613) for this file. Consider either incorporating dimension_col into the returned function expression (e.g., pass it through when not None) or explicitly disabling the warning for this method if the argument is intentionally ignored.

Suggested change
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
def _compute_sqa_fn( # pylint: disable=unused-argument
self, column, table, percentile, dimension_col=None
):

Copilot uses AI. Check for mistakes.
class SingleStoreFirstQuartile(FirstQuartile):
def _compute_sqa_fn(self, column, table, percentile):
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
"""Generic method to compute the quartile using sqlalchemy"""
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

dimension_col is now part of the override signature but it is unused in the function body, which will trigger unused-argument in pylint (W0613) for this file. Consider either incorporating dimension_col into the returned function expression (e.g., pass it through when not None) or explicitly disabling the warning for this method if the argument is intentionally ignored.

Suggested change
"""Generic method to compute the quartile using sqlalchemy"""
"""Generic method to compute the quartile using sqlalchemy"""
_ = dimension_col

Copilot uses AI. Check for mistakes.
class SingleStoreThirdQuartile(ThirdQuartile):
def _compute_sqa_fn(self, column, table, percentile):
def _compute_sqa_fn(self, column, table, percentile, dimension_col=None):
"""Generic method to compute the quartile using sqlalchemy"""
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

dimension_col is now part of the override signature but it is unused in the function body, which will trigger unused-argument in pylint (W0613) for this file. Consider either incorporating dimension_col into the returned function expression (e.g., pass it through when not None) or explicitly disabling the warning for this method if the argument is intentionally ignored.

Suggested change
"""Generic method to compute the quartile using sqlalchemy"""
"""Generic method to compute the quartile using sqlalchemy"""
_ = dimension_col

Copilot uses AI. Check for mistakes.
def test_compute_sqa_fn_accepts_parent_args(child_cls):
"""Child _compute_sqa_fn must accept all arguments the parent fn() passes.

The parent Median.fn() passes dimension_col as a keyword argument.
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The docstring says Median.fn() passes dimension_col as a keyword argument, but the implementation currently passes it as a 4th positional argument. Please update the comment to match the actual call-site so the test intent/documentation stays accurate.

Suggested change
The parent Median.fn() passes dimension_col as a keyword argument.
The parent Median.fn() passes dimension_col as the 4th positional argument.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

🔴 Playwright Results — 2 failure(s), 19 flaky

✅ 3664 passed · ❌ 2 failed · 🟡 19 flaky · ⏭️ 89 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 476 0 4 4
🔴 Shard 2 648 1 2 7
🟡 Shard 3 658 0 2 1
🟡 Shard 4 631 0 3 27
🔴 Shard 5 609 1 1 42
🟡 Shard 6 642 0 7 8

Genuine Failures (failed on all attempts)

Features/ActivityFeed.spec.ts › Mention notification shows correct user details in Notification box (shard 2)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: locator('[data-testid="message-container"]').filter({ hasText: 'Initial conversation thread for mention test' }).first()
Expected: visible
Timeout: 30000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 30000ms�[22m
�[2m  - waiting for locator('[data-testid="message-container"]').filter({ hasText: 'Initial conversation thread for mention test' }).first()�[22m

Pages/Glossary.spec.ts › Add and Remove Assets (shard 5)
�[31mTest timeout of 180000ms exceeded.�[39m
🟡 19 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from welcome screen (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from URL directly (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/ChangeSummaryBadge.spec.ts › Automated badge should appear on entity description with Automated source (shard 2, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should inherit reviewers from glossary when term is created (shard 2, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › Entity Reference List (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Tag Add, Update and Remove (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Glossary Term Add, Update and Remove (shard 4, 1 retry)
  • Pages/EntityDataSteward.spec.ts › User as Owner Add, Update and Remove (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Column dropdown drag-and-drop functionality for Glossary Terms table (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for topic -> dashboard (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Login.spec.ts › Refresh should work (shard 6, 2 retries)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • Pages/Users.spec.ts › Check permissions for Data Steward (shard 6, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › Directory (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings April 16, 2026 23:31
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

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

@pytest.fixture(scope="module")
def singlestore_engine():
container = (
DockerContainer(image="ghcr.io/singlestore-labs/singlestoredb-dev:latest")
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The SingleStore testcontainer uses an image tag :latest, which is non-deterministic and can break tests when the upstream image changes. Pin to a specific SingleStore image version to keep CI stable and reproducible.

Suggested change
DockerContainer(image="ghcr.io/singlestore-labs/singlestoredb-dev:latest")
DockerContainer(image="ghcr.io/singlestore-labs/singlestoredb-dev:8.5.22")

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +24
percentile = clauses[2].value
dimension_col = clauses[3].value if len(clauses) > 3 else None
if dimension_col:
return (
f"(SELECT approx_percentile({col}, {percentile:.2f}) "
f"FROM {table} AS median_inner "
f"WHERE median_inner.{dimension_col} = {table}.{dimension_col})"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

In the correlated-path SQL, the table name is interpolated without any quoting/escaping. This can break for tables that require quoting (reserved words, special chars) and is inconsistent with the MySQL MedianFn compiler which quotes table names. Consider using the dialect preparer to quote the table identifier consistently in both the FROM and correlated WHERE references.

Suggested change
percentile = clauses[2].value
dimension_col = clauses[3].value if len(clauses) > 3 else None
if dimension_col:
return (
f"(SELECT approx_percentile({col}, {percentile:.2f}) "
f"FROM {table} AS median_inner "
f"WHERE median_inner.{dimension_col} = {table}.{dimension_col})"
quoted_table = compiler.preparer.quote(table)
percentile = clauses[2].value
dimension_col = clauses[3].value if len(clauses) > 3 else None
if dimension_col:
return (
f"(SELECT approx_percentile({col}, {percentile:.2f}) "
f"FROM {quoted_table} AS median_inner "
f"WHERE median_inner.{dimension_col} = {quoted_table}.{dimension_col})"

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 17, 2026

Code Review ✅ Approved 1 resolved / 1 findings

Restored the dimension_col in the metric signature, addressing the silent data drop and ensuring correct dimension grouping.

✅ 1 resolved
Bug: dimension_col silently dropped — dimension grouping won't work

📄 ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/first_quartile.py:8-10 📄 ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/median.py:8-10 📄 ingestion/src/metadata/profiler/source/database/mariadb/metrics/window/third_quartile.py:8-10 📄 ingestion/src/metadata/profiler/source/database/single_store/metrics/window/first_quartile.py:10-12 📄 ingestion/src/metadata/profiler/source/database/single_store/metrics/window/median.py:10-12 📄 ingestion/src/metadata/profiler/source/database/single_store/metrics/window/third_quartile.py:10-12
All six child _compute_sqa_fn overrides now accept dimension_col to fix the TypeError, but none of them forward it to MariaDBMedianFn / SingleStoreMedianFn. When Median.fn() passes a non-None dimension_col, the MariaDB and SingleStore implementations will silently ignore it, producing results that are not grouped by the requested dimension.

This is the correct minimal fix for the crash (issue #27207), but it introduces a silent correctness gap for dimension-aware profiling on MariaDB and SingleStore.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

@TeddyCr TeddyCr merged commit 5204148 into open-metadata:main Apr 17, 2026
41 of 43 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.12.6 branch.

github-actions Bot pushed a commit that referenced this pull request Apr 17, 2026
* fix: unaligned metric signature

* fix: added dimension imp. for mariadb and singlestore + integration tests

* fix: ci failure

* fix: ci failure

* fix: ci failure

* fix: ci failures

(cherry picked from commit 5204148)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MariaDB profiler error: MariaDBMedian._compute_sqa_fn() takes 4 positional arguments but 5 were given

3 participants