nmukerje edited a comment on issue #3321:
URL: https://github.com/apache/hudi/issues/3321#issuecomment-899117318


   @umehrot2 
   
   Yes, that was exactly what was happening. Here is what I had to do to trick 
Spark to make the column nullable.
   
   ```
   from pyspark.sql.functions import col,lit, when
   from pyspark.sql import functions as F
   
   
incoming_df=incoming_df.withColumn("_hoodie_is_deleted",lit(1).cast(BooleanType()))
   incoming_df=incoming_df.withColumn("_hoodie_is_deleted", 
when(F.expr("_hoodie_is_deleted is not NULL"), 
col("_hoodie_is_deleted")).otherwise(lit(None)))
   ```
   and now the column is nullable and the record is deleted!
   ```
   root
    |-- id: long (nullable = true)
    |-- sk: long (nullable = true)
    |-- txt: string (nullable = true)
    |-- partitionKey: string (nullable = true)
    |-- year: string (nullable = true)
    |-- month: long (nullable = true)
    |-- _hoodie_is_deleted: boolean (nullable = true)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to