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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

GitBox
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_r285607607
 
 

 ##########
 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());
 
 Review comment:
   If there is any update query run after modifying sort_columns, then  index files would have different sort_columns. So, giving result from  files[0] is wrong.
   I think we should list each file sort status or if  there are different sort_column, can return unsorted .

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services