I've a dataframe having different eventtype(10, 11, 12), data varies based on the eventtype, my requirement here is, when eventtype=11 I would need to concatenate two columns data(sensor, field1) to array[0,1] in the sensor column and shift the data to one left, i've given my desired output, is there a way I can achieve this using pyspark.
I was able to concatenate using spark.sql concat() function, but looking for a more generic code which would concatenate and shift the column vales to one left and assign the last column value as NULL.
eventtype sensor field1 field2 eventcategory
11 1 0 SE_500 500

Expected output:
eventtype, sensor, field1, field2, eventcategory
11 [1,0] SE_500 500 NULL