You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ku...@apache.org on 2019/06/13 14:25:59 UTC
[carbondata] branch master updated: [CARBONDATA-3429] Updated error
for CarbonCli when path is wrong
This is an automated email from the ASF dual-hosted git repository.
kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git
The following commit(s) were added to refs/heads/master by this push:
new 7deda59 [CARBONDATA-3429] Updated error for CarbonCli when path is wrong
7deda59 is described below
commit 7deda596533fcd38bd626f8e35ddd873dca3fe95
Author: namanrastogi <na...@gmail.com>
AuthorDate: Wed Jun 12 20:20:18 2019 +0530
[CARBONDATA-3429] Updated error for CarbonCli when path is wrong
Problem: Execute CarbonCli with an invalid path. The output even
for invalid path is "unsorted", which is wrong.
Solution: It should throw that it segment path is invalid.
This closes #3280
---
.../org/apache/carbondata/tool/FileCollector.java | 31 +++++++++++-----------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/tools/cli/src/main/java/org/apache/carbondata/tool/FileCollector.java b/tools/cli/src/main/java/org/apache/carbondata/tool/FileCollector.java
index eff46d1..6c7eaf9 100644
--- a/tools/cli/src/main/java/org/apache/carbondata/tool/FileCollector.java
+++ b/tools/cli/src/main/java/org/apache/carbondata/tool/FileCollector.java
@@ -172,26 +172,27 @@ class FileCollector {
public void collectSortColumns(String segmentFolder) throws IOException {
CarbonFile[] files = SegmentIndexFileStore.getCarbonIndexFiles(
segmentFolder, FileFactory.getConfiguration());
+ if (files.length == 0) {
+ throw new IllegalArgumentException("\"" + segmentFolder + "\" is not a valid Segment Folder");
+ }
Set<Boolean> isSortSet = new HashSet<>();
Set<String> sortColumnsSet = new HashSet<>();
- if (files != null) {
- for (CarbonFile file : files) {
- IndexHeader indexHeader = SegmentIndexFileStore.readIndexHeader(
- file.getCanonicalPath(), FileFactory.getConfiguration());
- if (indexHeader != null) {
- if (indexHeader.isSetIs_sort()) {
- isSortSet.add(indexHeader.is_sort);
- if (indexHeader.is_sort) {
- sortColumnsSet.add(makeSortColumnsString(indexHeader.getTable_columns()));
- }
- } else {
- // if is_sort is not set, it will be old store and consider as local_sort by default.
+ for (CarbonFile file : files) {
+ IndexHeader indexHeader = SegmentIndexFileStore.readIndexHeader(
+ file.getCanonicalPath(), FileFactory.getConfiguration());
+ if (indexHeader != null) {
+ if (indexHeader.isSetIs_sort()) {
+ isSortSet.add(indexHeader.is_sort);
+ if (indexHeader.is_sort) {
sortColumnsSet.add(makeSortColumnsString(indexHeader.getTable_columns()));
}
+ } else {
+ // if is_sort is not set, it will be old store and consider as local_sort by default.
+ sortColumnsSet.add(makeSortColumnsString(indexHeader.getTable_columns()));
}
- if (isSortSet.size() >= 2 || sortColumnsSet.size() >= 2) {
- break;
- }
+ }
+ if (isSortSet.size() >= 2 || sortColumnsSet.size() >= 2) {
+ break;
}
}
// for all index files, sort_columns should be same