-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Labels
status-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team
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-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team