Github user ravipesala commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1493#discussion_r150668515 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/preaaggregate/PreAggregateListeners.scala --- @@ -94,23 +93,43 @@ object PreAggregateDataTypeChangePreListener extends OperationEventListener { val carbonTable = dataTypeChangePreListener.carbonTable val alterTableDataTypeChangeModel = dataTypeChangePreListener.alterTableDataTypeChangeModel val columnToBeAltered: String = alterTableDataTypeChangeModel.columnName - val dataMapSchemas = carbonTable.getTableInfo.getDataMapSchemaList - if (dataMapSchemas != null && !dataMapSchemas.isEmpty) { + if (carbonTable.hasDataMapSchema) { + val dataMapSchemas = carbonTable.getTableInfo.getDataMapSchemaList dataMapSchemas.asScala.foreach { dataMapSchema => - val childColumns = dataMapSchema.getChildSchema.getListOfColumns - if (childColumns.asScala.exists(_.getColumnName.equalsIgnoreCase(columnToBeAltered))) { - throw new UnsupportedOperationException(s"Column $columnToBeAltered exists in a " + - s"pre-aggregate table ${ dataMapSchema.toString - }. Cannot change datatype") - } + val childColumns = dataMapSchema.getChildSchema.getListOfColumns + val parentColumnNames = childColumns.asScala + .flatMap(_.getParentColumnTableRelations.asScala.map(_.getColumnName)) + if (parentColumnNames.contains(columnToBeAltered)) { + throw new UnsupportedOperationException(s"Column $columnToBeAltered exists in a " + --- End diff -- split after the argument like ``` UnsupportedOperationException( s"Column $columnToBeAltered exists in ```
---