Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1605#discussion_r154974553
--- 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 {
+ /**
+ * Called on a specified event occurrence
+ *
+ * @param event
+ * @param operationContext
+ */
+ override def onEvent(event: Event, operationContext: OperationContext):
Unit = {
--- End diff --
What does the listener do? please add comment
---