Github user manishgupta88 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2225#discussion_r185481687 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/strategy/DDLStrategy.scala --- @@ -224,15 +224,32 @@ class DDLStrategy(sparkSession: SparkSession) extends SparkStrategy { && (tableDesc.provider.get.equals("org.apache.spark.sql.CarbonSource") || tableDesc.provider.get.equalsIgnoreCase("carbondata")) => val updatedCatalog = - CarbonSource.updateCatalogTableWithCarbonSchema(tableDesc, sparkSession) + CarbonSource.updateCatalogTableWithCarbonSchema(tableDesc, sparkSession, None) val cmd = CreateDataSourceTableCommand(updatedCatalog, ignoreIfExists = mode == SaveMode.Ignore) ExecutedCommandExec(cmd) :: Nil + case cmd@CreateDataSourceTableAsSelectCommand(tableDesc, mode, query) + if tableDesc.provider.get != DDLUtils.HIVE_PROVIDER + && (tableDesc.provider.get.equals("org.apache.spark.sql.CarbonSource") + || tableDesc.provider.get.equalsIgnoreCase("carbondata")) => + val updatedCatalog = CarbonSource + .updateCatalogTableWithCarbonSchema(tableDesc, sparkSession, Option(query)) + val cmd = CreateCarbonSourceTableAsSelectCommand(updatedCatalog, SaveMode.Ignore, query) + ExecutedCommandExec(cmd) :: Nil + case c...@org.apache.spark.sql.execution.datasources.CreateTable(tableDesc, mode, query) + if tableDesc.provider.get != DDLUtils.HIVE_PROVIDER + && (tableDesc.provider.get.equals("org.apache.spark.sql.CarbonSource") + || tableDesc.provider.get.equalsIgnoreCase("carbondata")) => + val updatedCatalog = CarbonSource + .updateCatalogTableWithCarbonSchema(tableDesc, sparkSession, query) + val cmd = CreateCarbonSourceTableAsSelectCommand(updatedCatalog, SaveMode.Ignore, query.get) + ExecutedCommandExec(cmd) :: Nil case CreateDataSourceTableCommand(table, ignoreIfExists) if table.provider.get != DDLUtils.HIVE_PROVIDER && (table.provider.get.equals("org.apache.spark.sql.CarbonSource") || table.provider.get.equalsIgnoreCase("carbondata")) => - val updatedCatalog = CarbonSource.updateCatalogTableWithCarbonSchema(table, sparkSession) + val updatedCatalog = CarbonSource + .updateCatalogTableWithCarbonSchema(table, sparkSession, None) --- End diff -- same comment as above
---