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

    https://github.com/apache/incubator-carbondata/pull/518#discussion_r95518311
  
    --- Diff: 
processing/src/main/java/org/apache/carbondata/processing/util/CarbonDataProcessorUtil.java
 ---
    @@ -373,83 +368,15 @@ private static void 
addAllComplexTypeChildren(CarbonDimension dimension, StringB
         return complexTypesMap;
       }
     
    -  /**
    -   * Get the csv file to read if it the path is file otherwise get the 
first file of directory.
    -   *
    -   * @param csvFilePath
    -   * @return File
    -   */
    -  public static CarbonFile getCsvFileToRead(String csvFilePath) {
    -    CarbonFile csvFile =
    -        FileFactory.getCarbonFile(csvFilePath, 
FileFactory.getFileType(csvFilePath));
    -
    -    CarbonFile[] listFiles = null;
    -    if (csvFile.isDirectory()) {
    -      listFiles = csvFile.listFiles(new CarbonFileFilter() {
    -        @Override public boolean accept(CarbonFile pathname) {
    -          if (!pathname.isDirectory()) {
    -            if 
(pathname.getName().endsWith(CarbonCommonConstants.CSV_FILE_EXTENSION) || 
pathname
    -                
.getName().endsWith(CarbonCommonConstants.CSV_FILE_EXTENSION
    -                    + CarbonCommonConstants.FILE_INPROGRESS_STATUS)) {
    -              return true;
    -            }
    -          }
    -          return false;
    -        }
    -      });
    -    } else {
    -      listFiles = new CarbonFile[1];
    -      listFiles[0] = csvFile;
    -    }
    -    return listFiles[0];
    -  }
    -
    -  /**
    -   * Get the file header from csv file.
    -   */
    -  public static String getFileHeader(CarbonFile csvFile)
    -      throws DataLoadingException {
    -    DataInputStream fileReader = null;
    -    BufferedReader bufferedReader = null;
    -    String readLine = null;
    -
    -    FileType fileType = FileFactory.getFileType(csvFile.getAbsolutePath());
    -
    -    if (!csvFile.exists()) {
    -      csvFile = FileFactory
    -          .getCarbonFile(csvFile.getAbsolutePath() + 
CarbonCommonConstants.FILE_INPROGRESS_STATUS,
    -              fileType);
    -    }
    -
    -    try {
    -      fileReader = 
FileFactory.getDataInputStream(csvFile.getAbsolutePath(), fileType);
    -      bufferedReader =
    -          new BufferedReader(new InputStreamReader(fileReader, 
Charset.defaultCharset()));
    -      readLine = bufferedReader.readLine();
    -    } catch (FileNotFoundException e) {
    -      LOGGER.error(e, "CSV Input File not found  " + e.getMessage());
    -      throw new DataLoadingException("CSV Input File not found ", e);
    -    } catch (IOException e) {
    -      LOGGER.error(e, "Not able to read CSV input File  " + 
e.getMessage());
    -      throw new DataLoadingException("Not able to read CSV input File ", 
e);
    -    } finally {
    -      CarbonUtil.closeStreams(fileReader, bufferedReader);
    -    }
    -
    -    return readLine;
    -  }
    -
    -  public static boolean isHeaderValid(String tableName, String header,
    -      CarbonDataLoadSchema schema, String delimiter) throws 
DataLoadingException {
    -    delimiter = CarbonUtil.delimiterConverter(delimiter);
    +  public static boolean isHeaderValid(String tableName, String[] csvHeader,
    +      CarbonDataLoadSchema schema) throws DataLoadingException {
    --- End diff --
    
    fixed


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to