Github user bhavya411 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2139#discussion_r179913482
  
    --- Diff: 
integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java
 ---
    @@ -415,14 +440,56 @@ public TBase create() {
         return result;
       }
     
    +  /** Returns list of partition specs to query based on the domain 
constraints
    +   * @param constraints
    +   * @param carbonTable
    +   * @throws IOException
    +   */
    +  private List<PartitionSpec> 
findRequiredPartitions(TupleDomain<ColumnHandle> constraints, CarbonTable 
carbonTable,
    +      LoadMetadataDetails[]loadMetadataDetails)  {
    +    Set<PartitionSpec> partitionSpecs = new HashSet<>();
    +    List<PartitionSpec> prunePartitions = new ArrayList();
    +
    +    for (LoadMetadataDetails loadMetadataDetail : loadMetadataDetails) {
    +      SegmentFileStore segmentFileStore = null;
    +      try {
    +        segmentFileStore =
    +            new SegmentFileStore(carbonTable.getTablePath(), 
loadMetadataDetail.getSegmentFile());
    +        partitionSpecs.addAll(segmentFileStore.getPartitionSpecs());
    +
    +      } catch (IOException e) {
    +        e.printStackTrace();
    +      }
    +    }
    +
    +    List<String> partitionValuesFromExpression =
    +        PrestoFilterUtil.getPartitionFilters(carbonTable, constraints);
    +
    +    List<List<String>> partitionSpecNamesList = 
partitionSpecs.stream().map(
    +        PartitionSpec::getPartitions).collect(Collectors.toList());
    +
    +    List<PartitionSpec> partitionSpecsList = new ArrayList(partitionSpecs);
    +
    +    for (int i = 0; i < partitionSpecNamesList.size(); i++) {
    --- End diff --
    
    I am not sure about this logic , you have a set and you create a 
specsNameList and then you create a list of partitionSpecs and then you check 
that if the list has all fiteredPartition you add it to prunedPartitiion, why 
not do it in the 1st map itself instead of complicating code


---

Reply via email to