Repository: tajo Updated Branches: refs/heads/master 2aaa991c9 -> a74134d33
TAJO-1924: Repair partition need to calculate partition volume. Closes #822 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/a74134d3 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/a74134d3 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/a74134d3 Branch: refs/heads/master Commit: a74134d33907f2b37b8617921e56c38cdcebf934 Parents: 2aaa991 Author: JaeHwa Jung <[email protected]> Authored: Tue Oct 13 21:10:29 2015 +0900 Committer: JaeHwa Jung <[email protected]> Committed: Tue Oct 13 21:10:29 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/a74134d3/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 8305a5d..7e74d3e 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,8 @@ Release 0.12.0 - unreleased BUG FIXES + TAJO-1924: Repair partition need to calculate partition volume. (jaehwa) + TAJO-1913: Timezone does not affect the constant folding. (hyunsik) TAJO-1895: Add a maven profile to skip the unit tests of http://git-wip-us.apache.org/repos/asf/tajo/blob/a74134d3/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/a74134d3/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 5783944..da19625 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(); }
