SPARK-3711: Optimize where in clause filter queries