-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Labels
status-information_neededAdditional information is required from the reporterAdditional information is required from the reporterstatus-triageIssue is under initial triageIssue is under initial triage
Description
Hi, trying to patch and use split() for testing some dataframe transformations but I'm not sure I'm doing it right:
@patch(split)
def mock_split(column: ColumnEmulator, pattern: ColumnEmulator) -> ColumnEmulator:
ret_column = ColumnEmulator(data=[split(row, pattern=pattern) for row in column])
ret_column.sf_type = ColumnType(ArrayType(StringType()), nullable=True)
return ret_column
When I try to test a transformation function calling split():
def col_to_array(
df: DataFrame,
cols: Iterable[str],
delimiter: str = "|",
ignore_missing: bool = False,
) -> DataFrame:
....
for _col in cols:
transformation = when(col(_col).is_not_null(), split(col(_col), lit(delimiter)))
....
it is throwing the following type error:
error_message = "Error executing mocked function 'split'. See error traceback for detailed information."```
Can you please help me understand what is happening here?
thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status-information_neededAdditional information is required from the reporterAdditional information is required from the reporterstatus-triageIssue is under initial triageIssue is under initial triage