tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [1/2] TAJO-601: Improve distinct aggregation query processing.
Date Thu, 20 Feb 2014 06:21:06 GMT
Repository: incubator-tajo
Updated Branches:
  refs/heads/master 57bf90e22 -> 6053ad11e


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql
new file mode 100644
index 0000000..6fe604e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql
@@ -0,0 +1 @@
+select l_orderkey, max(l_orderkey) as maximum, count(distinct l_linenumber) as unique_key
from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
new file mode 100644
index 0000000..6bf8a8a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
@@ -0,0 +1 @@
+select l_orderkey, count(*) as cnt, count(distinct l_linenumber) as unique_key from lineitem
group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
new file mode 100644
index 0000000..0156bef
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
@@ -0,0 +1 @@
+select count(*), count(distinct l_orderkey), sum(distinct l_orderkey) from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
new file mode 100644
index 0000000..0e6e14a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
@@ -0,0 +1 @@
+select l_linenumber, count(*), count(distinct l_orderkey), sum(distinct l_orderkey) from
lineitem group by l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
new file mode 100644
index 0000000..a4d1472
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
@@ -0,0 +1 @@
+select sum(distinct l_orderkey), l_linenumber, count(distinct l_orderkey), count(*) from
lineitem group by l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
new file mode 100644
index 0000000..8fc33ae
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
@@ -0,0 +1 @@
+select l_linenumber, count(*), count(distinct l_orderkey), sum(distinct l_orderkey) from
lineitem group by l_linenumber having sum(distinct l_orderkey) = 6;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
new file mode 100644
index 0000000..af161d6
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
@@ -0,0 +1,21 @@
+select
+  sum(distinct l_orderkey),
+  l_linenumber,
+  count(distinct l_orderkey),
+  count(*) as total
+from
+  (
+    select
+      *
+    from
+      lineitem
+
+    union
+
+    select
+      *
+    from
+      lineitem
+  ) t1
+group by
+  l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
deleted file mode 100644
index f2ad32a..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
+++ /dev/null
@@ -1,5 +0,0 @@
-l_orderkey,maximum,unique_key
--------------------------------
-1,1,2
-2,2,1
-3,3,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
deleted file mode 100644
index 9164120..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
+++ /dev/null
@@ -1,5 +0,0 @@
-l_orderkey,cnt,unique_key
--------------------------------
-1,2,2
-2,1,1
-3,2,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation1.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation1.result
new file mode 100644
index 0000000..f2ad32a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation1.result
@@ -0,0 +1,5 @@
+l_orderkey,maximum,unique_key
+-------------------------------
+1,1,2
+2,2,1
+3,3,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation2.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation2.result
new file mode 100644
index 0000000..9164120
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation2.result
@@ -0,0 +1,5 @@
+l_orderkey,cnt,unique_key
+-------------------------------
+1,2,2
+2,1,1
+3,2,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation3.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation3.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation3.result
new file mode 100644
index 0000000..5600470
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation3.result
@@ -0,0 +1,3 @@
+?count,?count_1,?sum_2
+-------------------------------
+5,3,6
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation4.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation4.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation4.result
new file mode 100644
index 0000000..72b4e8e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation4.result
@@ -0,0 +1,4 @@
+l_linenumber,?count,?count_1,?sum_2
+-------------------------------
+1,3,3,6
+2,2,2,4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation5.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation5.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation5.result
new file mode 100644
index 0000000..229a279
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation5.result
@@ -0,0 +1,4 @@
+?sum,l_linenumber,?count_1,?count_2
+-------------------------------
+6,1,3,3
+4,2,2,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithHaving1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithHaving1.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithHaving1.result
new file mode 100644
index 0000000..5560a23
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithHaving1.result
@@ -0,0 +1,3 @@
+l_linenumber,?count,?count_1,?sum_2
+-------------------------------
+1,3,3,6
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithUnion1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithUnion1.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithUnion1.result
new file mode 100644
index 0000000..16c5524
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregationWithUnion1.result
@@ -0,0 +1,4 @@
+?sum,l_linenumber,?count_1,total
+-------------------------------
+6,1,3,6
+4,2,2,4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/6053ad11/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
index c3a7525..1151a0a 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
@@ -353,7 +353,7 @@ public class RawFile {
       if(!buffer.hasRemaining() && channel.position() == fileSize){
         eof = true;
       }
-      return tuple;
+      return new VTuple(tuple);
     }
 
     @Override


Mime
View raw message