Skip to content

Commit

Permalink
fix: changed return type of query_get_all_space_count function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ksaurav3380 committed Sep 7, 2024
1 parent 2d22870 commit 95c3cec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
2 changes: 0 additions & 2 deletions dcs_core/core/common/models/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class ValidationFunction(str, Enum):
PERCENT_EMPTY_STRING = "percent_empty_string"
COUNT_NAN = "count_nan"
PERCENT_NAN = "percent_nan"
COUNT_NULL_KEYWORD = "count_null_keyword"
PERCENT_NULL_KEYWORD = "percent_null_keyboard"
COUNT_ALL_SPACE = "count_all_space"
PERCENT_ALL_SPACE = "percent_all_space"

Expand Down
2 changes: 1 addition & 1 deletion dcs_core/core/datasource/sql_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def query_negative_metric(

def query_get_all_space_count(
self, table: str, field: str, operation: str, filters: str = None
) -> int:
) -> Union[int, float]:
"""
Get the count of rows where the specified column contains only spaces.
:param table: table name
Expand Down
18 changes: 0 additions & 18 deletions dcs_core/core/validation/completeness_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ def _generate_metric_value(self, **kwargs) -> Union[float, int]:
raise ValueError("Invalid data source type")


class CountEmptyStringValidation(Validation):
def _generate_metric_value(self, **kwargs) -> Union[float, int]:
if isinstance(self.data_source, SQLDataSource):
return self.data_source.query_get_empty_string_count(
table=self.dataset_name,
field=self.field_name,
filters=self.where_filter if self.where_filter is not None else None,
)
elif isinstance(self.data_source, SearchIndexDataSource):
return self.data_source.query_get_empty_string_count(
index_name=self.dataset_name,
field=self.field_name,
filters=self.where_filter if self.where_filter else None,
)
else:
raise ValueError("Invalid data source type")


class CountAllSpaceValidation(Validation):
def _generate_metric_value(self, **kwargs) -> Union[float, int]:
if isinstance(self.data_source, SQLDataSource):
Expand Down

0 comments on commit 95c3cec

Please sign in to comment.