Skip to content

Commit a56ca06

Browse files
Completes OPEN-3552 Check if all dataset columns were specified in columnNames
1 parent 8a8063e commit a56ca06

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

openlayer/validators.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,10 @@ def _validate_dataset_and_config_consistency(self):
563563
" Please cast the columns in your dataset to conform to these dtypes."
564564
)
565565

566-
if self._columns_not_in_dataset_df(dataset_df, column_names):
566+
if self._columns_not_specified(dataset_df, column_names):
567567
dataset_and_config_consistency_failed_validations.append(
568-
"There are columns specified in the `columnNames` dataset config"
569-
" which are not in the dataset."
568+
"Not all columns in the dataset are specified in `columnNames`."
569+
" Please specify all dataset columns in `columnNames`."
570570
)
571571

572572
if label_column_name:
@@ -729,6 +729,15 @@ def _columns_not_in_dataset_df(
729729
return True
730730
return False
731731

732+
@staticmethod
733+
def _columns_not_specified(
734+
dataset_df: pd.DataFrame, columns_list: List[str]
735+
) -> bool:
736+
"""Checks whether the columns are specified."""
737+
if set(columns_list) != set(dataset_df.columns):
738+
return True
739+
return False
740+
732741
@staticmethod
733742
def _exceeds_character_limit(
734743
dataset_df: pd.DataFrame, text_column_name: str

0 commit comments

Comments
 (0)