/** * return valid segment to access */ public Segment[] getSegmentsToAccess(JobContext job, ReadCommittedScope readCommittedScope) { String segmentString = job.getConfiguration().get(INPUT_SEGMENT_NUMBERS, ""); if (segmentString.trim().isEmpty()) { return new Segment[0]; } List<Segment> segments = Segment.toSegmentList(segmentString.split(","), readCommittedScope); return segments.toArray(new Segment[segments.size()]); }
/** * Set `CARBON_INPUT_SEGMENTS` from property to configuration */ public static void setQuerySegment(Configuration conf, String segmentList) { if (!segmentList.trim().equals("*")) { CarbonInputFormat .setSegmentsToAccess(conf, Segment.toSegmentList(segmentList.split(","), null)); } }
/** * Set `CARBON_INPUT_SEGMENTS` from property to configuration */ public static void setQuerySegment(Configuration conf, AbsoluteTableIdentifier identifier) { String dbName = identifier.getCarbonTableIdentifier().getDatabaseName().toLowerCase(); String tbName = identifier.getCarbonTableIdentifier().getTableName().toLowerCase(); String segmentNumbersFromProperty = CarbonProperties.getInstance() .getProperty(CarbonCommonConstants.CARBON_INPUT_SEGMENTS + dbName + "." + tbName, "*"); if (!segmentNumbersFromProperty.trim().equals("*")) { CarbonInputFormat.setSegmentsToAccess(conf, Segment.toSegmentList(segmentNumbersFromProperty.split(","), null)); } }
/** * Update the table status file with the dropped partitions information * * @param carbonTable * @param uniqueId * @param toBeUpdatedSegments * @param toBeDeleteSegments * @throws IOException */ public static void commitDropPartitions(CarbonTable carbonTable, String uniqueId, List<String> toBeUpdatedSegments, List<String> toBeDeleteSegments, String uuid) throws IOException { if (toBeDeleteSegments.size() > 0 || toBeUpdatedSegments.size() > 0) { Set<Segment> segmentSet = new HashSet<>( new SegmentStatusManager(carbonTable.getAbsoluteTableIdentifier()) .getValidAndInvalidSegments().getValidSegments()); CarbonUpdateUtil.updateTableMetadataStatus(segmentSet, carbonTable, uniqueId, true, Segment.toSegmentList(toBeDeleteSegments, null), Segment.toSegmentList(toBeUpdatedSegments, null), uuid); } }
Segment.toSegmentList(tobeDeletedSegs, null), Segment.toSegmentList(tobeUpdatedSegs, null)); return uniqueId;
String segmentsToBeDeleted = context.getConfiguration().get(CarbonTableOutputFormat.SEGMENTS_TO_BE_DELETED, ""); List<Segment> segmentDeleteList = Segment.toSegmentList(segmentsToBeDeleted.split(","), null); Set<Segment> segmentSet = new HashSet<>( new SegmentStatusManager(carbonTable.getAbsoluteTableIdentifier(),