akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614576721 ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -319,10 +373,6 @@ class AlterTableColumnSchemaGenerator( sys.error(s"Duplicate column found with name: $name") }) - if (newCols.exists(_.getDataType.isComplexType)) { Review comment: done ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -255,6 +276,10 @@ class AlterTableColumnSchemaGenerator( // add new dimension columns alterTableModel.dimCols.foreach(field => { + if (field.dataType.get.equals("Map")) { Review comment: done -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-820942569 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12602/job/ApacheCarbonPRBuilder2.3/5197/ -- 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] |
In reply to this post by GitBox
akkio-97 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-820958582 retest this please -- 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] |
In reply to this post by GitBox
Indhumathi27 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614614639 ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/alterTable/TestAlterTableAddColumns.scala ########## @@ -136,6 +140,232 @@ class TestAlterTableAddColumns extends QueryTest with BeforeAndAfterAll { sql(s"""DROP TABLE IF EXISTS ${ tableName }""") } + test("Test adding of array of all primitive datatypes") { + sql("DROP TABLE IF EXISTS alter_com") + sql("CREATE TABLE alter_com(intfield int) STORED AS carbondata") + sql( + "ALTER TABLE alter_com ADD COLUMNS(arr1 array<short>, arr2 array<int>, arr3 " + + "array<long>, arr4 array<double>, arr5 array<decimal(8,2)>, arr6 array<string>, arr7 " + + "array<char(5)>, arr8 array<varchar(50)>, arr9 array<boolean>, arr10 array<date>, arr11 " + + "array<timestamp> )") + val columns = sql("desc table alter_com").collect() + assert(columns.size.equals(12)) + sql( + "insert into alter_com values(1,array(1,5),array(1,2),array(1,2,3),array(1.2d,2.3d),array" + + "(4.5,6.7),array('hello','world'),array('a','bcd'),array('abcd','efg'),array(true,false)," + + "array('2017-02-01','2018-09-11'),array('2017-02-01 00:01:00','2018-02-01 02:21:00') )") + checkAnswer(sql( + "select * from alter_com"), + Seq(Row(1, make(Array(1, 5)), + make(Array(1, 2)), + make(Array(1, 2, 3)), + make(Array(1.2, 2.3)), + make(Array(java.math.BigDecimal.valueOf(4.5).setScale(2), + java.math.BigDecimal.valueOf(6.7).setScale(2))), + make(Array("hello", "world")), + make(Array("a", "bcd")), + make(Array("abcd", "efg")), + make(Array(true, false)), + make(Array(Date.valueOf("2017-02-01"), Date.valueOf("2018-09-11"))), + make(Array(Timestamp.valueOf("2017-02-01 00:01:00"), + Timestamp.valueOf("2018-02-01 02:21:00"))) + ))) + sql("DROP TABLE IF EXISTS alter_com") + } + + test("Test adding of struct of all primitive datatypes") { + sql("DROP TABLE IF EXISTS alter_com") + sql( + "CREATE TABLE alter_com(intField INT) STORED AS " + + "carbondata") + sql( + "ALTER TABLE alter_com ADD COLUMNS(structField struct<a:short,b:int,c:long,d:double, " + + "e:decimal(8,2),f:string,g:char(5),h:varchar(50),i:boolean,j:date,k:timestamp>)") + sql( + "insert into alter_com values(1, named_struct('a',1,'b',2,'c',3,'d',1.23,'e',2.34,'f'," + + "'hello','g','abc','h','def','i',true,'j','2017-02-01','k','2018-02-01 02:00:00.0') ) ") + val rows = sql("select structField from alter_com").collect() + assert(rows(0)(0).asInstanceOf[GenericRowWithSchema].size == 11) + sql("DROP TABLE IF EXISTS alter_com") + } + + def insertIntoTableForArrayType(): Unit = { + sql("insert into alter_com values(4,array(2),array(1,2,3,4),array('abc','def'))") + sql("insert into alter_com values(5,array(1,2),array(1), array('Hulk','Thor'))") + sql( + "insert into alter_com values(6,array(1,2,3),array(1234,8,33333),array('Iron','Man'," + + "'Jarvis'))") + } + + def checkRestulForArrayType(): Unit = { + val totalRows = sql("select * from alter_com").collect() + val a = sql("select * from alter_com where array_contains(arr2,2)").collect + val b = sql("select * from alter_com where array_contains(arr3,'Thor')").collect + val c = sql("select * from alter_com where intField = 1").collect + assert(totalRows.size == 6) + assert(a.size == 1) + assert(b.size == 1) + // check default value for newly added array column that is index - 3 and 4 + assert(c(0)(2) == null && c(0)(3) == null) + } + + def createTableForComplexTypes(dictionary: String, complexType: String): Unit = { + if (complexType.equals("ARRAY")) { + sql("DROP TABLE IF EXISTS alter_com") + sql( + "CREATE TABLE alter_com(intField INT, arr1 array<int>) " + + "STORED AS carbondata") + sql("insert into alter_com values(1,array(1) )") + sql("insert into alter_com values(2,array(9,0) )") + sql("insert into alter_com values(3,array(11,12,13) )") + sql( + s"ALTER TABLE alter_com ADD COLUMNS(arr2 array<int>, arr3 array<string>) TBLPROPERTIES" + + s"('$dictionary'='arr3')") + val schema = sql("describe alter_com").collect() + assert(schema.size == 4) + } else if (complexType.equals("STRUCT")) { + sql("DROP TABLE IF EXISTS alter_struct") + sql( + "create table alter_struct(roll int, department struct<id1:string,name1:string>) STORED " + + "AS carbondata") + sql( + "insert into alter_struct values(1, named_struct('id1', 'id1','name1','name1'))") + sql( + "ALTER TABLE alter_struct ADD COLUMNS(struct1 struct<a:string,b:string>, temp string," + + " intField int, struct2 struct<c:string,d:string,e:int>, arr array<int>) TBLPROPERTIES " + + "('LOCAL_DICTIONARY_INCLUDE'='struct1, struct2')") + val schema = sql("describe alter_struct").collect() + assert(schema.size == 7) + } + + } + + test("Test alter add for arrays enabling local dictionary") { + createTableForComplexTypes("LOCAL_DICTIONARY_INCLUDE", "ARRAY") + // For the previous segments the default value for newly added array column is null + insertIntoTableForArrayType + checkRestulForArrayType + sql(s"ALTER TABLE alter_com ADD COLUMNS(arr4 array<int>) ") + sql(s"ALTER TABLE alter_com ADD COLUMNS(arr5 array<int>, str struct<a:int,b:string>) ") + sql( + "insert into alter_com values(2,array(9,0),array(1,2,3),array(4,5),array(6,7),array(8,9)," + + "named_struct('a',1,'b','abcde') )") + val rows = sql("select * from alter_com").collect() + assert(rows.size == 7) + val columns = sql("desc table alter_com").collect() + assert(columns.size == 7) + sql("DROP TABLE IF EXISTS alter_com") + + } + + test("Test alter add for arrays disabling local dictionary") { + createTableForComplexTypes("LOCAL_DICTIONARY_EXCLUDE", "ARRAY") + // For the previous segments the default value for newly added array column is null + insertIntoTableForArrayType + checkRestulForArrayType + sql("DROP TABLE IF EXISTS alter_com") + Review comment: remove unwanted line in all testcases -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-820983730 Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12602/job/ApacheCarbon_PR_Builder_2.4.5/3446/ -- 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] |
In reply to this post by GitBox
akashrn5 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614629919 ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -235,6 +236,26 @@ class AlterTableColumnSchemaGenerator( dataType.toString.equals("STRUCT") } + private def createChildSchema(childField: Field, currentSchemaOrdinal: Int): ColumnSchema = { + // TODO: should support adding multi-level complex columns: CARBONDATA-4164 + if (!childField.children.contains(null)) { Review comment: .contains, can we replace with `isDefined`? thats more clear ########## File path: docs/ddl-of-carbondata.md ########## @@ -694,7 +694,7 @@ CarbonData DDL statements are documented here,which includes: ``` ALTER TABLE carbon ADD COLUMNS (a1 INT, b1 STRING) TBLPROPERTIES('DEFAULT.VALUE.a1'='10') ``` - **NOTE:** Add Complex datatype columns is not supported. + **NOTE:** Adding of only single-level Complex datatype columns(only array and struct) is supported. Review comment: please give example if adding complex column array and struct ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -235,6 +236,26 @@ class AlterTableColumnSchemaGenerator( dataType.toString.equals("STRUCT") } + private def createChildSchema(childField: Field, currentSchemaOrdinal: Int): ColumnSchema = { + // TODO: should support adding multi-level complex columns: CARBONDATA-4164 + if (!childField.children.contains(null)) { + throw new UnsupportedOperationException( + "Alter add columns with single-level complex types are only allowed") Review comment: ```suggestion "Alter add columns with nested complex types is not allowed") ``` -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-821022713 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12602/job/ApacheCarbonPRBuilder2.3/5198/ -- 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] |
In reply to this post by GitBox
akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614670056 ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -235,6 +236,26 @@ class AlterTableColumnSchemaGenerator( dataType.toString.equals("STRUCT") } + private def createChildSchema(childField: Field, currentSchemaOrdinal: Int): ColumnSchema = { + // TODO: should support adding multi-level complex columns: CARBONDATA-4164 + if (!childField.children.contains(null)) { Review comment: have put check on size -- 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] |
In reply to this post by GitBox
akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614672631 ########## File path: docs/ddl-of-carbondata.md ########## @@ -694,7 +694,7 @@ CarbonData DDL statements are documented here,which includes: ``` ALTER TABLE carbon ADD COLUMNS (a1 INT, b1 STRING) TBLPROPERTIES('DEFAULT.VALUE.a1'='10') ``` - **NOTE:** Add Complex datatype columns is not supported. + **NOTE:** Adding of only single-level Complex datatype columns(only array and struct) is supported. Review comment: done -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-821077689 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12602/job/ApacheCarbonPRBuilder2.3/5199/ -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-821081138 Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12602/job/ApacheCarbon_PR_Builder_2.4.5/3447/ -- 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] |
In reply to this post by GitBox
akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614670056 ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -235,6 +236,26 @@ class AlterTableColumnSchemaGenerator( dataType.toString.equals("STRUCT") } + private def createChildSchema(childField: Field, currentSchemaOrdinal: Int): ColumnSchema = { + // TODO: should support adding multi-level complex columns: CARBONDATA-4164 + if (!childField.children.contains(null)) { Review comment: isDefined cannot be used because it contains Some(null) -- 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] |
In reply to this post by GitBox
akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614670056 ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala ########## @@ -235,6 +236,26 @@ class AlterTableColumnSchemaGenerator( dataType.toString.equals("STRUCT") } + private def createChildSchema(childField: Field, currentSchemaOrdinal: Int): ColumnSchema = { + // TODO: should support adding multi-level complex columns: CARBONDATA-4164 + if (!childField.children.contains(null)) { Review comment: isDefined cannot be used because it contains Some(null) in case of single-level and a field in case of multi-level. So isDefined is true in both cases -- 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] |
In reply to this post by GitBox
akashrn5 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r614776990 ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/alterTable/TestAlterTableAddColumns.scala ########## @@ -136,14 +139,228 @@ class TestAlterTableAddColumns extends QueryTest with BeforeAndAfterAll { sql(s"""DROP TABLE IF EXISTS ${ tableName }""") } + test("Test adding of array of all primitive datatypes") { Review comment: @akkio-97 please add test case for add columns with comment for complex column and then also add a test case to verify the SchemaEvolutionEntry after add column -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-821137636 Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12602/job/ApacheCarbon_PR_Builder_2.4.5/3448/ -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-821138733 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12602/job/ApacheCarbonPRBuilder2.3/5200/ -- 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] |
In reply to this post by GitBox
akkio-97 commented on a change in pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#discussion_r615567566 ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/alterTable/TestAlterTableAddColumns.scala ########## @@ -136,14 +139,228 @@ class TestAlterTableAddColumns extends QueryTest with BeforeAndAfterAll { sql(s"""DROP TABLE IF EXISTS ${ tableName }""") } + test("Test adding of array of all primitive datatypes") { Review comment: done -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-822254971 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12602/job/ApacheCarbonPRBuilder2.3/5203/ -- 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] |
In reply to this post by GitBox
CarbonDataQA2 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-822256718 Build Success with Spark 2.4.5, Please check CI http://121.244.95.60:12602/job/ApacheCarbon_PR_Builder_2.4.5/3451/ -- 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] |
In reply to this post by GitBox
Indhumathi27 commented on pull request #4115: URL: https://github.com/apache/carbondata/pull/4115#issuecomment-822311739 LGTM -- 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] |
Free forum by Nabble | Edit this page |