Throw IllegalArgumentException in case of null query