ShreelekhyaG commented on a change in pull request #4180:
URL: https://github.com/apache/carbondata/pull/4180#discussion_r694642909
##########
File path:
integration/spark/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/ChangeDataTypeTestCases.scala
##########
@@ -173,6 +175,48 @@ class ChangeDataTypeTestCases extends QueryTest with
BeforeAndAfterAll {
test_change_data_type()
}
+ test("test alter change datatype for complex types") {
+ sql("drop table if exists test_rename")
+ sql("CREATE TABLE test_rename (name string) STORED AS carbondata")
+ // add complex columns
+ sql("alter table test_rename add columns(mapField1 MAP<int, int>, " +
+ "strField1 struct<a:int,b:decimal(5,2)>, arrField1 array<int>)")
+ sql("insert into test_rename values('df',map(5, 6),named_struct('a',1,'b',
123.45),array(1))")
+ // change datatype operation
+ sql("alter table test_rename change mapField1 mapField1 MAP<int, long>")
+ sql("alter table test_rename change strField1 strField1
struct<a:long,b:decimal(6,2)>")
Review comment:
Done, edited existing test case.
##########
File path:
core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java
##########
@@ -119,12 +122,15 @@
for (CarbonDimension tableDimension : tableComplexDimension) {
if (isColumnMatches(isTransactionalTable,
queryDimension.getDimension(),
tableDimension)) {
- ProjectionDimension currentBlockDimension = null;
+ ProjectionDimension currentBlockDimension;
// If projection dimension is child of struct field and contains
Parent Ordinal
if (null !=
queryDimension.getDimension().getComplexParentDimension()) {
currentBlockDimension = new
ProjectionDimension(queryDimension.getDimension());
} else {
currentBlockDimension = new ProjectionDimension(tableDimension);
+ newComplexChildrenDatatypes = new HashMap<>();
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]