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

    https://github.com/apache/carbondata/pull/1984#discussion_r169627117
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
    @@ -2449,5 +2496,40 @@ public static String encodeToString(byte[] bytes) 
throws UnsupportedEncodingExce
         return updatedMinMaxValues;
       }
     
    +  /**
    +   * Generate the blockid as per the block path
    +   *
    +   * @param identifier
    +   * @param filePath
    +   * @param segmentId
    +   * @return
    +   */
    +  public static String getBlockId(AbsoluteTableIdentifier identifier, 
String filePath,
    +      String segmentId) {
    +    String blockId;
    +    String blockName = filePath.substring(filePath.lastIndexOf("/") + 1, 
filePath.length());
    +    String tablePath = identifier.getTablePath();
    +    if (filePath.startsWith(tablePath)) {
    +      String factDir =
    +          CarbonStorePath.getCarbonTablePath(tablePath, 
identifier.getCarbonTableIdentifier())
    +              .getFactDir();
    +      if (filePath.startsWith(factDir)) {
    +        blockId = "Part0" + CarbonCommonConstants.FILE_SEPARATOR + 
"Segment_" + segmentId
    +            + CarbonCommonConstants.FILE_SEPARATOR + blockName;
    +      } else {
    +        String partitionDir =
    +            filePath.substring(tablePath.length() + 1, filePath.length() - 
blockName.length() - 1);
    +
    +        blockId = partitionDir.replace("/", "#") + 
CarbonCommonConstants.FILE_SEPARATOR + "Segment_"
    --- End diff --
    
    Added comment


---

Reply via email to