You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by jh...@apache.org on 2014/01/14 02:50:00 UTC
git commit: TAJO-485: 'CREATE TABLE AS' does not work properly with
partition. (jinho)
Updated Branches:
refs/heads/master c4b81569a -> 29ae39807
TAJO-485: 'CREATE TABLE AS' does not work properly with partition. (jinho)
Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/29ae3980
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/29ae3980
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/29ae3980
Branch: refs/heads/master
Commit: 29ae398073d2642c098bdc990b24902af20c892d
Parents: c4b8156
Author: jinossy <ji...@gmail.com>
Authored: Tue Jan 14 10:49:28 2014 +0900
Committer: jinossy <ji...@gmail.com>
Committed: Tue Jan 14 10:49:28 2014 +0900
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../engine/planner/physical/SeqScanExec.java | 1 +
.../apache/tajo/engine/query/TestCTASQuery.java | 10 +++-
.../tajo/engine/query/TestTablePartitions.java | 51 +++++++++++++-------
4 files changed, 45 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/29ae3980/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1be92c0..8f7efd7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -207,6 +207,8 @@ Release 0.8.0 - unreleased
BUG FIXES
+ TAJO-485: 'CREATE TABLE AS' does not work properly with partition. (jinho)
+
TAJO-488: Data fetcher doesn't close small file in shuffle. (jinho)
TAJO-496: java.lang.NoSuchFieldError: IS_SECURITY_ENABLED when debugging
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/29ae3980/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
index a8ef61a..3de75a9 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
@@ -81,6 +81,7 @@ public class SeqScanExec extends PhysicalExec {
PartitionDesc partitionDesc = plan.getTableDesc().getPartitions();
Schema columnPartitionSchema = (Schema) partitionDesc.getSchema().clone();
String qualifier = inSchema.getColumn(0).getQualifier();
+ columnPartitionSchema.setQualifier(qualifier);
// Remove partition key columns from an input schema.
this.inSchema = PlannerUtil.rewriteColumnPartitionedTableSchema(
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/29ae3980/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
index f879c2c..2d2a278 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
@@ -89,11 +89,14 @@ public class TestCTASQuery {
resultRows1.put(45.0d, new int[]{3, 2});
resultRows1.put(38.0d, new int[]{2, 2});
- for (int i = 0; i < 3 && res.next(); i++) {
+ int i = 0;
+ while(res.next()) {
assertEquals(resultRows1.get(res.getDouble(3))[0], res.getInt(1));
assertEquals(resultRows1.get(res.getDouble(3))[1], res.getInt(2));
+ i++;
}
res.close();
+ assertEquals(2, i);
}
@Test
@@ -129,11 +132,14 @@ public class TestCTASQuery {
resultRows1.put(45.0d, new int[]{3, 2});
resultRows1.put(38.0d, new int[]{2, 2});
- for (int i = 0; i < 3 && res.next(); i++) {
+ int i = 0;
+ while(res.next()) {
assertEquals(resultRows1.get(res.getDouble(3))[0], res.getInt(1));
assertEquals(resultRows1.get(res.getDouble(3))[1], res.getInt(2));
+ i++;
}
res.close();
+ assertEquals(2, i);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/29ae3980/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
index d4e6e8c..e9b43be 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
@@ -83,11 +83,14 @@ public class TestTablePartitions {
resultRows1.put(45.0d, new int[]{3, 2});
resultRows1.put(38.0d, new int[]{2, 2});
- for (int i = 0; i < 3 && res.next(); i++) {
- resultRows1.get(res.getDouble(4))[0] = res.getInt(2);
- resultRows1.get(res.getDouble(4))[1] = res.getInt(3);
+ int i = 0;
+ while(res.next()) {
+ assertEquals(resultRows1.get(res.getDouble(4))[0], res.getInt(1));
+ assertEquals(resultRows1.get(res.getDouble(4))[1], res.getInt(2));
+ i++;
}
res.close();
+ assertEquals(2, i);
}
@Test
@@ -128,11 +131,16 @@ public class TestTablePartitions {
resultRows1.put(45.0d, new int[]{3, 2});
resultRows1.put(38.0d, new int[]{2, 2});
- for (int i = 0; i < 3 && res.next(); i++) {
- resultRows1.get(res.getDouble(4))[0] = res.getInt(2);
- resultRows1.get(res.getDouble(4))[1] = res.getInt(3);
+
+ int i = 0;
+ while(res.next()) {
+ assertEquals(resultRows1.get(res.getDouble(4))[0], res.getInt(2));
+ assertEquals(resultRows1.get(res.getDouble(4))[1], res.getInt(3));
+ i++;
}
res.close();
+ assertEquals(2, i);
+
Map<Double, int []> resultRows2 = Maps.newHashMap();
resultRows2.put(49.0d, new int[]{3, 3});
@@ -140,12 +148,15 @@ public class TestTablePartitions {
resultRows2.put(38.0d, new int[]{2, 2});
res = tpch.execute("select * from " + tableName + " where (col1 = 2 or col1 = 3) and col2 >= 2");
- for (int i = 0; i < 3 && res.next(); i++) {
- resultRows2.get(res.getDouble(4))[0] = res.getInt(2);
- resultRows2.get(res.getDouble(4))[1] = res.getInt(3);
+
+ i = 0;
+ while(res.next()) {
+ assertEquals(resultRows2.get(res.getDouble(4))[0], res.getInt(2));
+ assertEquals(resultRows2.get(res.getDouble(4))[1], res.getInt(3));
+ i++;
}
- assertFalse(res.next());
res.close();
+ assertEquals(3, i);
}
@Test
@@ -283,11 +294,14 @@ public class TestTablePartitions {
resultRows1.put(45.0d, new int[]{3, 2});
resultRows1.put(38.0d, new int[]{2, 2});
- for (int i = 0; i < 3 && res.next(); i++) {
- resultRows1.get(res.getDouble(4))[0] = res.getInt(2);
- resultRows1.get(res.getDouble(4))[1] = res.getInt(3);
+ int i = 0;
+ while (res.next()) {
+ assertEquals(resultRows1.get(res.getDouble(4))[0], res.getInt(2));
+ assertEquals(resultRows1.get(res.getDouble(4))[1], res.getInt(3));
+ i++;
}
res.close();
+ assertEquals(2, i);
Map<Double, int []> resultRows2 = Maps.newHashMap();
resultRows2.put(49.0d, new int[]{3, 3});
@@ -295,12 +309,15 @@ public class TestTablePartitions {
resultRows2.put(38.0d, new int[]{2, 2});
res = tpch.execute("select * from " + tableName + " where (col1 = 2 or col1 = 3) and col2 >= 2");
- for (int i = 0; i < 3 && res.next(); i++) {
- resultRows2.get(res.getDouble(4))[0] = res.getInt(2);
- resultRows2.get(res.getDouble(4))[1] = res.getInt(3);
+ i = 0;
+ while(res.next()) {
+ assertEquals(resultRows2.get(res.getDouble(4))[0], res.getInt(2));
+ assertEquals(resultRows2.get(res.getDouble(4))[1], res.getInt(3));
+ i++;
}
- assertFalse(res.next());
+
res.close();
+ assertEquals(3, i);
}
@Test