Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1443#discussion_r149936691
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
 ---
    @@ -446,6 +447,35 @@ class CarbonFileMetastore extends CarbonMetaStore {
         }
       }
     
    +  protected def updateParentTableInfo(parentRelationIdentifier: 
RelationIdentifier,
    +      childCarbonTable: CarbonTable)(sparkSession: SparkSession): Unit = {
    +    val dbName = parentRelationIdentifier.getDatabaseName
    +    val tableName = parentRelationIdentifier.getTableName
    +    try {
    +      val parentCarbonTable = 
CarbonEnv.getInstance(sparkSession).carbonMetastore
    +        .lookupRelation(Some(dbName), 
tableName)(sparkSession).asInstanceOf[CarbonRelation]
    +        .tableMeta.carbonTable
    +      val childSchemas = 
parentCarbonTable.getTableInfo.getDataMapSchemaList
    +      val childSchemaIterator = childSchemas.iterator()
    +      while (childSchemaIterator.hasNext) {
    +        val childSchema = childSchemaIterator.next()
    +        if 
(childSchema.getChildSchema.equals(childCarbonTable.getTableInfo.getFactTable)) 
{
    +          childSchemaIterator.remove()
    +        }
    +      }
    +      val schemaConverter = new ThriftWrapperSchemaConverterImpl
    +      PreAggregateUtil
    +        .updateSchemaInfo(parentCarbonTable,
    +          schemaConverter
    +            .fromWrapperToExternalTableInfo(parentCarbonTable.getTableInfo,
    +              dbName,
    +              tableName))(sparkSession)
    +    } catch {
    +      case ex: Exception =>
    +        LOGGER.error(ex, s"Table $dbName.$tableName does not exist.")
    --- End diff --
    
    throw exception


---

Reply via email to