Indhumathi27 commented on a change in pull request #4115:
URL: https://github.com/apache/carbondata/pull/4115#discussion_r613755261



##########
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala
##########
@@ -275,6 +275,64 @@ class AlterTableColumnSchemaGenerator(
         allColumns ++= Seq(columnSchema)
       }
       newCols ++= Seq(columnSchema)
+      if (DataTypes.isArrayType(columnSchema.getDataType)) {
+        columnSchema.setNumberOfChild(field.children.size)
+        val childField = field.children.get(0)
+        // TODO: should support adding multi-level complex columns: 
CARBONDATA-4164
+        if (childField.children != Some(null)) {

Review comment:
       ```suggestion
           if (!childField.children.contains(null)) {
   ```
   Handle in all places

##########
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala
##########
@@ -275,6 +275,64 @@ class AlterTableColumnSchemaGenerator(
         allColumns ++= Seq(columnSchema)
       }
       newCols ++= Seq(columnSchema)
+      if (DataTypes.isArrayType(columnSchema.getDataType)) {
+        columnSchema.setNumberOfChild(field.children.size)
+        val childField = field.children.get(0)
+        // TODO: should support adding multi-level complex columns: 
CARBONDATA-4164
+        if (childField.children != Some(null)) {
+          throw new UnsupportedOperationException("Only single-level complex 
types are allowed")
+        }
+        val childSchema: ColumnSchema = TableNewProcessor.createColumnSchema(

Review comment:
       Can move getting child schema to new method and reuse for array and 
struct type




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


Reply via email to