Github user zzcclp commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1516#discussion_r151632100
--- Diff:
core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
---
@@ -462,39 +461,8 @@ public static DataOutputStream
getDataOutputStreamUsingAppend(String path, FileT
* @throws IOException
*/
public static void truncateFile(String path, FileType fileType, long
newSize) throws IOException {
- path = path.replace("\\", "/");
- FileChannel fileChannel = null;
- switch (fileType) {
- case LOCAL:
- path = getUpdatedFilePath(path, fileType);
- fileChannel = new FileOutputStream(path, true).getChannel();
- try {
- fileChannel.truncate(newSize);
- } finally {
- if (fileChannel != null) {
- fileChannel.close();
- }
- }
- return;
- case HDFS:
- case ALLUXIO:
- case VIEWFS:
- case S3:
- Path pt = new Path(path);
- FileSystem fs = pt.getFileSystem(configuration);
- fs.truncate(pt, newSize);
--- End diff --
According to discussion with @QiangCai offline, just use the interface
'CarbonFile.truncate' to truncate file uniformly.
@QiangCai what do you think about this?
---