[CARBONDATA-4329] Fix multiple issues with External table
authorIndhumathi27 <indhumathim27@gmail.com>
Wed, 23 Mar 2022 05:46:01 +0000 (11:16 +0530)
committerkunal642 <kunalkapoor642@gmail.com>
Fri, 1 Apr 2022 09:43:44 +0000 (15:13 +0530)
commit46b62cf6f79d1d826b498609435337b2ed342bbe
tree17d2d422bf8b7b78c8fefe00447ce6d97e4ac299
parentd6ce9467488d342134f8072326667aef7031e8a2
[CARBONDATA-4329] Fix multiple issues with External table

Why is this PR needed?
Issue 1:
When we create external table on transactional table location,
schema file will be present. While creating external table,
which is also transactional, the schema file is overwritten

Issue 2:
If external table is created on a location, where the source table
already exists, on drop external table, it is deleting the table data.
Query on the source table fails

What changes were proposed in this PR?
Avoid writing schema file if table type is external and transactional
Dont drop external table location data, if table_type is external

This closes #4255
core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
integration/spark/src/main/scala/org/apache/spark/sql/CarbonCountStar.scala
integration/spark/src/main/scala/org/apache/spark/sql/CarbonSource.scala
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonDropTableCommand.scala
integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
integration/spark/src/main/scala/org/apache/spark/sql/parser/CarbonSparkSqlParserUtil.scala
integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateExternalTable.scala