
    Q/Phd                     F    d dl Z d dlmZ d dlmZ d dlmZ dededefdZdS )	    N)	DataFrame)MapType)Settingsconfigdfreturnc                     d |j         j        D             }|r5t          j        dd                    |           d            |j        | }|S )a=  Preprocess the Spark DataFrame by removing MapType columns.
    - Excludes columns of type MapType
    - Raises a warning if any MapType columns are removed

    Args:
        config: Report settings object
        df: The Spark DataFrame

    Returns:
        The preprocessed DataFrame without MapType columns.
    c                 P    g | ]#}t          |j        t                    |j        $S  )
isinstancedataTyper   name).0fields     k/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/ydata_profiling/model/spark/dataframe_spark.py
<listcomp>z$spark_preprocess.<locals>.<listcomp>   s;       Ju~w4W4W
      z>Spark DataFrame profiling does not handle MapTypes. Column(s) z, z will be ignored.
            To fix this, consider converting your MapType into a StructType or extracting key-value pairs using `explode()`.
            )schemafieldswarningswarnjoindrop)r   r   columns_to_removes      r   spark_preprocessr   	   s}      "	 0    )tyyYjOkOk   	
 	
 	

 RW'(Ir   )r   pyspark.sqlr   pyspark.sql.typesr   ydata_profiling.configr   r   r   r   r   <module>r      sw     ! ! ! ! ! ! % % % % % % + + + + + +X 9       r   