From 891603e72f636a75076aadda4f12dec48c7ea780 Mon Sep 17 00:00:00 2001 From: Teddy Date: Thu, 1 Sep 2022 15:57:33 +0200 Subject: [PATCH] Remove unique computation for unsupported fields (#7117) --- .../src/metadata/orm_profiler/metrics/static/unique_count.py | 4 ++++ ingestion/src/metadata/orm_profiler/profiler/core.py | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ingestion/src/metadata/orm_profiler/metrics/static/unique_count.py b/ingestion/src/metadata/orm_profiler/metrics/static/unique_count.py index e111a5323a7..c1b686e3427 100644 --- a/ingestion/src/metadata/orm_profiler/metrics/static/unique_count.py +++ b/ingestion/src/metadata/orm_profiler/metrics/static/unique_count.py @@ -18,6 +18,7 @@ from sqlalchemy import column, func from sqlalchemy.orm import DeclarativeMeta, Session from metadata.orm_profiler.metrics.core import QueryMetric +from metadata.orm_profiler.orm.registry import NOT_COMPUTE class UniqueCount(QueryMetric): @@ -46,6 +47,9 @@ class UniqueCount(QueryMetric): "We are missing the session attribute to compute the UniqueCount." ) + if self.col.type.__class__ in NOT_COMPUTE: + return None + # Run all queries on top of the sampled data col = column(self.col.name) only_once = ( diff --git a/ingestion/src/metadata/orm_profiler/profiler/core.py b/ingestion/src/metadata/orm_profiler/profiler/core.py index 13edb85e546..6ef2e30dfe1 100644 --- a/ingestion/src/metadata/orm_profiler/profiler/core.py +++ b/ingestion/src/metadata/orm_profiler/profiler/core.py @@ -290,11 +290,6 @@ class Profiler(Generic[TMetric]): def _prepare_column_metrics_for_thread_pool(self): """prepare column metrics for thread pool""" - window_metrics = [ - metric - for metric in self.get_col_metrics(self.static_metrics) - if metric.is_window_metric() - ] columns = [ column for column in self.columns