[2/2] carbondata git commit: [CARBONDATA-2209] Fixed rename table with partitions not working issue and batch_sort and no_sort with partition table issue
[CARBONDATA-2209] Fixed rename table with partitions not working issue and batch_sort and no_sort with partition table issue This closes #2006 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/5b44e810 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/5b44e810 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/5b44e810 Branch: refs/heads/branch-1.3 Commit: 5b44e8105cc10ea9616323bbe3736619729658ae Parents: 092b5d5 Author: ravipesalaAuthored: Tue Feb 27 16:38:09 2018 +0530 Committer: Venkata Ramana G Committed: Fri Mar 2 21:26:30 2018 +0530 -- .../apache/carbondata/core/datamap/Segment.java | 21 ++ .../blockletindex/SegmentIndexFileStore.java| 13 +- .../core/metadata/SegmentFileStore.java | 33 +++- .../core/util/path/CarbonTablePath.java | 7 + .../core/writer/CarbonIndexFileMergeWriter.java | 191 ++- .../CarbonIndexFileMergeTestCase.scala | 15 +- .../StandardPartitionGlobalSortTestCase.scala | 86 + .../StandardPartitionTableQueryTestCase.scala | 21 ++ .../schema/CarbonAlterTableRenameCommand.scala | 58 +- .../sql/execution/strategy/DDLStrategy.scala| 8 + .../spark/sql/hive/CarbonSessionState.scala | 12 +- .../spark/sql/hive/CarbonSessionState.scala | 10 + .../loading/DataLoadProcessBuilder.java | 8 +- .../processing/util/CarbonLoaderUtil.java | 87 + 14 files changed, 509 insertions(+), 61 deletions(-) -- http://git-wip-us.apache.org/repos/asf/carbondata/blob/5b44e810/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java -- diff --git a/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java b/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java index c47f16c..a2a2a41 100644 --- a/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java +++ b/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java @@ -21,6 +21,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.carbondata.core.statusmanager.LoadMetadataDetails; +import org.apache.carbondata.core.statusmanager.SegmentStatusManager; +import org.apache.carbondata.core.util.path.CarbonTablePath; + /** * Represents one load of carbondata */ @@ -76,6 +80,23 @@ public class Segment implements Serializable { return new Segment(segmentId, null); } + /** + * Read the table status and get the segment corresponding to segmentNo + * @param segmentNo + * @param tablePath + * @return + */ + public static Segment getSegment(String segmentNo, String tablePath) { +LoadMetadataDetails[] loadMetadataDetails = + SegmentStatusManager.readLoadMetadata(CarbonTablePath.getMetadataPath(tablePath)); +for (LoadMetadataDetails details: loadMetadataDetails) { + if (details.getLoadName().equals(segmentNo)) { +return new Segment(details.getLoadName(), details.getSegmentFile()); + } +} +return null; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; http://git-wip-us.apache.org/repos/asf/carbondata/blob/5b44e810/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java -- diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java index 4883d94..9364a7a 100644 --- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java +++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java @@ -96,6 +96,7 @@ public class SegmentIndexFileStore { public void readAllIIndexOfSegment(SegmentFileStore.SegmentFile segmentFile, String tablePath, SegmentStatus status, boolean ignoreStatus) throws IOException { List carbonIndexFiles = new ArrayList<>(); +Set indexFiles = new HashSet<>(); if (segmentFile == null) { return; } @@ -107,11 +108,21 @@ public class SegmentIndexFileStore { if (locations.getValue().isRelative()) { location = tablePath + CarbonCommonConstants.FILE_SEPARATOR + location; } +String mergeFileName = locations.getValue().getMergeFileName(); +if (mergeFileName != null) { + CarbonFile mergeFile = FileFactory + .getCarbonFile(location + CarbonCommonConstants.FILE_SEPARATOR +
carbondata git commit: [CARBONDATA-2209] Fixed rename table with partitions not working issue and batch_sort and no_sort with partition table issue
Repository: carbondata Updated Branches: refs/heads/master 7bfe4afe4 -> 74f5d67c0 [CARBONDATA-2209] Fixed rename table with partitions not working issue and batch_sort and no_sort with partition table issue This closes #2006 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/74f5d67c Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/74f5d67c Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/74f5d67c Branch: refs/heads/master Commit: 74f5d67c0f79ba2a45ed97339179333a7cd37279 Parents: 7bfe4af Author: ravipesalaAuthored: Tue Feb 27 16:38:09 2018 +0530 Committer: Venkata Ramana G Committed: Fri Mar 2 21:19:57 2018 +0530 -- .../apache/carbondata/core/datamap/Segment.java | 21 ++ .../blockletindex/SegmentIndexFileStore.java| 13 +- .../core/metadata/SegmentFileStore.java | 33 +++- .../core/util/path/CarbonTablePath.java | 7 + .../core/writer/CarbonIndexFileMergeWriter.java | 191 ++- .../CarbonIndexFileMergeTestCase.scala | 15 +- .../StandardPartitionGlobalSortTestCase.scala | 86 + .../StandardPartitionTableQueryTestCase.scala | 21 ++ .../schema/CarbonAlterTableRenameCommand.scala | 58 +- .../sql/execution/strategy/DDLStrategy.scala| 8 + .../spark/sql/hive/CarbonSessionState.scala | 12 +- .../spark/sql/hive/CarbonSessionState.scala | 10 + .../loading/DataLoadProcessBuilder.java | 8 +- .../processing/util/CarbonLoaderUtil.java | 87 + 14 files changed, 509 insertions(+), 61 deletions(-) -- http://git-wip-us.apache.org/repos/asf/carbondata/blob/74f5d67c/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java -- diff --git a/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java b/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java index c47f16c..a2a2a41 100644 --- a/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java +++ b/core/src/main/java/org/apache/carbondata/core/datamap/Segment.java @@ -21,6 +21,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.carbondata.core.statusmanager.LoadMetadataDetails; +import org.apache.carbondata.core.statusmanager.SegmentStatusManager; +import org.apache.carbondata.core.util.path.CarbonTablePath; + /** * Represents one load of carbondata */ @@ -76,6 +80,23 @@ public class Segment implements Serializable { return new Segment(segmentId, null); } + /** + * Read the table status and get the segment corresponding to segmentNo + * @param segmentNo + * @param tablePath + * @return + */ + public static Segment getSegment(String segmentNo, String tablePath) { +LoadMetadataDetails[] loadMetadataDetails = + SegmentStatusManager.readLoadMetadata(CarbonTablePath.getMetadataPath(tablePath)); +for (LoadMetadataDetails details: loadMetadataDetails) { + if (details.getLoadName().equals(segmentNo)) { +return new Segment(details.getLoadName(), details.getSegmentFile()); + } +} +return null; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; http://git-wip-us.apache.org/repos/asf/carbondata/blob/74f5d67c/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java -- diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java index 4883d94..9364a7a 100644 --- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java +++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java @@ -96,6 +96,7 @@ public class SegmentIndexFileStore { public void readAllIIndexOfSegment(SegmentFileStore.SegmentFile segmentFile, String tablePath, SegmentStatus status, boolean ignoreStatus) throws IOException { List carbonIndexFiles = new ArrayList<>(); +Set indexFiles = new HashSet<>(); if (segmentFile == null) { return; } @@ -107,11 +108,21 @@ public class SegmentIndexFileStore { if (locations.getValue().isRelative()) { location = tablePath + CarbonCommonConstants.FILE_SEPARATOR + location; } +String mergeFileName = locations.getValue().getMergeFileName(); +if (mergeFileName != null) { + CarbonFile mergeFile = FileFactory +