[GitHub] [carbondata] kunal642 commented on a change in pull request #3431: [CARBONDATA-3566] Support add segment for partition table

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 commented on a change in pull request #3431: [CARBONDATA-3566] Support add segment for partition table

GitBox
kunal642 commented on a change in pull request #3431: [CARBONDATA-3566] Support add segment for partition table
URL: https://github.com/apache/carbondata/pull/3431#discussion_r346146189
 
 

 ##########
 File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAddLoadCommand.scala
 ##########
 @@ -225,10 +325,30 @@ case class CarbonAddLoadCommand(
       OperationListenerBus.getInstance()
         .fireEvent(buildDataMapPostExecutionEvent, dataMapOperationContext)
     }
-    Seq.empty
   }
 
-
+  // extract partition column and value, for example, given
+  // path1 = path/to/partition/a=1/b=earth
+  // path2 = path/to/partition/a=2/b=moon
+  // will extract a list of CarbonPartitionSpec:
+  //   CarbonPartitionSpec {("a=1","b=earth"), "path/to/partition"}
+  //   CarbonPartitionSpec {("a=2","b=moon"), "path/to/partition"}
+  def collectPartitionSpecList(
+      sparkSession: SparkSession,
+      tablePath: String,
+      inputPath: String,
+      partitionPaths: Seq[String]
+  ): Seq[CarbonPartitionSpec] = {
+    partitionPaths.map { path =>
+      try {
+        val partitionOnlyPath = path.substring(inputPath.length + 1)
+        val partitionColumnAndValue = partitionOnlyPath.split("/").toList.asJava
+        new CarbonPartitionSpec(partitionColumnAndValue, path)
 
 Review comment:
   ok
   

----------------------------------------------------------------
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