Use the following check instead, as instanceof is evil:
     if (queryPlan.getStatement().getOperation() != PhoenixStatement.Operation.QUERY)