carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [11/47] carbondata git commit: [CARBONDATA-2781] Added fix for Null Pointer Excpetion when create datamap killed from UI
Date Thu, 09 Aug 2018 18:25:55 GMT
[CARBONDATA-2781] Added fix for Null Pointer Excpetion when create datamap killed from UI

What was the issue?
In undo meta, datamap was not being dropped.
In case of Pre-aggregate table or timeseries table, the datamap was not being dropped from
schema as undo meta method was not handling the same.

What is the solution?
Datamap gets dropped when create command is killed from UI during undo meta.

This closes #2552


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/864ccc3d
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/864ccc3d
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/864ccc3d

Branch: refs/heads/branch-1.4
Commit: 864ccc3da577beba7aa78beb507f9518f9276738
Parents: d752321
Author: praveenmeenakshi56 <praveenmeenakshi56@gmail.com>
Authored: Wed Jul 25 21:52:54 2018 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Thu Aug 9 23:38:51 2018 +0530

----------------------------------------------------------------------
 .../carbondata/datamap/PreAggregateDataMapProvider.java     | 9 ++++++---
 .../command/datamap/CarbonCreateDataMapCommand.scala        | 6 +++++-
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/864ccc3d/integration/spark2/src/main/java/org/apache/carbondata/datamap/PreAggregateDataMapProvider.java
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/java/org/apache/carbondata/datamap/PreAggregateDataMapProvider.java
b/integration/spark2/src/main/java/org/apache/carbondata/datamap/PreAggregateDataMapProvider.java
index a1f80b1..099d65d 100644
--- a/integration/spark2/src/main/java/org/apache/carbondata/datamap/PreAggregateDataMapProvider.java
+++ b/integration/spark2/src/main/java/org/apache/carbondata/datamap/PreAggregateDataMapProvider.java
@@ -39,11 +39,15 @@ public class PreAggregateDataMapProvider extends DataMapProvider {
   protected PreAggregateTableHelper helper;
   protected CarbonDropTableCommand dropTableCommand;
   protected SparkSession sparkSession;
+  private String dbName;
+  private String tableName;
 
   PreAggregateDataMapProvider(CarbonTable table, DataMapSchema schema,
       SparkSession sparkSession) {
     super(table, schema);
     this.sparkSession = sparkSession;
+    this.dbName = table.getDatabaseName();
+    this.tableName = table.getTableName() + '_' + schema.getDataMapName();
   }
 
   @Override
@@ -74,11 +78,10 @@ public class PreAggregateDataMapProvider extends DataMapProvider {
 
   @Override
   public void cleanMeta() {
-    DataMapSchema dataMapSchema = getDataMapSchema();
     dropTableCommand = new CarbonDropTableCommand(
         true,
-        new Some<>(dataMapSchema.getRelationIdentifier().getDatabaseName()),
-        dataMapSchema.getRelationIdentifier().getTableName(),
+        new Some<>(dbName),
+        tableName,
         true);
     dropTableCommand.processMetadata(sparkSession);
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/864ccc3d/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
index c40dcb0..1e4c2c3 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
@@ -181,7 +181,11 @@ case class CarbonCreateDataMapCommand(
 
   override def undoMetadata(sparkSession: SparkSession, exception: Exception): Seq[Row] =
{
     if (dataMapProvider != null) {
-      dataMapProvider.cleanMeta()
+        CarbonDropDataMapCommand(
+          dataMapName,
+          true,
+          Some(TableIdentifier(mainTable.getTableName, Some(mainTable.getDatabaseName))),
+          forceDrop = false).run(sparkSession)
     }
     Seq.empty
   }


Mime
View raw message