You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/05/20 13:57:38 UTC

[GitHub] [carbondata] KanakaKumar commented on a change in pull request #3183: [CARBONDATA-3349] support carboncli show sort_columns for a segment folder

KanakaKumar commented on a change in pull request #3183: [CARBONDATA-3349] support carboncli show sort_columns for a segment folder
URL: https://github.com/apache/carbondata/pull/3183#discussion_r285605808
 
 

 ##########
 File path: tools/cli/src/main/java/org/apache/carbondata/tool/FileCollector.java
 ##########
 @@ -146,6 +150,45 @@ void printBasicStats() {
     outPuts.add(format1);
   }
 
+  private String makeSortColumnsString(List<ColumnSchema> columnList) {
+    StringBuilder builder = new StringBuilder();
+    for (ColumnSchema column : columnList) {
+      if (column.isDimension()) {
+        Map<String, String> properties = column.getColumnProperties();
+        if (properties != null) {
+          if (properties.get(CarbonCommonConstants.SORT_COLUMNS) != null) {
+            builder.append(column.column_name).append(",");
+          }
+        }
+      }
+    }
+    if (builder.length() > 1) {
+      return builder.substring(0, builder.length() - 1);
+    } else {
+      return "";
+    }
+  }
+
+  public void collectSortColumns(String segmentFolder) throws IOException {
+    CarbonFile[] files = SegmentIndexFileStore.getCarbonIndexFiles(
+        segmentFolder, FileFactory.getConfiguration());
+    Boolean isSort = null;
+    String sortColumnsString = null;
+    if (files != null && files.length >= 1) {
+      IndexHeader indexHeader = SegmentIndexFileStore.readIndexHeader(
+          files[0].getCanonicalPath(), FileFactory.getConfiguration());
+      if (indexHeader.isSetIs_sort()) {
 
 Review comment:
   indexHeader  can be null from readIndexHeader(). Please add null check.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services