I have a table in spark, which has ID and numOfReq attributes. in ID, it is between 1 to 100 and it's not in order, and each ID can be repeated many times in the table. I want to extract rows with 1, 47, 54 and 89 IDs. I can do it with a for loop like this pseudo code:
temp = [None , None, None, None]
i = 0
for id in idList:
temp[i] = table.filter(table['ID'] == id)
i += 1
but it took a long time to do so. is there any filter or library which do this fast? what should I insert in my code? I need something in pyspark