Github user kunal642 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1605#discussion_r154983970 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/preaaggregate/PreAggregateListeners.scala --- @@ -78,6 +89,57 @@ object LoadPostAggregateListener extends OperationEventListener { } } } + + /** + * mark the merged segments as COMPACTED and write load details into table status. + * + * @param carbonLoadModel + */ + private def markSegmentsAsCompacted(carbonLoadModel: CarbonLoadModel): Unit = { + val loadMetadataDetailsIterator = carbonLoadModel.getLoadMetadataDetails.iterator() + while(loadMetadataDetailsIterator.hasNext) { + val loadMetaDataDetail = loadMetadataDetailsIterator.next() + if (loadMetaDataDetail.getMergedLoadName == carbonLoadModel.getSegmentId) { + loadMetaDataDetail.setSegmentStatus(SegmentStatus.COMPACTED) + } + } + val carbonTablePath = CarbonStorePath + .getCarbonTablePath(carbonLoadModel.getCarbonDataLoadSchema.getCarbonTable + .getAbsoluteTableIdentifier) + SegmentStatusManager + .writeLoadDetailsIntoFile(carbonTablePath.getTableStatusFilePath, + carbonLoadModel.getLoadMetadataDetails + .toArray(new Array[LoadMetadataDetails](carbonLoadModel.getLoadMetadataDetails.size))) + } + +} + +object AlterPreAggregateTableCompactionPostEvent extends OperationEventListener { --- End diff -- changed the name
---