carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lionelcao <...@git.apache.org>
Subject [GitHub] carbondata pull request #1105: [WIP] Implement range interval partition
Date Mon, 10 Jul 2017 02:58:09 GMT
Github user lionelcao commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1105#discussion_r126327873
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/partition/PartitionFilterUtil.java
---
    @@ -264,4 +265,81 @@ public static BitSet getPartitionMapForRangeFilter(PartitionInfo
partitionInfo,
         return partitionMap;
       }
     
    +  /**
    +   * get partition map of range interval filter on range interval partition table
    +   * @param partitionInfo
    +   * @param partitioner
    +   * @param filterValue
    +   * @param isGreaterThan
    +   * @param isEqualTo
    +   * @return
    +   */
    +  public static BitSet getPartitionMapForRangeIntervalFilter(PartitionInfo partitionInfo,
    +      RangeIntervalPartitioner partitioner, Object filterValue,
    +      boolean isGreaterThan, boolean isEqualTo,
    +      DateFormat timestampFormatter, DateFormat dateFormatter) {
    +
    +    List<String> values = partitionInfo.getRangeInfo();
    +    DataType partitionColumnDataType = partitionInfo.getColumnSchemaList().get(0).getDataType();
    +
    +    Comparator comparator =
    +        PartitionFilterUtil.getComparatorByDataType(partitionColumnDataType);
    +
    +    BitSet partitionMap = PartitionUtil
    +        .generateBitSetBySize(partitioner.numPartitions(), false);
    +
    +    int numPartitions = values.size() - 1;
    +    int result = 0;
    +    // the partition index of filter value
    +    int partitionIndex = 0;
    +    // find the partition of filter value
    +    for (; partitionIndex < numPartitions; partitionIndex++) {
    +      result = comparator.compare(filterValue, PartitionUtil.getDataBasedOnDataType(
    +          values.get(partitionIndex), partitionColumnDataType, timestampFormatter, dateFormatter));
    +      if (result <= 0) {
    +        break;
    +      }
    +    }
    +    if (partitionIndex == numPartitions) {
    +      // filter value is not in given partition, should get partitionId dynamically
    +      int partitionId = partitioner.getPartition(filterValue);
    +      partitionMap.set(0);
    +      if (isGreaterThan) {
    +        // GreaterThan(>), GreaterThanEqualTo(>=)
    +        partitionMap.set(partitionId, partitioner.numPartitions());
    --- End diff --
    
    this should be partition index


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