[GitHub] [carbondata] Karan980 commented on a change in pull request #3979: [Carbondata-3954] Fix insertion from ORC table into carbon table when sort scope is global sort
Karan980 commented on a change in pull request #3979: URL: https://github.com/apache/carbondata/pull/3979#discussion_r509032391 ## File path: integration/spark/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala ## @@ -1009,6 +1009,10 @@ object CommonUtil { private def convertSparkComplexTypeToCarbonObject(data: AnyRef, objectDataType: DataType): AnyRef = { +if (data == null && (objectDataType.isInstanceOf[ArrayType] Review comment: DataType is a spark class here. It doesn't have isComplexType method. 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: us...@infra.apache.org
[GitHub] [carbondata] Karan980 commented on a change in pull request #3979: [Carbondata-3954] Fix insertion from ORC table into carbon table when sort scope is global sort
Karan980 commented on a change in pull request #3979: URL: https://github.com/apache/carbondata/pull/3979#discussion_r509000503 ## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/allqueries/InsertIntoCarbonTableTestCase.scala ## @@ -67,6 +67,21 @@ class InsertIntoCarbonTableTestCase extends QueryTest with BeforeAndAfterAll { } + test("insert from orc-select columns with columns having null values and sort scope as global sort") { +sql("drop table if exists TORCSource") +sql("drop table if exists TCarbon") +sql("create table TORCSource(name string,col array,fee int) STORED AS orc") +sql("insert into TORCSource values('karan',null,2)") +sql("create table TCarbon(name string, col array,fee int) STORED AS carbondata TBLPROPERTIES ('SORT_COLUMNS'='name','TABLE_BLOCKSIZE'='128','TABLE_BLOCKLET_SIZE'='128','SORT_SCOPE'='global_SORT')") +sql("insert overwrite table TCarbon select name,col,fee from TORCSource") +val result = sql("show segments for table TCarbon").collect()(0).get(1).toString() +if(!"Success".equalsIgnoreCase(result)) { Review comment: Done ## File path: integration/spark/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala ## @@ -1011,38 +1011,46 @@ object CommonUtil { objectDataType: DataType): AnyRef = { objectDataType match { case _: ArrayType => -val arrayDataType = objectDataType.asInstanceOf[ArrayType] -val arrayData = data.asInstanceOf[UnsafeArrayData] -val size = arrayData.numElements() -val childDataType = arrayDataType.elementType -val arrayChildObjects = new Array[AnyRef](size) -var i = 0 -while (i < size) { - arrayChildObjects(i) = convertSparkComplexTypeToCarbonObject(arrayData.get(i, -childDataType), childDataType) - i = i + 1 +if (data == null) { Review comment: Done ## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/allqueries/InsertIntoCarbonTableTestCase.scala ## @@ -67,6 +67,21 @@ class InsertIntoCarbonTableTestCase extends QueryTest with BeforeAndAfterAll { } + test("insert from orc-select columns with columns having null values and sort scope as global sort") { +sql("drop table if exists TORCSource") +sql("drop table if exists TCarbon") +sql("create table TORCSource(name string,col array,fee int) STORED AS orc") +sql("insert into TORCSource values('karan',null,2)") +sql("create table TCarbon(name string, col array,fee int) STORED AS carbondata TBLPROPERTIES ('SORT_COLUMNS'='name','TABLE_BLOCKSIZE'='128','TABLE_BLOCKLET_SIZE'='128','SORT_SCOPE'='global_SORT')") +sql("insert overwrite table TCarbon select name,col,fee from TORCSource") +val result = sql("show segments for table TCarbon").collect()(0).get(1).toString() +if(!"Success".equalsIgnoreCase(result)) { + assert(false) +} +sql("drop table if exists TORCSource") +sql("drop table if exists TCarbon") + } + 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: us...@infra.apache.org
[GitHub] [carbondata] Karan980 commented on a change in pull request #3979: [Carbondata-3954] Fix insertion from ORC table into carbon table when sort scope is global sort
Karan980 commented on a change in pull request #3979: URL: https://github.com/apache/carbondata/pull/3979#discussion_r503140543 ## File path: integration/spark/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala ## @@ -1011,38 +1011,46 @@ object CommonUtil { objectDataType: DataType): AnyRef = { objectDataType match { case _: ArrayType => -val arrayDataType = objectDataType.asInstanceOf[ArrayType] -val arrayData = data.asInstanceOf[UnsafeArrayData] -val size = arrayData.numElements() -val childDataType = arrayDataType.elementType -val arrayChildObjects = new Array[AnyRef](size) -var i = 0 -while (i < size) { - arrayChildObjects(i) = convertSparkComplexTypeToCarbonObject(arrayData.get(i, -childDataType), childDataType) - i = i + 1 +if (data == null) { Review comment: For dateType if data is null that is handled by some other way which is not returning null. That's why i didn't put it after line 1011 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: us...@infra.apache.org
[GitHub] [carbondata] Karan980 commented on a change in pull request #3979: [Carbondata-3954] Fix insertion from ORC table into carbon table when sort scope is global sort
Karan980 commented on a change in pull request #3979: URL: https://github.com/apache/carbondata/pull/3979#discussion_r503139533 ## File path: integration/spark/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala ## @@ -1011,38 +1011,46 @@ object CommonUtil { objectDataType: DataType): AnyRef = { objectDataType match { case _: ArrayType => -val arrayDataType = objectDataType.asInstanceOf[ArrayType] -val arrayData = data.asInstanceOf[UnsafeArrayData] -val size = arrayData.numElements() -val childDataType = arrayDataType.elementType -val arrayChildObjects = new Array[AnyRef](size) -var i = 0 -while (i < size) { - arrayChildObjects(i) = convertSparkComplexTypeToCarbonObject(arrayData.get(i, -childDataType), childDataType) - i = i + 1 +if (data == null) { Review comment: For dateType if data is null that is handled by some other way which is not returning null. That's why i didn't put it after line 1011 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: us...@infra.apache.org