tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blrun...@apache.org
Subject tajo git commit: TAJO-1924: Repair partition need to calculate partition volume.
Date Tue, 13 Oct 2015 12:16:08 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.11.0 becab195c -> 721e1650a


TAJO-1924: Repair partition need to calculate partition volume.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/721e1650
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/721e1650
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/721e1650

Branch: refs/heads/branch-0.11.0
Commit: 721e1650a84822e18f65d9f641cbefacad88bf92
Parents: becab19
Author: JaeHwa Jung <blrunner@apache.org>
Authored: Tue Oct 13 21:15:31 2015 +0900
Committer: JaeHwa Jung <blrunner@apache.org>
Committed: Tue Oct 13 21:15:31 2015 +0900

----------------------------------------------------------------------
 CHANGES                                                       | 2 ++
 .../java/org/apache/tajo/engine/query/TestAlterTable.java     | 6 ++++++
 .../main/java/org/apache/tajo/master/exec/DDLExecutor.java    | 7 +++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/721e1650/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 2dc2940..8b61371 100644
--- a/CHANGES
+++ b/CHANGES
@@ -285,6 +285,8 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1924: Repair partition need to calculate partition volume. (jaehwa)
+
     TAJO-1900: When a record column and its child column are retrieved together, 
     the record column might not be inferred as record type properly. (jihoon)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/721e1650/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestAlterTable.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestAlterTable.java
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestAlterTable.java
index 58ceb74..4c9f367 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestAlterTable.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestAlterTable.java
@@ -478,6 +478,12 @@ public class TestAlterTable extends QueryTestCaseBase {
 
     verifyPartitionCount(databaseName, tableName, 5);
 
+    // Check the volume of partition
+    List<CatalogProtos.PartitionDescProto> partitions = catalog.getPartitionsOfTable(databaseName,
tableName);
+    for (CatalogProtos.PartitionDescProto eachPartition : partitions) {
+      assertTrue(eachPartition.getNumBytes() > 0L);
+    }
+
     // Remove all partitions
     dropPartitions(databaseName, tableName, tableDesc.getPartitionMethod().getExpressionSchema().getAllColumns());
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/721e1650/tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java
index 588ea1f..a604f94 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java
@@ -632,7 +632,7 @@ public class DDLExecutor {
 
       // if there is partition column in the path
       if (startIdx > -1) {
-        PartitionDescProto targetPartition = getPartitionDesc(tablePath, filteredPath);
+        PartitionDescProto targetPartition = getPartitionDesc(tablePath, filteredPath, fs);
         if (!existingPartitionNames.contains(targetPartition.getPartitionName())) {
           if (LOG.isDebugEnabled()) {
             LOG.debug("Partitions not in CatalogStore:" + targetPartition.getPartitionName());
@@ -658,7 +658,7 @@ public class DDLExecutor {
     LOG.info("Total added partitions to CatalogStore: " + targetPartitions.size());
   }
 
-  private PartitionDescProto getPartitionDesc(Path tablePath, Path partitionPath) throws
IOException {
+  private PartitionDescProto getPartitionDesc(Path tablePath, Path partitionPath, FileSystem
fs) throws IOException {
     String partitionName = StringUtils.unescapePathName(partitionPath.toString());
 
     int startIndex = partitionName.indexOf(tablePath.toString()) + tablePath.toString().length();
@@ -682,6 +682,9 @@ public class DDLExecutor {
 
     builder.setPath(partitionPath.toString());
 
+    ContentSummary contentSummary = fs.getContentSummary(partitionPath);
+    builder.setNumBytes(contentSummary.getLength());
+
     return builder.build();
   }
 


Mime
View raw message