kunal642 commented on a change in pull request #3308: [CARBONDATA-3454] optimized index server output for count(*)
URL:
https://github.com/apache/carbondata/pull/3308#discussion_r312337565
##########
File path: hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonInputFormat.java
##########
@@ -412,10 +413,41 @@ public static ReadCommittedScope getReadCommittedScope(Configuration configurati
*/
@Override public abstract List<InputSplit> getSplits(JobContext job) throws IOException;
+ Long getDistributedCount(CarbonTable table,
+ List<PartitionSpec> partitionNames, List<Segment> validSegments) throws IOException {
+ DistributableDataMapFormat dataMapFormat =
+ new DistributableDataMapFormat(table, null, validSegments, new ArrayList<String>(),
+ partitionNames, false, null, false);
+ dataMapFormat.setIsWriteToFile(false);
+ try {
+ DataMapJob dataMapJob =
+ (DataMapJob) DataMapUtil.createDataMapJob(DataMapUtil.DISTRIBUTED_JOB_NAME);
+ if (dataMapJob == null) {
+ throw new ExceptionInInitializerError("Unable to create DistributedDataMapJob");
+ }
+ return dataMapJob.executeCountJob(dataMapFormat);
+ } catch (Exception e) {
+ LOG.error("Failed to get count from index server. Initializing fallback", e);
+ DataMapJob dataMapJob = DataMapUtil.getEmbeddedJob();
+ if (dataMapJob == null) {
+ throw new ExceptionInInitializerError("Unable to create " + DataMapUtil.EMBEDDED_JOB_NAME);
+ }
+ return dataMapJob.executeCountJob(dataMapFormat);
+ }
+ }
+
List<ExtendedBlocklet> getDistributedSplit(CarbonTable table,
FilterResolverIntf filterResolverIntf, List<PartitionSpec> partitionNames,
List<Segment> validSegments, List<Segment> invalidSegments,
List<String> segmentsToBeRefreshed) throws IOException {
+ return getDistributedSplit(table, filterResolverIntf, partitionNames, validSegments,
+ invalidSegments, segmentsToBeRefreshed, false);
+ }
+
+ List<ExtendedBlocklet> getDistributedSplit(CarbonTable table,
Review comment:
renamed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services