/** * Get the partition info of a work unit from the {@code state}. Then partition info will be removed from the * {@code state} to avoid persisting useless information * * <p> * In Gobblin, only the {@link PartitionedDataWriter} knows all partitions written for a work unit. Each partition * {@link DataWriter} decides the actual form of a dataset partition * </p> */ public static List<PartitionDescriptor> getPartitionInfoAndClean(State state, int branchId) { String partitionsKey = getPartitionsKey(branchId); String json = state.getProp(partitionsKey); if (Strings.isNullOrEmpty(json)) { return Lists.newArrayList(); } state.removeProp(partitionsKey); return PartitionDescriptor.fromPartitionJsonList(json); } }
/** * Get the partition info of a work unit from the {@code state}. Then partition info will be removed from the * {@code state} to avoid persisting useless information * * <p> * In Gobblin, only the {@link PartitionedDataWriter} knows all partitions written for a work unit. Each partition * {@link DataWriter} decides the actual form of a dataset partition * </p> */ public static List<PartitionDescriptor> getPartitionInfoAndClean(State state, int branchId) { String partitionsKey = getPartitionsKey(branchId); String json = state.getProp(partitionsKey); if (Strings.isNullOrEmpty(json)) { return Lists.newArrayList(); } state.removeProp(partitionsKey); return PartitionDescriptor.fromPartitionJsonList(json); } }