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

    https://github.com/apache/carbondata/pull/2804#discussion_r231107288
  
    --- Diff: 
store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonSchemaReader.java 
---
    @@ -61,14 +65,122 @@ public static Schema readSchemaInSchemaFile(String 
schemaFilePath) throws IOExce
         return new Schema(schemaList);
       }
     
    +  /**
    +   * get carbondata/carbonindex file in path
    +   *
    +   * @param path carbon file path
    +   * @return CarbonFile array
    +   */
    +  private static CarbonFile[] getCarbonFile(String path, final String 
extension)
    +      throws IOException {
    +    String dataFilePath = path;
    +    if (!(dataFilePath.contains(extension))) {
    +      CarbonFile[] carbonFiles = FileFactory
    +          .getCarbonFile(path)
    +          .listFiles(new CarbonFileFilter() {
    +            @Override
    +            public boolean accept(CarbonFile file) {
    +              if (file == null) {
    +                return false;
    +              }
    +              return file.getName().endsWith(extension);
    +            }
    +          });
    +      if (carbonFiles == null || carbonFiles.length < 1) {
    +        throw new IOException("Carbon file not exists.");
    +      }
    +      return carbonFiles;
    +    }
    +    return null;
    --- End diff --
    
    ok, throw exception


---

Reply via email to