spark_auto_mapper.data_types.if_

Module Contents

Classes

AutoMapperIfDataType

If check returns value if the checks passes else when_not

class spark_auto_mapper.data_types.if_.AutoMapperIfDataType(column, check, value, else_=None)

Bases: spark_auto_mapper.data_types.data_type_base.AutoMapperDataTypeBase, Generic[_TAutoMapperDataType]

If check returns value if the checks passes else when_not

Parameters
  • column (spark_auto_mapper.type_definitions.wrapper_types.AutoMapperColumnOrColumnLikeType) –

  • check (Union[spark_auto_mapper.type_definitions.wrapper_types.AutoMapperAnyDataType, List[spark_auto_mapper.type_definitions.wrapper_types.AutoMapperAnyDataType]]) –

  • value (_TAutoMapperDataType) –

  • else_ (Optional[_TAutoMapperDataType]) –

include_null_properties(self, include_null_properties)
Parameters

include_null_properties (bool) –

Return type

None

get_column_spec(self, source_df, current_column)

Gets the column spec for this automapper data type

Parameters
  • source_df (Optional[pyspark.sql.DataFrame]) – source data frame in case the automapper type needs that data to decide what to do

  • current_column (Optional[pyspark.sql.Column]) – (Optional) this is set when we are inside an array

Return type

pyspark.sql.Column