Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 74B6B200D53 for ; Tue, 5 Dec 2017 16:11:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 73307160C1B; Tue, 5 Dec 2017 15:11:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BA123160C0A for ; Tue, 5 Dec 2017 16:11:53 +0100 (CET) Received: (qmail 76270 invoked by uid 500); 5 Dec 2017 15:11:53 -0000 Mailing-List: contact issues-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list issues@carbondata.apache.org Received: (qmail 76259 invoked by uid 99); 5 Dec 2017 15:11:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2017 15:11:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D0742E0219; Tue, 5 Dec 2017 15:11:52 +0000 (UTC) From: jackylk To: issues@carbondata.apache.org Reply-To: issues@carbondata.apache.org References: In-Reply-To: Subject: [GitHub] carbondata pull request #1605: [CARBONDATA-1526] [PreAgg] Added support to c... Content-Type: text/plain Message-Id: <20171205151152.D0742E0219@git1-us-west.apache.org> Date: Tue, 5 Dec 2017 15:11:52 +0000 (UTC) archived-at: Tue, 05 Dec 2017 15:11:54 -0000 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 ---