Allow filtering scalar results by branch in the pdo layer

@cpatrick @jamiesnape