carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] carbondata pull request #958: [CARBONDATA-1088] Added interfaces for Data Ma...
Date Mon, 12 Jun 2017 09:59:42 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/958#discussion_r121353242
  
    --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/internal/pruning/impl/BlockPruner.java
---
    @@ -0,0 +1,61 @@
    +/*
    + * 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.internal.pruning.impl;
    +
    +import java.util.Iterator;
    +import java.util.List;
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
    +import org.apache.carbondata.core.datastore.filesystem.CarbonFileFilter;
    +import org.apache.carbondata.core.datastore.impl.FileFactory;
    +import org.apache.carbondata.core.indexstore.DataMap;
    +import org.apache.carbondata.core.indexstore.DataMapStore;
    +import org.apache.carbondata.core.indexstore.DataMapType;
    +import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
    +import org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf;
    +import org.apache.carbondata.hadoop.internal.pruning.Pruner;
    +
    +import org.apache.hadoop.mapreduce.lib.input.FileSplit;
    +
    +/**
    + * Block pruner
    + */
    +public class BlockPruner implements Pruner {
    +
    +  @Override
    +  public List<FileSplit> pruneSplits(List<FileSplit> splits, AbsoluteTableIdentifier
identifier,
    +      String segmentId, FilterResolverIntf filterResolverIntf) {
    +    String path = identifier.getTablePath() + CarbonCommonConstants.FILE_SEPARATOR +
"Part0"
    +        + CarbonCommonConstants.FILE_SEPARATOR + "Segment_" + segmentId;
    +    FileFactory.FileType fileType = FileFactory.getFileType(path);
    +    CarbonFile carbonFile = FileFactory.getCarbonFile(path, fileType);
    +    CarbonFile[] carbonFiles = carbonFile.listFiles(new CarbonFileFilter() {
    +      @Override public boolean accept(CarbonFile file) {
    +        return file.getName().endsWith(".carbondata");
    +      }
    +    });
    +    for (int i = 0; i < carbonFiles.length; i++) {
    +      DataMap dataMap = DataMapStore.getInstance()
    +          .getDataMapForReading(carbonFiles[i].getPath(), DataMapType.BLOCK);
    +      Iterator data = dataMap.getData(filterResolverIntf);
    --- End diff --
    
    My understand is that in BlockPruner, we should choose a suitable DataMap based on the
filter condition, then ask the DataMap to give the match T. It should be just one call to
the DataMap.getData, right?


---
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.
---

Mime
View raw message