I have a table containing sql_logic and value, if logic is fulfilled by values of A,B,C which is saved in pyspark dataframe, then it should be populated as 1 in active_id column like below
sql_logic | value | active_id |
---|---|---|
A>5 AND B<10 |
50 | 1 |
B>50 AND C<6 |
45 | 0 |
A<=25 AND C>10 |
24 | 1 |
for eg. for below pyspark dataframe with values of A=23,B=5,C=50 then active_id would be 1,0,1 respectively as these values fulfill those logics.
A | B | C |
---|---|---|
23 | 5 | 50 |
Plese help me write a pyspark code to achieve this.