[GitHub] [carbondata] QiangCai opened a new pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#discussion_r367884022
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/DatabaseDMSchemaStorageProvider.java
 ##########
 @@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.core.metadata.schema.table;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.common.exceptions.sql.NoSuchDataMapException;
+
+/**
+ * Stores datamap schema in database
+ */
+public class DatabaseDMSchemaStorageProvider implements DataMapSchemaStorageProvider {
 
 Review comment:
   yes, now it is an interface only, but we can implement it in the future

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#discussion_r367890907
 
 

 ##########
 File path: integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonExtensionSpark2SqlParser.scala
 ##########
 @@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.parser
+
+import scala.language.implicitConversions
+
+import org.apache.spark.sql.catalyst.plans.logical._
+import org.apache.spark.sql.catalyst.CarbonParserUtil
+import org.apache.spark.sql.execution.command._
+import org.apache.spark.sql.execution.command.management.CarbonLoadDataCommand
+import org.apache.spark.sql.execution.command.schema.{CarbonAlterTableAddColumnCommand, CarbonAlterTableColRenameDataTypeChangeCommand, CarbonAlterTableDropColumnCommand}
+
+import org.apache.carbondata.common.exceptions.sql.MalformedCarbonCommandException
+import org.apache.carbondata.core.constants.CarbonCommonConstants
+
+/**
+ * TODO remove the duplicate code and add the common methods to common class.
 
 Review comment:
   done, already refactory

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-575618648
 
 
   Build Failed  with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1679/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-575962993
 
 
   Build Failed  with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1684/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-575968428
 
 
   Build Failed  with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1687/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-575978216
 
 
   Build Failed  with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1688/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-575988147
 
 
   Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1690/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] xuchuanyin commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
xuchuanyin commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#discussion_r368287460
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
 ##########
 @@ -1100,6 +1101,62 @@ public static void deleteLoadsAndUpdateMetadata(CarbonTable carbonTable, boolean
     }
   }
 
+  public static void truncateTable(CarbonTable carbonTable)
+      throws ConcurrentOperationException, IOException {
+    ICarbonLock carbonTableStatusLock = CarbonLockFactory.getCarbonLockObj(
+        carbonTable.getAbsoluteTableIdentifier(), LockUsage.TABLE_STATUS_LOCK);
+    boolean locked = false;
+    try {
+      // Update load metadate file after cleaning deleted nodes
+      locked = carbonTableStatusLock.lockWithRetries();
+      if (locked) {
+        LOG.info("Table status lock has been successfully acquired.");
+        LoadMetadataDetails[] listOfLoadFolderDetailsArray =
+            SegmentStatusManager.readLoadMetadata(
+                CarbonTablePath.getMetadataPath(carbonTable.getTablePath()));
+        for (LoadMetadataDetails listOfLoadFolderDetails : listOfLoadFolderDetailsArray) {
+          boolean writing;
+          switch (listOfLoadFolderDetails.getSegmentStatus()) {
+            case INSERT_IN_PROGRESS:
+              writing = true;
+              break;
+            case INSERT_OVERWRITE_IN_PROGRESS:
+              writing = true;
+              break;
+            case STREAMING:
+              writing = true;
+              break;
+            default:
+              writing = false;
+          }
+          if (writing) {
+            throw new ConcurrentOperationException(carbonTable, "insert", "truncate");
+          }
+        }
 
 Review comment:
   can be optimized to reduce lines of code

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
QiangCai commented on a change in pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#discussion_r368291356
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
 ##########
 @@ -1100,6 +1101,62 @@ public static void deleteLoadsAndUpdateMetadata(CarbonTable carbonTable, boolean
     }
   }
 
+  public static void truncateTable(CarbonTable carbonTable)
+      throws ConcurrentOperationException, IOException {
+    ICarbonLock carbonTableStatusLock = CarbonLockFactory.getCarbonLockObj(
+        carbonTable.getAbsoluteTableIdentifier(), LockUsage.TABLE_STATUS_LOCK);
+    boolean locked = false;
+    try {
+      // Update load metadate file after cleaning deleted nodes
+      locked = carbonTableStatusLock.lockWithRetries();
+      if (locked) {
+        LOG.info("Table status lock has been successfully acquired.");
+        LoadMetadataDetails[] listOfLoadFolderDetailsArray =
+            SegmentStatusManager.readLoadMetadata(
+                CarbonTablePath.getMetadataPath(carbonTable.getTablePath()));
+        for (LoadMetadataDetails listOfLoadFolderDetails : listOfLoadFolderDetailsArray) {
+          boolean writing;
+          switch (listOfLoadFolderDetails.getSegmentStatus()) {
+            case INSERT_IN_PROGRESS:
+              writing = true;
+              break;
+            case INSERT_OVERWRITE_IN_PROGRESS:
+              writing = true;
+              break;
+            case STREAMING:
+              writing = true;
+              break;
+            default:
+              writing = false;
+          }
+          if (writing) {
+            throw new ConcurrentOperationException(carbonTable, "insert", "truncate");
+          }
+        }
 
 Review comment:
   fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-576008017
 
 
   Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1692/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] jackylk commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
jackylk commented on issue #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574#issuecomment-576021770
 
 
   LGTM

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] asfgit closed pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions

GitBox
In reply to this post by GitBox
asfgit closed pull request #3574: [CARBONDATA-3503] Optimize Carbon SparkExtensions
URL: https://github.com/apache/carbondata/pull/3574
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services
12