public static APIResult successOrPartialOrFailure(int actual, int expected, Exception e) { if (actual == 0 && expected != 0) { return failure(e); } if (actual < expected) { return partial(actual, expected); } else { return success(); } }
public static APIResult successOrPartialOrFailure(int actual, int expected, Exception e) { if (actual == 0 && expected != 0) { return failure(e); } if (actual < expected) { return partial(actual, expected); } else { return success(); } }
/** * Drop the partitions in the storage of a fact; can specified filter as well * * @param sessionid The sessionid in which user is working * @param factName The fact table name * @param storage The storage name * @param filter The filter for partitions, string representation of the filter for ex: x < "xxx" and y > * "yyy" * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if drop was successful. {@link APIResult} with state * {@link Status#FAILED}, if drop has failed */ @DELETE @Path("/facts/{factName}/storages/{storage}/partitions") public APIResult dropPartitionsOfFactStorageByFilter(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("factName") String factName, @PathParam("storage") String storage, @QueryParam("filter") String filter, @QueryParam("updatePeriod") String updatePeriod) throws LensException { checkSessionId(sessionid); try { getSvc().dropPartitionFromStorageByFilter(sessionid, factName, storage, filter, updatePeriod); } catch (LensException exc) { log.warn("Got exception while dropping partition.", exc); return partial(processLensException(exc)); } return success(); }
/** * Drop the partitions in the storage of a dimension table; can specified filter as well * * @param sessionid The sessionid in which user is working * @param dimTableName The dimension table name * @param storage The storage name * @param filter The filter for partitions, string representation of the filter for ex: x < 'xxx' and y > * 'yyy' * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if drop was successful. {@link APIResult} with state * {@link Status#FAILED}, if drop has failed */ @DELETE @Path("/dimtables/{dimTableName}/storages/{storage}/partitions") public APIResult dropPartitionsOfDimStorageByFilter(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimTableName, @PathParam("storage") String storage, @QueryParam("filter") String filter) throws LensException { checkSessionId(sessionid); try { getSvc().dropPartitionFromStorageByFilter(sessionid, dimTableName, storage, filter); } catch (LensException exc) { log.error("Error dropping partition on storage of dimension table {}:{}", dimTableName, storage, exc); return partial(processLensException(exc)); } return success(); }