[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-25 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/carbondata/pull/2830


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-25 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r228123785
  
--- Diff: 
tools/cli/src/main/java/org/apache/carbondata/tool/DataSummary.java ---
@@ -226,25 +282,46 @@ private int getColumnIndex(String columnName) {
   private boolean collected = false;
 
   private void printColumnStats(String columnName) throws IOException, 
MemoryException {
-out.println();
-out.println("## Column Statistics for '" + columnName + "'");
+outPuts.add("");
+outPuts.add("## Column Statistics for '" + columnName + "'");
 collectStats(columnName);
 
 int columnIndex = getColumnIndex(columnName);
 String[] header = new String[]{"BLK", "BLKLT", "Meta Size", "Data 
Size",
-"LocalDict", "DictEntries", "DictSize", "AvgPageSize", "Min%", 
"Max%"};
+"LocalDict", "DictEntries", "DictSize", "AvgPageSize", "Min%", 
"Max%", "Min", "Max"};
 
-ShardPrinter printer = new ShardPrinter(header);
+ShardPrinter printer = new ShardPrinter(header, outPuts);
 for (Map.Entry entry : dataFiles.entrySet()) {
   DataFile file = entry.getValue();
   for (DataFile.Blocklet blocklet : file.getAllBlocklets()) {
-String min, max;
+String min, max, minPercent, maxPercent;
--- End diff --

handled


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-25 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r228123653
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonShowSummaryCommand.scala
 ---
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.management
+
+import java.util
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
+import org.apache.spark.sql.catalyst.expressions.{Attribute, 
AttributeReference}
+import org.apache.spark.sql.execution.command.{Checker, DataCommand}
+import org.apache.spark.sql.types.StringType
+
+import 
org.apache.carbondata.common.exceptions.sql.MalformedCarbonCommandException
+import org.apache.carbondata.tool.CarbonCli
+
+case class CarbonShowSummaryCommand(
--- End diff --

done


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-25 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r228123741
  
--- Diff: tools/cli/src/main/java/org/apache/carbondata/tool/CarbonCli.java 
---
@@ -40,6 +41,10 @@
 @InterfaceStability.Unstable
 public class CarbonCli {
 
+  private static ArrayList outPuts;
+
+  private static boolean isPrintInConsole = true;
--- End diff --

added


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-25 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r228123616
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
 ---
@@ -493,6 +493,23 @@ class CarbonSpark2SqlParser extends CarbonDDLSqlParser 
{
   showHistory.isDefined)
 }
 
+
+  protected lazy val cli: Parser[LogicalPlan] =
+(SHOW ~> SUMMARY ~> FOR ~> TABLE) ~ (ident <~ ".").? ~ ident ~
--- End diff --

changed


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kumarvishal09
Github user kumarvishal09 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226987983
  
--- Diff: tools/cli/src/main/java/org/apache/carbondata/tool/CarbonCli.java 
---
@@ -40,6 +41,10 @@
 @InterfaceStability.Unstable
 public class CarbonCli {
 
+  private static ArrayList outPuts;
+
+  private static boolean isPrintInConsole = true;
--- End diff --

please add doc for this variable 


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kumarvishal09
Github user kumarvishal09 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226991227
  
--- Diff: 
tools/cli/src/main/java/org/apache/carbondata/tool/DataSummary.java ---
@@ -226,25 +282,46 @@ private int getColumnIndex(String columnName) {
   private boolean collected = false;
 
   private void printColumnStats(String columnName) throws IOException, 
MemoryException {
-out.println();
-out.println("## Column Statistics for '" + columnName + "'");
+outPuts.add("");
+outPuts.add("## Column Statistics for '" + columnName + "'");
 collectStats(columnName);
 
 int columnIndex = getColumnIndex(columnName);
 String[] header = new String[]{"BLK", "BLKLT", "Meta Size", "Data 
Size",
-"LocalDict", "DictEntries", "DictSize", "AvgPageSize", "Min%", 
"Max%"};
+"LocalDict", "DictEntries", "DictSize", "AvgPageSize", "Min%", 
"Max%", "Min", "Max"};
 
-ShardPrinter printer = new ShardPrinter(header);
+ShardPrinter printer = new ShardPrinter(header, outPuts);
 for (Map.Entry entry : dataFiles.entrySet()) {
   DataFile file = entry.getValue();
   for (DataFile.Blocklet blocklet : file.getAllBlocklets()) {
-String min, max;
+String min, max, minPercent, maxPercent;
--- End diff --

Now min max will not be present if size is more for example varchar string 
this case is not handled please check


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kumarvishal09
Github user kumarvishal09 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226989395
  
--- Diff: 
tools/cli/src/main/java/org/apache/carbondata/tool/TablePrinter.java ---
@@ -17,26 +17,28 @@
 
 package org.apache.carbondata.tool;
 
-import java.io.PrintStream;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
 class TablePrinter {
--- End diff --

Now TablePrinter is not printing any details, it is adding to list. Please 
change the class name, Please check other places if applicable 


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kumarvishal09
Github user kumarvishal09 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226987643
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonShowSummaryCommand.scala
 ---
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.management
+
+import java.util
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.sql.{CarbonEnv, Row, SparkSession}
+import org.apache.spark.sql.catalyst.expressions.{Attribute, 
AttributeReference}
+import org.apache.spark.sql.execution.command.{Checker, DataCommand}
+import org.apache.spark.sql.types.StringType
+
+import 
org.apache.carbondata.common.exceptions.sql.MalformedCarbonCommandException
+import org.apache.carbondata.tool.CarbonCli
+
+case class CarbonShowSummaryCommand(
--- End diff --

Please add class level doc


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kumarvishal09
Github user kumarvishal09 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226987833
  
--- Diff: tools/cli/src/main/java/org/apache/carbondata/tool/CarbonCli.java 
---
@@ -40,6 +41,10 @@
 @InterfaceStability.Unstable
 public class CarbonCli {
 
+  private static ArrayList outPuts;
--- End diff --

change   private static ArrayList outPuts to List


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-22 Thread kunal642
Github user kunal642 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2830#discussion_r226980043
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
 ---
@@ -493,6 +493,23 @@ class CarbonSpark2SqlParser extends CarbonDDLSqlParser 
{
   showHistory.isDefined)
 }
 
+
+  protected lazy val cli: Parser[LogicalPlan] =
+(SHOW ~> SUMMARY ~> FOR ~> TABLE) ~ (ident <~ ".").? ~ ident ~
--- End diff --

Change `(SHOW ~> SUMMARY ~> FOR ~> TABLE) ~ (ident <~ ".").?` to `(SHOW ~> 
SUMMARY ~> FOR ~> TABLE) ~> (ident <~ ".").?` as we dont want the output of 
show summary for table


---


[GitHub] carbondata pull request #2830: [CARBONDATA-3025]Added CLI enhancements

2018-10-17 Thread akashrn5
GitHub user akashrn5 opened a pull request:

https://github.com/apache/carbondata/pull/2830

[CARBONDATA-3025]Added CLI enhancements

Be sure to do all of the following checklist to help us incorporate 
your contribution quickly and easily:

 - [ ] Any interfaces changed?
 
 - [ ] Any backward compatibility impacted?
 
 - [ ] Document update required?

 - [ ] Testing done
Please provide details on 
- Whether new unit test cases have been added or why no new tests 
are required?
- How it is tested? Please attach test report.
- Is it a performance related change? Please attach the performance 
test report.
- Any additional information to help reviewers in testing this 
change.
   
 - [ ] For large changes, please consider breaking it into sub-tasks under 
an umbrella JIRA. 



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/akashrn5/incubator-carbondata integrate2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/carbondata/pull/2830.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2830


commit 9b398144f83bf5378b4378ba1ddb47f50bf7a6da
Author: akashrn5 
Date:   2018-10-17T14:26:49Z

add more metadata in carbon file footer

commit e31d757ce8757ac276233c62a8e9d1947553fc4a
Author: akashrn5 
Date:   2018-10-17T14:28:59Z

Added CLI enhancements for better maintainability




---