Github user gvramana commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1061#discussion_r126134566 --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java --- @@ -124,6 +128,90 @@ public boolean renameTo(String changetoName) { } } + @Override public boolean renameForce(String changetoName) { + FileSystem fs; + try { + fs = fileStatus.getPath().getFileSystem(FileFactory.getConfiguration()); + if (fs instanceof DistributedFileSystem) { + ((DistributedFileSystem) fs).rename(fileStatus.getPath(), new Path(changetoName), + org.apache.hadoop.fs.Options.Rename.OVERWRITE); + return true; + } else if (fs instanceof ViewFileSystem) { + fs.delete(new Path(changetoName), true); + fs.rename(fileStatus.getPath(), new Path(changetoName)); + return true; + } else { + return false; + } + } catch (IOException e) { + LOGGER.error("Exception occured" + e.getMessage()); + return false; + } + } + + public CarbonFile[] getFiles(FileStatus[] listStatus, FileFactory.FileType fileType) { + if (listStatus == null) { + return new CarbonFile[0]; + } + CarbonFile[] files = new CarbonFile[listStatus.length]; + if (fileType.equals(FileFactory.FileType.HDFS)) { + for (int i = 0; i < files.length; i++) { + files[i] = new HDFSCarbonFile(listStatus[i]); + } + } else if (fileType.equals(FileFactory.FileType.VIEWFS)) { + for (int i = 0; i < files.length; i++) { + files[i] = new ViewFSCarbonFile(listStatus[i]); --- End diff -- You have to use factory method to create corresponsing file, cannot use switch case here
--- 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. ---