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 7A1BE200CDD for ; Mon, 7 Aug 2017 18:45:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 789E1165A1E; Mon, 7 Aug 2017 16:45:23 +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 BFB01165A1A for ; Mon, 7 Aug 2017 18:45:22 +0200 (CEST) Received: (qmail 71220 invoked by uid 500); 7 Aug 2017 16:45:22 -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 71211 invoked by uid 99); 7 Aug 2017 16:45:21 -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; Mon, 07 Aug 2017 16:45:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C1F10E96C0; Mon, 7 Aug 2017 16:45:21 +0000 (UTC) From: jackylk To: issues@carbondata.apache.org Reply-To: issues@carbondata.apache.org References: In-Reply-To: Subject: [GitHub] carbondata pull request #1179: [CARBONDATA-1364] Added the blocklet info to ... Content-Type: text/plain Message-Id: <20170807164521.C1F10E96C0@git1-us-west.apache.org> Date: Mon, 7 Aug 2017 16:45:21 +0000 (UTC) archived-at: Mon, 07 Aug 2017 16:45:23 -0000 Github user jackylk commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1179#discussion_r131705354 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/api/DistributableDataMapFormat.java --- @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.carbondata.hadoop.api; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.carbondata.core.indexstore.Blocklet; +import org.apache.carbondata.core.indexstore.DataMapDistributable; +import org.apache.carbondata.core.indexstore.DataMapStoreManager; +import org.apache.carbondata.core.indexstore.DataMapType; +import org.apache.carbondata.core.indexstore.TableDataMap; +import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier; +import org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf; +import org.apache.carbondata.hadoop.util.ObjectSerializationUtil; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.hadoop.mapreduce.JobContext; +import org.apache.hadoop.mapreduce.RecordReader; +import org.apache.hadoop.mapreduce.TaskAttemptContext; +import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; + +/** + * Input format for datamaps, it makes the datamap pruning distributable. + */ +public class DistributableDataMapFormat extends FileInputFormat implements + Serializable { + + private static final String FILTER_EXP = "mapreduce.input.distributed.datamap.filter"; + + private AbsoluteTableIdentifier identifier; + + private String dataMapName; + + private DataMapType dataMapType; + + private List validSegments; + + public DistributableDataMapFormat(AbsoluteTableIdentifier identifier, String dataMapName, + DataMapType dataMapType, List validSegments) { + this.identifier = identifier; + this.dataMapName = dataMapName; + this.dataMapType = dataMapType; + this.validSegments = validSegments; + } + + public static void setFilterExp(Configuration configuration, FilterResolverIntf filterExp) + throws IOException { + if (filterExp != null) { + String string = ObjectSerializationUtil.convertObjectToString(filterExp); + configuration.set(FILTER_EXP, string); + } + } + + private static FilterResolverIntf getFilterExp(Configuration configuration) throws IOException { + String filterString = configuration.get(FILTER_EXP); + if (filterString != null) { + Object toObject = ObjectSerializationUtil.convertStringToObject(filterString); + return (FilterResolverIntf) toObject; + } + return null; + } + + @Override public List getSplits(JobContext job) throws IOException { + TableDataMap dataMap = + DataMapStoreManager.getInstance().getDataMap(identifier, dataMapName, dataMapType); + List distributables = dataMap.toDistributable(validSegments); --- End diff -- Can we first filter on the segment based on minmax ? If segments are more, even map reduce will take times --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---