[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-16 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-16 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r151345870
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/CarbonDescribeFormattedCommand.scala
 ---
@@ -65,6 +65,7 @@ private[sql] case class CarbonDescribeFormattedCommand(
 val dims = relation.metaData.dims.map(x => x.toLowerCase)
 var results: Seq[(String, String, String)] = child.schema.fields.map { 
field =>
   val fieldName = field.name.toLowerCase
+  val colComment = field.getComment().getOrElse("null")
--- End diff --

verified, it is in sync with hive, if comment is not there, by default it 
will be null


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-16 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r151345725
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
 ---
@@ -424,11 +424,20 @@ class CarbonSpark2SqlParser extends 
CarbonDDLSqlParser {
 
   def getFields(schema: Seq[StructField]): Seq[Field] = {
 schema.map { col =>
-  val x = if (col.dataType.catalogString == "float") {
-'`' + col.name + '`' + " double"
-  }
-  else {
-'`' + col.name + '`' + ' ' + col.dataType.catalogString
+  val colComment = col.getComment()
+  val x = if (colComment.isDefined) {
+val columnComment = " comment \"" + colComment.get + "\""
--- End diff --

handled, please review


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-14 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r150883724
  
--- Diff: 
integration/spark2/src/test/scala/org/apache/carbondata/spark/testsuite/booleantype/BooleanDataTypesInsertTest.scala
 ---
@@ -945,4 +948,41 @@ class BooleanDataTypesInsertTest extends QueryTest 
with BeforeAndAfterEach with
 )
   }
 
+  test("Inserting table with bad records, and SORT_COLUMNS is boolean 
column") {
+
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.ENABLE_AUTO_LOAD_MERGE,
 "true")
--- End diff --

this test is not related to col comment, this test is just added in this PR 
which is for boolean datatype


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-14 Thread gvramana
Github user gvramana commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r150863854
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/CarbonDescribeFormattedCommand.scala
 ---
@@ -65,6 +65,7 @@ private[sql] case class CarbonDescribeFormattedCommand(
 val dims = relation.metaData.dims.map(x => x.toLowerCase)
 var results: Seq[(String, String, String)] = child.schema.fields.map { 
field =>
   val fieldName = field.name.toLowerCase
+  val colComment = field.getComment().getOrElse("null")
--- End diff --

Also needs to make sure that "desc table" also works. As spark/Hive 
supports accordingly, need to make it consistant


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-14 Thread gvramana
Github user gvramana commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r150862967
  
--- Diff: 
integration/spark2/src/test/scala/org/apache/carbondata/spark/testsuite/booleantype/BooleanDataTypesInsertTest.scala
 ---
@@ -945,4 +948,41 @@ class BooleanDataTypesInsertTest extends QueryTest 
with BeforeAndAfterEach with
 )
   }
 
+  test("Inserting table with bad records, and SORT_COLUMNS is boolean 
column") {
+
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.ENABLE_AUTO_LOAD_MERGE,
 "true")
--- End diff --

How is this test related to comments?


---


[GitHub] carbondata pull request #1432: [CARBONDATA-1608]Support Column Comment for C...

2017-11-14 Thread gvramana
Github user gvramana commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1432#discussion_r150860743
  
--- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
 ---
@@ -424,11 +424,20 @@ class CarbonSpark2SqlParser extends 
CarbonDDLSqlParser {
 
   def getFields(schema: Seq[StructField]): Seq[Field] = {
 schema.map { col =>
-  val x = if (col.dataType.catalogString == "float") {
-'`' + col.name + '`' + " double"
-  }
-  else {
-'`' + col.name + '`' + ' ' + col.dataType.catalogString
+  val colComment = col.getComment()
+  val x = if (colComment.isDefined) {
+val columnComment = " comment \"" + colComment.get + "\""
--- End diff --

No need to repeat logic, just add columnComment as empty string if no 
colComment


---