You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ai...@apache.org on 2017/01/04 16:17:47 UTC

[1/2] hive git commit: HIVE-15518: Refactoring rows and range related classes to put the window type on Window (Aihua Xu, reviewed by Yongzhi Chen)

Repository: hive
Updated Branches:
  refs/heads/master 5cf2e71e6 -> ad335c1d4


http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/llap/vectorized_ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_ptf.q.out b/ql/src/test/results/clientpositive/llap/vectorized_ptf.q.out
index 996b893..7efb739 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_ptf.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_ptf.q.out
@@ -292,7 +292,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1068,7 +1068,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2693,7 +2693,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2946,7 +2946,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3264,7 +3264,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3513,7 +3513,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_1
                               arguments: _col7
@@ -3882,13 +3882,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -4379,7 +4379,7 @@ STAGE PLANS:
                               arguments: _col2
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(2)~
+                              window frame: PRECEDING(2)~CURRENT
                   Statistics: Num rows: 13 Data size: 8021 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -4693,7 +4693,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -4756,7 +4756,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(5)~
+                              window frame: PRECEDING(5)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -5297,7 +5297,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -5653,7 +5653,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -5980,7 +5980,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -6349,7 +6349,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -6695,7 +6695,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -7028,7 +7028,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ptf.q.out b/ql/src/test/results/clientpositive/ptf.q.out
index cdac02a..c4c7f59 100644
--- a/ql/src/test/results/clientpositive/ptf.q.out
+++ b/ql/src/test/results/clientpositive/ptf.q.out
@@ -115,7 +115,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -603,7 +603,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1652,7 +1652,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1829,7 +1829,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2076,7 +2076,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2249,7 +2249,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: count
                         window function: GenericUDAFCountEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: sum_window_1
                         arguments: _col7
@@ -2487,13 +2487,13 @@ STAGE PLANS:
                         arguments: _col1
                         name: count
                         window function: GenericUDAFCountEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: sum_window_3
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: lag_window_4
                         arguments: _col5, 1, _col5
@@ -2834,7 +2834,7 @@ STAGE PLANS:
                         arguments: _col2
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(2)~
+                        window frame: PRECEDING(2)~CURRENT
             Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -3070,7 +3070,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3131,7 +3131,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(5)~
+                        window frame: PRECEDING(5)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -3546,7 +3546,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -3836,7 +3836,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4092,7 +4092,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4395,7 +4395,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4670,7 +4670,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -4932,7 +4932,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/ptf_streaming.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ptf_streaming.q.out b/ql/src/test/results/clientpositive/ptf_streaming.q.out
index d1b49db..da5611d 100644
--- a/ql/src/test/results/clientpositive/ptf_streaming.q.out
+++ b/ql/src/test/results/clientpositive/ptf_streaming.q.out
@@ -115,7 +115,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -832,7 +832,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1079,7 +1079,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1328,7 +1328,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1577,7 +1577,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1803,13 +1803,13 @@ STAGE PLANS:
                         arguments: _col1
                         name: count
                         window function: GenericUDAFCountEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: sum_window_3
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: lag_window_4
                         arguments: _col5, 1, _col5
@@ -2092,7 +2092,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2382,7 +2382,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2646,7 +2646,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/spark/ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ptf.q.out b/ql/src/test/results/clientpositive/spark/ptf.q.out
index fd3533c..2903003 100644
--- a/ql/src/test/results/clientpositive/spark/ptf.q.out
+++ b/ql/src/test/results/clientpositive/spark/ptf.q.out
@@ -111,7 +111,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -589,7 +589,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1618,7 +1618,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1791,7 +1791,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2024,7 +2024,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2193,7 +2193,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_1
                               arguments: _col7
@@ -2419,13 +2419,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -2758,7 +2758,7 @@ STAGE PLANS:
                               arguments: _col2
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(2)~
+                              window frame: PRECEDING(2)~CURRENT
                   Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -2959,7 +2959,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2997,7 +2997,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(5)~
+                              window frame: PRECEDING(5)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -3449,7 +3449,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -3715,7 +3715,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -3957,7 +3957,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4236,7 +4236,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4497,7 +4497,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -4745,7 +4745,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/spark/ptf_streaming.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ptf_streaming.q.out b/ql/src/test/results/clientpositive/spark/ptf_streaming.q.out
index 8e47b11..3947ff2 100644
--- a/ql/src/test/results/clientpositive/spark/ptf_streaming.q.out
+++ b/ql/src/test/results/clientpositive/spark/ptf_streaming.q.out
@@ -111,7 +111,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -806,7 +806,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1039,7 +1039,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1274,7 +1274,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1509,7 +1509,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1723,13 +1723,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -1998,7 +1998,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2264,7 +2264,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2514,7 +2514,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/spark/union_remove_6_subq.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/union_remove_6_subq.q.out b/ql/src/test/results/clientpositive/spark/union_remove_6_subq.q.out
index 10de07d..cebea03 100644
--- a/ql/src/test/results/clientpositive/spark/union_remove_6_subq.q.out
+++ b/ql/src/test/results/clientpositive/spark/union_remove_6_subq.q.out
@@ -455,7 +455,7 @@ STAGE PLANS:
                               arguments: _col1
                               name: avg
                               window function: GenericUDAFAverageEvaluatorDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: string), avg_window_0 (type: double)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/spark/vectorized_ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_ptf.q.out b/ql/src/test/results/clientpositive/spark/vectorized_ptf.q.out
index 2ab2541..9ab7a0b 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_ptf.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_ptf.q.out
@@ -288,7 +288,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1050,7 +1050,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2645,7 +2645,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2894,7 +2894,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3207,7 +3207,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3452,7 +3452,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_1
                               arguments: _col7
@@ -3814,13 +3814,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -4304,7 +4304,7 @@ STAGE PLANS:
                               arguments: _col2
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(2)~
+                              window frame: PRECEDING(2)~CURRENT
                   Statistics: Num rows: 13 Data size: 8021 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -4575,7 +4575,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -4637,7 +4637,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(5)~
+                              window frame: PRECEDING(5)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -5225,7 +5225,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -5575,7 +5575,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -5897,7 +5897,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -6260,7 +6260,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -6601,7 +6601,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -6929,7 +6929,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/subquery_in_having.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_in_having.q.out b/ql/src/test/results/clientpositive/subquery_in_having.q.out
index e277c59..1ab7e7f 100644
--- a/ql/src/test/results/clientpositive/subquery_in_having.q.out
+++ b/ql/src/test/results/clientpositive/subquery_in_having.q.out
@@ -1504,7 +1504,7 @@ STAGE PLANS:
                         arguments: _col1
                         name: first_value
                         window function: GenericUDAFFirstValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 15 Data size: 3173 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: first_value_window_0 (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/union_remove_6_subq.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/union_remove_6_subq.q.out b/ql/src/test/results/clientpositive/union_remove_6_subq.q.out
index 6439a0f..7b306ed 100644
--- a/ql/src/test/results/clientpositive/union_remove_6_subq.q.out
+++ b/ql/src/test/results/clientpositive/union_remove_6_subq.q.out
@@ -545,7 +545,7 @@ STAGE PLANS:
                         arguments: _col1
                         name: avg
                         window function: GenericUDAFAverageEvaluatorDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: string), avg_window_0 (type: double)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/vectorized_ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vectorized_ptf.q.out b/ql/src/test/results/clientpositive/vectorized_ptf.q.out
index 7fb966a..dd6c62c 100644
--- a/ql/src/test/results/clientpositive/vectorized_ptf.q.out
+++ b/ql/src/test/results/clientpositive/vectorized_ptf.q.out
@@ -329,7 +329,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1161,7 +1161,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2988,7 +2988,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3278,7 +3278,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3679,7 +3679,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3965,7 +3965,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: count
                         window function: GenericUDAFCountEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: sum_window_1
                         arguments: _col7
@@ -4408,13 +4408,13 @@ STAGE PLANS:
                         arguments: _col1
                         name: count
                         window function: GenericUDAFCountEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: sum_window_3
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: lag_window_4
                         arguments: _col5, 1, _col5
@@ -4979,7 +4979,7 @@ STAGE PLANS:
                         arguments: _col2
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(2)~
+                        window frame: PRECEDING(2)~CURRENT
             Statistics: Num rows: 13 Data size: 8021 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -5337,7 +5337,7 @@ STAGE PLANS:
                         arguments: _col7
                         name: sum
                         window function: GenericUDAFSumDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -5469,7 +5469,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(5)~
+                        window frame: PRECEDING(5)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -6105,7 +6105,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -6590,7 +6590,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -7000,7 +7000,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -7498,7 +7498,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -7927,7 +7927,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -8343,7 +8343,7 @@ STAGE PLANS:
                         arguments: _col5
                         name: sum
                         window function: GenericUDAFSumLong
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 26 Data size: 16042 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/windowing_gby2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/windowing_gby2.q.out b/ql/src/test/results/clientpositive/windowing_gby2.q.out
index 4bd6994..adb3296 100644
--- a/ql/src/test/results/clientpositive/windowing_gby2.q.out
+++ b/ql/src/test/results/clientpositive/windowing_gby2.q.out
@@ -211,7 +211,7 @@ STAGE PLANS:
                         arguments: _col0
                         name: avg
                         window function: GenericUDAFAverageEvaluatorDouble
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: avg_window_0 (type: double)


[2/2] hive git commit: HIVE-15518: Refactoring rows and range related classes to put the window type on Window (Aihua Xu, reviewed by Yongzhi Chen)

Posted by ai...@apache.org.
HIVE-15518: Refactoring rows and range related classes to put the window type on Window (Aihua Xu, reviewed by Yongzhi Chen)


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

Branch: refs/heads/master
Commit: ad335c1d44bf20e3926ddf3d7657f575c2379da7
Parents: 5cf2e71
Author: Aihua Xu <ai...@apache.org>
Authored: Tue Dec 27 16:46:22 2016 -0500
Committer: Aihua Xu <ai...@apache.org>
Committed: Wed Jan 4 11:15:19 2017 -0500

----------------------------------------------------------------------
 .../calcite/translator/ExprNodeConverter.java   |  33 +--
 .../hadoop/hive/ql/parse/CalcitePlanner.java    |   9 +-
 .../hadoop/hive/ql/parse/PTFTranslator.java     |  66 +++--
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java  |  13 +-
 .../hadoop/hive/ql/parse/WindowingSpec.java     | 253 +++++--------------
 .../hadoop/hive/ql/plan/PTFDeserializer.java    |  12 +-
 .../hadoop/hive/ql/plan/ptf/BoundaryDef.java    |  56 +++-
 .../hadoop/hive/ql/plan/ptf/CurrentRowDef.java  |  48 ----
 .../hive/ql/plan/ptf/RangeBoundaryDef.java      |  72 ------
 .../hive/ql/plan/ptf/ValueBoundaryDef.java      |  82 ------
 .../hadoop/hive/ql/plan/ptf/WindowFrameDef.java |  22 +-
 .../hadoop/hive/ql/ppd/OpProcFactory.java       |   4 +-
 .../hive/ql/udf/ptf/WindowingTableFunction.java | 142 +++++------
 .../hadoop/hive/ql/udaf/TestStreamingSum.java   |  13 +-
 .../clientpositive/distinct_windowing.q.out     |   8 +-
 .../distinct_windowing_no_cbo.q.out             |   8 +-
 .../test/results/clientpositive/llap/ptf.q.out  |  34 +--
 .../clientpositive/llap/ptf_streaming.q.out     |  20 +-
 .../clientpositive/llap/vectorized_ptf.q.out    |  34 +--
 ql/src/test/results/clientpositive/ptf.q.out    |  34 +--
 .../results/clientpositive/ptf_streaming.q.out  |  20 +-
 .../test/results/clientpositive/spark/ptf.q.out |  34 +--
 .../clientpositive/spark/ptf_streaming.q.out    |  20 +-
 .../spark/union_remove_6_subq.q.out             |   2 +-
 .../clientpositive/spark/vectorized_ptf.q.out   |  34 +--
 .../clientpositive/subquery_in_having.q.out     |   2 +-
 .../clientpositive/union_remove_6_subq.q.out    |   2 +-
 .../results/clientpositive/vectorized_ptf.q.out |  34 +--
 .../results/clientpositive/windowing_gby2.q.out |   2 +-
 29 files changed, 401 insertions(+), 712 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java
index 2d621e9..e840938 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java
@@ -59,13 +59,11 @@ import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionSpec;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitioningSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.CurrentRowSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.RangeBoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.ValueBoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFrameSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFunctionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowSpec;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
@@ -426,38 +424,26 @@ public class ExprNodeConverter extends RexVisitorImpl<ExprNodeDesc> {
 
   private WindowFrameSpec getWindowRange(RexWindow window) {
     // NOTE: in Hive AST Rows->Range(Physical) & Range -> Values (logical)
-
-    WindowFrameSpec windowFrame = new WindowFrameSpec();
-
     BoundarySpec start = null;
     RexWindowBound ub = window.getUpperBound();
     if (ub != null) {
-      start = getWindowBound(ub, window.isRows());
+      start = getWindowBound(ub);
     }
 
     BoundarySpec end = null;
     RexWindowBound lb = window.getLowerBound();
     if (lb != null) {
-      end = getWindowBound(lb, window.isRows());
+      end = getWindowBound(lb);
     }
 
-    if (start != null || end != null) {
-      if (start != null) {
-        windowFrame.setStart(start);
-      }
-      if (end != null) {
-        windowFrame.setEnd(end);
-      }
-    }
-
-    return windowFrame;
+    return new WindowFrameSpec(window.isRows() ? WindowType.ROWS : WindowType.RANGE, start, end);
   }
 
-  private BoundarySpec getWindowBound(RexWindowBound wb, boolean isRows) {
+  private BoundarySpec getWindowBound(RexWindowBound wb) {
     BoundarySpec boundarySpec;
 
     if (wb.isCurrentRow()) {
-      boundarySpec = new CurrentRowSpec();
+      boundarySpec = new BoundarySpec(Direction.CURRENT);
     } else {
       final Direction direction;
       final int amt;
@@ -471,11 +457,8 @@ public class ExprNodeConverter extends RexVisitorImpl<ExprNodeDesc> {
       } else {
         amt = RexLiteral.intValue(wb.getOffset());
       }
-      if (isRows) {
-        boundarySpec = new RangeBoundarySpec(direction, amt);
-      } else {
-        boundarySpec = new ValueBoundarySpec(direction, amt);
-      }
+
+      boundarySpec = new BoundarySpec(direction, amt);
     }
 
     return boundarySpec;

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index bf79e95..fdb468d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -214,10 +214,10 @@ import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionSpec;
 import org.apache.hadoop.hive.ql.parse.QBExpr.Opcode;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.RangeBoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowExpressionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFunctionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowSpec;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
@@ -3012,10 +3012,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
         WindowSpec wndSpec = ((WindowFunctionSpec) wExpSpec).getWindowSpec();
         List<RexNode> partitionKeys = getPartitionKeys(wndSpec.getPartition(), converter, inputRR);
         List<RexFieldCollation> orderKeys = getOrderKeys(wndSpec.getOrder(), converter, inputRR);
-        RexWindowBound upperBound = getBound(wndSpec.getWindowFrame().start, converter);
-        RexWindowBound lowerBound = getBound(wndSpec.getWindowFrame().end, converter);
-        boolean isRows = ((wndSpec.getWindowFrame().start instanceof RangeBoundarySpec) || (wndSpec.getWindowFrame().end instanceof RangeBoundarySpec)) ? true
-            : false;
+        RexWindowBound upperBound = getBound(wndSpec.getWindowFrame().getStart(), converter);
+        RexWindowBound lowerBound = getBound(wndSpec.getWindowFrame().getEnd(), converter);
+        boolean isRows = wndSpec.getWindowFrame().getWindowType() == WindowType.ROWS;
 
         w = cluster.getRexBuilder().makeOver(calciteAggFnRetType, calciteAggFn, calciteAggFnArgs,
             partitionKeys, ImmutableList.<RexFieldCollation> copyOf(orderKeys), lowerBound,

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java
index 519f10d..ccfc4cd 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java
@@ -50,19 +50,16 @@ import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionSpec;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionedTableFunctionSpec;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitioningSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.CurrentRowSpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.RangeBoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.ValueBoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowExpressionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFrameSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFunctionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowSpec;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc;
 import org.apache.hadoop.hive.ql.plan.PTFDesc;
 import org.apache.hadoop.hive.ql.plan.PTFDeserializer;
 import org.apache.hadoop.hive.ql.plan.ptf.BoundaryDef;
-import org.apache.hadoop.hive.ql.plan.ptf.CurrentRowDef;
 import org.apache.hadoop.hive.ql.plan.ptf.OrderDef;
 import org.apache.hadoop.hive.ql.plan.ptf.OrderExpressionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PTFExpressionDef;
@@ -70,9 +67,7 @@ import org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PartitionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef;
-import org.apache.hadoop.hive.ql.plan.ptf.RangeBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.ShapeDetails;
-import org.apache.hadoop.hive.ql.plan.ptf.ValueBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFunctionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef;
@@ -521,11 +516,12 @@ public class PTFTranslator {
      * Since we componentize Windowing, no need to translate
      * the Partition & Order specs of individual WFns.
      */
-    return translate(inpShape, spec.getWindowFrame());
+    return translate(inpShape, spec.getWindowFrame(), spec.getOrder().getExpressions());
   }
 
   private WindowFrameDef translate(ShapeDetails inpShape,
-      WindowFrameSpec spec)
+      WindowFrameSpec spec,
+      List<OrderExpression> orderExpressions)
       throws SemanticException {
     if (spec == null) {
       return null;
@@ -539,38 +535,38 @@ public class PTFTranslator {
           "Window range invalid, start boundary is greater than end boundary: %s", spec));
     }
 
-    return new WindowFrameDef(translate(inpShape, s), translate(inpShape, e));
+    WindowFrameDef winFrame = new WindowFrameDef(
+        spec.getWindowType(),
+        new BoundaryDef(s.direction, s.getAmt()),
+        new BoundaryDef(e.direction, e.getAmt()));
+    if (winFrame.getWindowType() == WindowType.RANGE) {
+      winFrame.setOrderDef(buildOrderExpressions(inpShape, orderExpressions));
+    }
+    return winFrame;
   }
 
-  private BoundaryDef translate(ShapeDetails inpShape, BoundarySpec bndSpec)
+  /**
+   * Collect order expressions for RANGE based windowing
+   * @throws SemanticException
+   */
+  private OrderDef buildOrderExpressions(ShapeDetails inpShape, List<OrderExpression> orderExpressions)
       throws SemanticException {
-    if (bndSpec instanceof ValueBoundarySpec) {
-      ValueBoundarySpec vBndSpec = (ValueBoundarySpec) bndSpec;
-      ValueBoundaryDef vbDef = new ValueBoundaryDef(vBndSpec.getDirection(), vBndSpec.getAmt());
-      for (OrderExpression oe : vBndSpec.getOrderExpressions()) {
-        PTFTranslator.validateNoLeadLagInValueBoundarySpec(oe.getExpression());
-        PTFExpressionDef exprDef = null;
-        try {
-          exprDef = buildExpressionDef(inpShape, oe.getExpression());
-        } catch (HiveException he) {
-          throw new SemanticException(he);
-        }
-        PTFTranslator.validateValueBoundaryExprType(exprDef.getOI());
-        OrderExpressionDef orderExprDef = new OrderExpressionDef(exprDef);
-        orderExprDef.setOrder(oe.getOrder());
-        orderExprDef.setNullOrder(oe.getNullOrder());
-        vbDef.addOrderExpressionDef(orderExprDef);
+    OrderDef orderDef = new OrderDef();
+    for (OrderExpression oe : orderExpressions) {
+      PTFTranslator.validateNoLeadLagInValueBoundarySpec(oe.getExpression());
+      PTFExpressionDef exprDef = null;
+      try {
+        exprDef = buildExpressionDef(inpShape, oe.getExpression());
+      } catch (HiveException he) {
+        throw new SemanticException(he);
       }
-      return vbDef;
-    }
-    else if (bndSpec instanceof RangeBoundarySpec) {
-      RangeBoundarySpec rBndSpec = (RangeBoundarySpec) bndSpec;
-      return new RangeBoundaryDef(rBndSpec.getDirection(), rBndSpec.getAmt());
-    } else if (bndSpec instanceof CurrentRowSpec) {
-      CurrentRowDef cbDef = new CurrentRowDef();
-      return cbDef;
+      PTFTranslator.validateValueBoundaryExprType(exprDef.getOI());
+      OrderExpressionDef orderExprDef = new OrderExpressionDef(exprDef);
+      orderExprDef.setOrder(oe.getOrder());
+      orderExprDef.setNullOrder(oe.getNullOrder());
+      orderDef.addExpression(orderExprDef);
     }
-    throw new SemanticException("Unknown Boundary: " + bndSpec);
+    return orderDef;
   }
 
   static void setupWdwFnEvaluator(WindowFunctionDef def) throws HiveException {

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 863b153..d0131b7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -150,14 +150,12 @@ import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitioningSpec;
 import org.apache.hadoop.hive.ql.parse.QBSubQuery.SubQueryType;
 import org.apache.hadoop.hive.ql.parse.SubQueryUtils.ISubQueryJoinInfo;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.CurrentRowSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.RangeBoundarySpec;
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.ValueBoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowExpressionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFrameSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowFunctionSpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowSpec;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.AggregationDesc;
 import org.apache.hadoop.hive.ql.plan.AlterTableDesc;
 import org.apache.hadoop.hive.ql.plan.AlterTableDesc.AlterTableTypes;
@@ -12748,13 +12746,12 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
     if ( node.getChildCount() > 1 ) {
       end = processBoundary(type, (ASTNode) node.getChild(1));
     }
-
-    return new WindowFrameSpec(start, end);
+    // Note: TOK_WINDOWVALUES means RANGE type, TOK_WINDOWRANGE means ROWS type
+    return new WindowFrameSpec(type == HiveParser.TOK_WINDOWVALUES ? WindowType.RANGE : WindowType.ROWS, start, end);
   }
 
   private BoundarySpec processBoundary(int frameType, ASTNode node)  throws SemanticException {
-    BoundarySpec bs = frameType == HiveParser.TOK_WINDOWRANGE ?
-        new RangeBoundarySpec() : new ValueBoundarySpec();
+    BoundarySpec bs = new BoundarySpec();
     int type = node.getType();
     boolean hasAmt = true;
 
@@ -12767,7 +12764,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
       bs.setDirection(Direction.FOLLOWING);
       break;
     case HiveParser.KW_CURRENT:
-      bs = new CurrentRowSpec();
+      bs.setDirection(Direction.CURRENT);
       hasAmt = false;
       break;
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/parse/WindowingSpec.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/WindowingSpec.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/WindowingSpec.java
index ef5186a..01b5559 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/WindowingSpec.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/WindowingSpec.java
@@ -20,12 +20,9 @@ package org.apache.hadoop.hive.ql.parse;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
-
 import org.antlr.runtime.CommonToken;
 import org.apache.hadoop.hive.ql.exec.FunctionRegistry;
 import org.apache.hadoop.hive.ql.exec.WindowFunctionInfo;
-import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.OrderExpression;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.OrderSpec;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression;
 import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionSpec;
@@ -140,13 +137,13 @@ public class WindowingSpec {
 
       // 3. For missing Wdw Frames or for Frames with only a Start Boundary, completely
       //    specify them by the rules in {@link effectiveWindowFrame}
-      effectiveWindowFrame(wFn, wdwSpec);
+      effectiveWindowFrame(wFn);
 
       // 4. Validate the effective Window Frames with the rules in {@link validateWindowFrame}
       validateWindowFrame(wdwSpec);
 
       // 5. Add the Partition expressions as the Order if there is no Order and validate Order spec.
-      setAndValidateOrderSpec(wFn, wdwSpec);
+      setAndValidateOrderSpec(wFn);
     }
   }
 
@@ -199,24 +196,22 @@ public class WindowingSpec {
   }
 
   /*
-   * - A Window Frame that has only the /start/boundary, then it is interpreted as:
-         BETWEEN <start boundary> AND CURRENT ROW
-   * - A Window Specification with an Order Specification and no Window
-   *   Frame is interpreted as:
-         ROW BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+   * - A Window Frame that has only the start boundary, then it is interpreted as:
+   *     BETWEEN <start boundary> AND CURRENT ROW
+   * - A Window Specification with an Order Specification and no Window Frame is
+   *   interpreted as: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
    * - A Window Specification with no Order and no Window Frame is interpreted as:
-         ROW BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
+   *     ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
    */
-  private void effectiveWindowFrame(WindowFunctionSpec wFn, WindowSpec wdwSpec)
+  private void effectiveWindowFrame(WindowFunctionSpec wFn)
       throws SemanticException {
-
+    WindowSpec wdwSpec = wFn.getWindowSpec();
     WindowFunctionInfo wFnInfo = FunctionRegistry.getWindowFunctionInfo(wFn.getName());
     boolean supportsWindowing = wFnInfo == null ? true : wFnInfo.isSupportsWindow();
     WindowFrameSpec wFrame = wdwSpec.getWindowFrame();
     OrderSpec orderSpec = wdwSpec.getOrder();
     if ( wFrame == null ) {
       if (!supportsWindowing ) {
-
         if ( wFn.getName().toLowerCase().equals(FunctionRegistry.LAST_VALUE_FUNC_NAME)
             && orderSpec != null ) {
           /*
@@ -224,33 +219,37 @@ public class WindowingSpec {
            * last value among rows with the same Sort Key value.
            */
           wFrame = new WindowFrameSpec(
-              new CurrentRowSpec(),
-              new RangeBoundarySpec(Direction.FOLLOWING, 0)
+              WindowType.ROWS,
+              new BoundarySpec(Direction.CURRENT),
+              new BoundarySpec(Direction.FOLLOWING, 0)
+              );
+        } else {
+          wFrame = new WindowFrameSpec(
+              WindowType.ROWS,
+              new BoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
+              new BoundarySpec(Direction.FOLLOWING, BoundarySpec.UNBOUNDED_AMOUNT)
               );
         }
-        else {
+      } else {
+        if ( orderSpec == null ) {
           wFrame = new WindowFrameSpec(
-              new RangeBoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
-              new RangeBoundarySpec(Direction.FOLLOWING, BoundarySpec.UNBOUNDED_AMOUNT)
+              WindowType.ROWS,
+              new BoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
+              new BoundarySpec(Direction.FOLLOWING, BoundarySpec.UNBOUNDED_AMOUNT)
               );
+        } else {
+          wFrame = new WindowFrameSpec(
+              WindowType.RANGE,
+              new BoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
+              new BoundarySpec(Direction.CURRENT)
+          );
         }
       }
-      else if ( orderSpec == null ) {
-        wFrame = new WindowFrameSpec(
-            new RangeBoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
-            new RangeBoundarySpec(Direction.FOLLOWING, BoundarySpec.UNBOUNDED_AMOUNT)
-            );
-      }
-      else {
-        wFrame = new WindowFrameSpec(
-            new ValueBoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
-            new CurrentRowSpec()
-            );
-      }
+
       wdwSpec.setWindowFrame(wFrame);
     }
     else if ( wFrame.getEnd() == null ) {
-      wFrame.setEnd(new CurrentRowSpec());
+      wFrame.setEnd(new BoundarySpec(Direction.CURRENT));
     }
   }
 
@@ -273,23 +272,25 @@ public class WindowingSpec {
   /**
    * Add default order spec if there is no order and validate order spec for valued based
    * windowing since only one sort key is allowed.
-   * @param wdwSpec
+   * @param wFn Window function spec
    * @throws SemanticException
    */
-  private void setAndValidateOrderSpec(WindowFunctionSpec wFn, WindowSpec wdwSpec) throws SemanticException {
+  private void setAndValidateOrderSpec(WindowFunctionSpec wFn) throws SemanticException {
+    WindowSpec wdwSpec = wFn.getWindowSpec();
     wdwSpec.ensureOrderSpec(wFn);
-
     WindowFrameSpec wFrame = wdwSpec.getWindowFrame();
     OrderSpec order = wdwSpec.getOrder();
 
     BoundarySpec start = wFrame.getStart();
     BoundarySpec end = wFrame.getEnd();
 
-    if (start instanceof ValueBoundarySpec || end instanceof ValueBoundarySpec) {
+    if (wFrame.getWindowType() == WindowType.RANGE) {
       if (order == null || order.getExpressions().size() == 0) {
         throw new SemanticException("Range based Window Frame needs to specify ORDER BY clause");
       }
 
+      boolean currentRange = start.getDirection() == Direction.CURRENT &&
+              end.getDirection() == Direction.CURRENT;
       boolean defaultPreceding = start.getDirection() == Direction.PRECEDING &&
               start.getAmt() == BoundarySpec.UNBOUNDED_AMOUNT &&
               end.getDirection() == Direction.CURRENT;
@@ -300,17 +301,10 @@ public class WindowingSpec {
               start.getAmt() == BoundarySpec.UNBOUNDED_AMOUNT &&
               end.getDirection() == Direction.FOLLOWING &&
               end.getAmt() == BoundarySpec.UNBOUNDED_AMOUNT;
-      boolean multiOrderAllowed = defaultPreceding || defaultFollowing || defaultPrecedingFollowing;
+      boolean multiOrderAllowed = currentRange || defaultPreceding || defaultFollowing || defaultPrecedingFollowing;
       if ( order.getExpressions().size() != 1 && !multiOrderAllowed) {
         throw new SemanticException("Range value based Window Frame can have only 1 Sort Key");
       }
-
-      if (start instanceof ValueBoundarySpec) {
-        ((ValueBoundarySpec)start).setOrderExpressions(order.getExpressions());
-      }
-      if (end instanceof ValueBoundarySpec) {
-        ((ValueBoundarySpec)end).setOrderExpressions(order.getExpressions());
-      }
     }
   }
 
@@ -518,22 +512,20 @@ public class WindowingSpec {
    */
   public static class WindowFrameSpec
   {
-    BoundarySpec start;
-    BoundarySpec end;
+    private WindowType windowType;
+    private BoundarySpec start;
+    private BoundarySpec end;
 
-    public WindowFrameSpec() {
-    }
-
-    public WindowFrameSpec(BoundarySpec start, BoundarySpec end)
+    public WindowFrameSpec(WindowType windowType, BoundarySpec start, BoundarySpec end)
     {
-      super();
+      this.windowType = windowType;
       this.start = start;
       this.end = end;
     }
 
-    public WindowFrameSpec(BoundarySpec start)
+    public WindowFrameSpec(WindowType windowType, BoundarySpec start)
     {
-      this(start, null);
+      this(windowType, start, null);
     }
 
     public BoundarySpec getStart()
@@ -556,10 +548,15 @@ public class WindowingSpec {
       this.end = end;
     }
 
+    public WindowType getWindowType() {
+      return this.windowType;
+    }
+
     @Override
     public String toString()
     {
-      return String.format("window(start=%s, end=%s)", start, end);
+      return String.format("window(type=%s, start=%s, end=%s)",
+          this.windowType, start, end);
     }
 
   }
@@ -571,6 +568,13 @@ public class WindowingSpec {
     FOLLOWING
   };
 
+  // The types for ROWS BETWEEN or RANGE BETWEEN windowing spec
+  public static enum WindowType
+  {
+    ROWS,
+    RANGE
+  };
+
   /*
    * A Boundary specifies how many rows back/forward a WindowFrame extends from the
    * current row. A Boundary is specified as:
@@ -580,152 +584,41 @@ public class WindowingSpec {
    * - Value Boundary :: which is specified as the amount the value of an
                     Expression must decrease/increase
    */
-  public abstract static class BoundarySpec implements Comparable<BoundarySpec>
+  public static class BoundarySpec implements Comparable<BoundarySpec>
   {
     public static int UNBOUNDED_AMOUNT = Integer.MAX_VALUE;
 
-    public abstract Direction getDirection();
-    public abstract void setDirection(Direction dir);
-    public abstract void setAmt(int amt);
-    public abstract int getAmt();
-  }
-
-  public static class RangeBoundarySpec extends BoundarySpec
-  {
-
     Direction direction;
     int amt;
 
-    public RangeBoundarySpec() {
-    }
-
-    public RangeBoundarySpec(Direction direction, int amt)
-    {
-      super();
-      this.direction = direction;
-      this.amt = amt;
+    public BoundarySpec() {
     }
 
-    @Override
-    public Direction getDirection()
-    {
-      return direction;
+    public BoundarySpec(Direction direction) {
+      this(direction, 0);
     }
 
-    @Override
-    public void setDirection(Direction direction)
+    public BoundarySpec(Direction direction, int amt)
     {
       this.direction = direction;
-    }
-
-    @Override
-    public int getAmt()
-    {
-      return amt;
-    }
-
-    @Override
-    public void setAmt(int amt)
-    {
       this.amt = amt;
     }
 
-    @Override
-    public String toString()
-    {
-      return String.format("range(%s %s)", (amt == UNBOUNDED_AMOUNT ? "Unbounded" : amt),
-          direction);
-    }
-
-    public int compareTo(BoundarySpec other)
-    {
-      int c = direction.compareTo(other.getDirection());
-      if (c != 0) {
-        return c;
-      }
-
-      RangeBoundarySpec rb = (RangeBoundarySpec) other;
-      // Valid range is "range/rows between 10 preceding and 2 preceding" for preceding case
-      return this.direction == Direction.PRECEDING ? rb.amt - amt : amt - rb.amt;
-    }
-
-  }
-
-  public static class CurrentRowSpec extends BoundarySpec
-  {
-    public CurrentRowSpec() {
-    }
-
-    @Override
-    public String toString()
-    {
-      return "currentRow";
-    }
-
-    @Override
-    public Direction getDirection() {
-      return Direction.CURRENT;
-    }
-
-    @Override
-    public void setDirection(Direction dir) {}
-    @Override
-    public void setAmt(int amt) {}
-
-    public int compareTo(BoundarySpec other)
-    {
-      return getDirection().compareTo(other.getDirection());
-    }
-
-    @Override
-    public int getAmt() {return 0;}
-  }
-
-  public static class ValueBoundarySpec extends BoundarySpec
-  {
-    Direction direction;
-    int amt;
-    List<OrderExpression> orderExpressions;
-
-    public ValueBoundarySpec() {
-    }
-
-    public ValueBoundarySpec(Direction direction, int amt)
-    {
-      super();
-      this.direction = direction;
-      this.amt = amt;
-    }
-
-    @Override
     public Direction getDirection()
     {
       return direction;
     }
 
-    @Override
     public void setDirection(Direction direction)
     {
       this.direction = direction;
     }
 
-    public List<OrderExpression> getOrderExpressions()
-    {
-      return orderExpressions;
-    }
-
-    public void setOrderExpressions(List<OrderExpression> orderExpressions)
-    {
-      this.orderExpressions = orderExpressions;
-    }
-
-    @Override
     public int getAmt()
     {
       return amt;
     }
 
-    @Override
     public void setAmt(int amt)
     {
       this.amt = amt;
@@ -734,16 +627,12 @@ public class WindowingSpec {
     @Override
     public String toString()
     {
-      StringBuilder exprs = new StringBuilder();
-      if (orderExpressions != null) {
-        for (int i=0; i<orderExpressions.size(); i++) {
-          exprs.append(i == 0 ? orderExpressions.get(i).getExpression().toStringTree()
-                  : ", " + orderExpressions.get(i).getExpression().toStringTree());
-        }
-      } else {
-        exprs.append("No order expression");
+      if (this.direction == Direction.CURRENT) {
+        return "currentRow";
       }
-      return String.format("value(%s %s %s)", exprs.toString(), amt, direction);
+
+      return String.format("%s %s", (amt == UNBOUNDED_AMOUNT ? "Unbounded" : amt),
+          direction);
     }
 
     public int compareTo(BoundarySpec other)
@@ -752,11 +641,9 @@ public class WindowingSpec {
       if (c != 0) {
         return c;
       }
-      ValueBoundarySpec vb = (ValueBoundarySpec) other;
+
       // Valid range is "range/rows between 10 preceding and 2 preceding" for preceding case
-      return this.direction == Direction.PRECEDING ? vb.amt - amt : amt - vb.amt;
+      return this.direction == Direction.PRECEDING ? other.amt - amt : amt - other.amt;
     }
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/PTFDeserializer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/PTFDeserializer.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/PTFDeserializer.java
index a793fea..fd262e4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/PTFDeserializer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/PTFDeserializer.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hive.ql.exec.PTFPartition;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.LeadLagInfo;
 import org.apache.hadoop.hive.ql.parse.WindowingExprNodeEvaluatorFactory;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ptf.BoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.OrderExpressionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PTFExpressionDef;
@@ -40,7 +41,6 @@ import org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.ShapeDetails;
-import org.apache.hadoop.hive.ql.plan.ptf.ValueBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFunctionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef;
@@ -125,8 +125,7 @@ public class PTFDeserializer {
       }
       if (wFnDef.getWindowFrame() != null) {
         WindowFrameDef wFrmDef = wFnDef.getWindowFrame();
-        initialize(wFrmDef.getStart(), inpShape);
-        initialize(wFrmDef.getEnd(), inpShape);
+        initialize(wFrmDef, inpShape);
       }
       setupWdwFnEvaluator(wFnDef);
     }
@@ -212,10 +211,9 @@ public class PTFDeserializer {
     def.setOI(OI);
   }
 
-  protected void initialize(BoundaryDef def, ShapeDetails inpShape) throws HiveException {
-    if (def instanceof ValueBoundaryDef) {
-      ValueBoundaryDef vDef = (ValueBoundaryDef) def;
-      for (OrderExpressionDef exprDef : vDef.getOrderDef().getExpressions()) {
+  protected void initialize(WindowFrameDef winFrame, ShapeDetails inpShape) throws HiveException {
+    if (winFrame.getWindowType() == WindowType.RANGE) {
+      for (OrderExpressionDef exprDef : winFrame.getOrderDef().getExpressions()) {
         initialize(exprDef, inpShape);
       }
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/BoundaryDef.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/BoundaryDef.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/BoundaryDef.java
index c6518dc..0dfd26d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/BoundaryDef.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/BoundaryDef.java
@@ -21,8 +21,27 @@ package org.apache.hadoop.hive.ql.plan.ptf;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
 
-public abstract class BoundaryDef {
+public class BoundaryDef {
   Direction direction;
+  private int amt;
+  private final int relativeOffset;
+
+  public BoundaryDef(Direction direction, int amt) {
+    this.direction = direction;
+    this.amt = amt;
+
+    // Calculate relative offset
+    switch(this.direction) {
+    case PRECEDING:
+      relativeOffset = -amt;
+      break;
+    case FOLLOWING:
+      relativeOffset = amt;
+      break;
+    default:
+      relativeOffset = 0;
+    }
+  }
 
   public Direction getDirection() {
     return direction;
@@ -33,7 +52,7 @@ public abstract class BoundaryDef {
    * @return if the bound is PRECEDING
    */
   public boolean isPreceding() {
-    return false;
+    return this.direction == Direction.PRECEDING;
   }
 
   /**
@@ -41,7 +60,7 @@ public abstract class BoundaryDef {
    * @return if the bound is FOLLOWING
    */
   public boolean isFollowing() {
-    return false;
+    return this.direction == Direction.FOLLOWING;
   }
 
   /**
@@ -49,7 +68,7 @@ public abstract class BoundaryDef {
    * @return if the bound is CURRENT ROW
    */
   public boolean isCurrentRow() {
-    return false;
+    return this.direction == Direction.CURRENT;
   }
 
   /**
@@ -57,21 +76,40 @@ public abstract class BoundaryDef {
    *
    * @return offset from XX PRECEDING/FOLLOWING
    */
-  public abstract int getAmt();
+  public int getAmt() {
+    return amt;
+  }
+
   /**
-   * Returns signed offset from XX PRECEDING/FOLLOWING. Nagative for preceding.
+   * Returns signed offset from XX PRECEDING/FOLLOWING. Negative for preceding.
    *
    * @return signed offset from XX PRECEDING/FOLLOWING
    */
-  public abstract int getRelativeOffset();
+  public int getRelativeOffset() {
+    return relativeOffset;
+  }
+
 
   public boolean isUnbounded() {
     return this.getAmt() == BoundarySpec.UNBOUNDED_AMOUNT;
   }
 
+  public int compareTo(BoundaryDef other) {
+    int c = getDirection().compareTo(other.getDirection());
+    if (c != 0) {
+      return c;
+    }
+
+    return this.direction == Direction.PRECEDING ? other.amt - this.amt : this.amt - other.amt;
+  }
+
   @Override
   public String toString() {
-    return direction == null ? "" :
-        direction + "(" + (getAmt() == Integer.MAX_VALUE ? "MAX" : getAmt()) + ")";
+    if (direction == null) return "";
+    if (direction == Direction.CURRENT) {
+      return Direction.CURRENT.toString();
+    }
+
+    return direction + "(" + (getAmt() == Integer.MAX_VALUE ? "MAX" : getAmt()) + ")";
   }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/CurrentRowDef.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/CurrentRowDef.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/CurrentRowDef.java
deleted file mode 100644
index f5e2848..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/CurrentRowDef.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hive.ql.plan.ptf;
-
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
-
-public class CurrentRowDef extends BoundaryDef {
-
-  public int compareTo(BoundaryDef other) {
-    return getDirection().compareTo(other.getDirection());
-  }
-
-  @Override
-  public Direction getDirection() {
-    return Direction.CURRENT;
-  }
-
-  @Override
-  public int getAmt() {
-    return 0;
-  }
-
-  @Override
-  public boolean isCurrentRow() {
-    return true;
-  }
-
-  @Override
-  public int getRelativeOffset() {
-    return 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/RangeBoundaryDef.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/RangeBoundaryDef.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/RangeBoundaryDef.java
deleted file mode 100644
index f93399d..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/RangeBoundaryDef.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hive.ql.plan.ptf;
-
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
-
-public class RangeBoundaryDef extends BoundaryDef {
-  private int amt;
-  private final int relativeOffset;
-
-  public RangeBoundaryDef(Direction direction, int amt) {
-    this.direction = direction;
-    this.amt = amt;
-
-    // Calculate relative offset
-    switch(this.direction) {
-    case PRECEDING:
-      relativeOffset = -amt;
-      break;
-    case FOLLOWING:
-      relativeOffset = amt;
-      break;
-    default:
-      relativeOffset = 0;
-    }
-  }
-
-  public int compareTo(BoundaryDef other) {
-    int c = getDirection().compareTo(other.getDirection());
-    if (c != 0) {
-      return c;
-    }
-    RangeBoundaryDef rb = (RangeBoundaryDef) other;
-    return this.direction == Direction.PRECEDING ? rb.amt - this.amt : this.amt - rb.amt;
-  }
-
-  @Override
-  public int getAmt() {
-    return amt;
-  }
-
-  @Override
-  public boolean isPreceding() {
-    return this.direction == Direction.PRECEDING;
-  }
-
-  @Override
-  public boolean isFollowing() {
-    return this.direction == Direction.FOLLOWING;
-  }
-
-  @Override
-  public int getRelativeOffset() {
-    return relativeOffset;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/ValueBoundaryDef.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/ValueBoundaryDef.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/ValueBoundaryDef.java
deleted file mode 100644
index e1a8a90..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/ValueBoundaryDef.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hive.ql.plan.ptf;
-
-import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
-
-public class ValueBoundaryDef extends BoundaryDef {
-  private OrderDef orderDef;
-  private final int amt;
-  private final int relativeOffset;
-
-  public ValueBoundaryDef(Direction direction, int amt) {
-    this.direction = direction;
-    this.amt = amt;
-    this.orderDef = new OrderDef();
-
-    // Calculate relative offset
-    switch(this.direction) {
-    case PRECEDING:
-      relativeOffset = -amt;
-      break;
-    case FOLLOWING:
-      relativeOffset = amt;
-      break;
-    default:
-      relativeOffset = 0;
-    }
-  }
-
-  public int compareTo(BoundaryDef other) {
-    int c = getDirection().compareTo(other.getDirection());
-    if (c != 0) {
-      return c;
-    }
-    ValueBoundaryDef vb = (ValueBoundaryDef) other;
-    return this.direction == Direction.PRECEDING ? vb.amt - this.amt : this.amt - vb.amt;
-  }
-
-  public OrderDef getOrderDef() {
-    return orderDef;
-  }
-
-  public void addOrderExpressionDef(OrderExpressionDef expressionDef) {
-    this.orderDef.addExpression(expressionDef);
-  }
-
-  @Override
-  public int getAmt() {
-    return amt;
-  }
-
-  @Override
-  public int getRelativeOffset() {
-    return relativeOffset;
-  }
-
-  @Override
-  public boolean isPreceding() {
-    return this.direction == Direction.PRECEDING;
-  }
-
-  @Override
-  public boolean isFollowing() {
-    return this.direction == Direction.FOLLOWING;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/WindowFrameDef.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/WindowFrameDef.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/WindowFrameDef.java
index 5a85f69..0af878b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/WindowFrameDef.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/WindowFrameDef.java
@@ -18,13 +18,18 @@
 
 package org.apache.hadoop.hive.ql.plan.ptf;
 
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 
 public class WindowFrameDef {
+  private WindowType windowType;
   private BoundaryDef start;
   private BoundaryDef end;
   private final int windowSize;
+  private OrderDef orderDef;    // Order expressions which will only get set and used for RANGE windowing type
 
-  public WindowFrameDef(BoundaryDef start, BoundaryDef end) {
+  public WindowFrameDef(WindowType windowType, BoundaryDef start, BoundaryDef end) {
+    this.windowType = windowType;
     this.start = start;
     this.end = end;
 
@@ -44,6 +49,21 @@ public class WindowFrameDef {
     return end;
   }
 
+  public WindowType getWindowType() {
+    return windowType;
+  }
+
+  public void setOrderDef(OrderDef orderDef) {
+    this.orderDef = orderDef;
+  }
+
+  public OrderDef getOrderDef() throws HiveException {
+    if (this.windowType != WindowType.RANGE) {
+      throw new HiveException("Order expressions should only be used for RANGE windowing type");
+    }
+    return orderDef;
+  }
+
   public boolean isStartUnbounded() {
     return start.isUnbounded();
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
index 82f8fa5..ed88725 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
@@ -48,6 +48,7 @@ import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler;
 import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
@@ -61,7 +62,6 @@ import org.apache.hadoop.hive.ql.plan.PTFDesc;
 import org.apache.hadoop.hive.ql.plan.ReduceSinkDesc;
 import org.apache.hadoop.hive.ql.plan.TableScanDesc;
 import org.apache.hadoop.hive.ql.plan.ptf.BoundaryDef;
-import org.apache.hadoop.hive.ql.plan.ptf.ValueBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFunctionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef;
@@ -332,7 +332,7 @@ public final class OpProcFactory {
         }
         WindowFrameDef wdwFrame = wFnDef.getWindowFrame();
         BoundaryDef end = wdwFrame.getEnd();
-        if ( end instanceof ValueBoundaryDef ) {
+        if (wdwFrame.getWindowType() == WindowType.RANGE) {
           return false;
         }
         if ( end.getDirection() == Direction.FOLLOWING ) {

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
index 5cc84a0..2fdb492 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
@@ -42,19 +42,18 @@ import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.Order;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.PTFDesc;
 import org.apache.hadoop.hive.ql.plan.ptf.BoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.OrderDef;
 import org.apache.hadoop.hive.ql.plan.ptf.OrderExpressionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PTFExpressionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef;
-import org.apache.hadoop.hive.ql.plan.ptf.ValueBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFunctionDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFStreamingEvaluator.SumAvgEnhancer;
 import org.apache.hadoop.hive.ql.udf.generic.ISupportStreamingModeForWindowing;
 import org.apache.hadoop.hive.serde2.AbstractSerDe;
 import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
@@ -198,7 +197,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
      * Currently we are not handling dynamic sized windows implied by range
      * based windows.
      */
-    if (start instanceof ValueBoundaryDef || end instanceof ValueBoundaryDef) {
+    if (wdwFrame.getWindowType() == WindowType.RANGE) {
       return false;
     }
 
@@ -264,8 +263,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
       }
       BoundaryDef start = wdwFrame.getStart();
       BoundaryDef end = wdwFrame.getEnd();
-      if (!(end instanceof ValueBoundaryDef)
-          && !(start instanceof ValueBoundaryDef)) {
+      if (wdwFrame.getWindowType() == WindowType.ROWS) {
         if (!end.isUnbounded() && !start.isUnbounded()) {
           startPos = Math.min(startPos, wdwFrame.getStart().getRelativeOffset());
           endPos = Math.max(endPos, wdwFrame.getEnd().getRelativeOffset());
@@ -297,7 +295,6 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     WindowTableFunctionDef tabDef = (WindowTableFunctionDef) getTableDef();
     for (int i = 0; i < tabDef.getWindowFunctions().size(); i++) {
       WindowFunctionDef wFn = tabDef.getWindowFunctions().get(i);
-      GenericUDAFEvaluator fnEval = wFn.getWFnEval();
       WindowFunctionInfo wFnInfo = FunctionRegistry.getWindowFunctionInfo(wFn.getName());
       boolean supportsWindow = wFnInfo.isSupportsWindow();
       windowingFunctionHelpers.put(wFn.getName(), new WindowingFunctionInfoHelper(supportsWindow));
@@ -672,40 +669,18 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
 
   private Range getRange(WindowFunctionDef wFnDef, int currRow, PTFPartition p) throws HiveException
   {
-    BoundaryDef startB = wFnDef.getWindowFrame().getStart();
-    BoundaryDef endB = wFnDef.getWindowFrame().getEnd();
-    boolean rowFrame = true;
-
-    if ( startB instanceof ValueBoundaryDef || endB instanceof ValueBoundaryDef) {
-      rowFrame = false;
-    }
+    WindowFrameDef winFrame = wFnDef.getWindowFrame();
+    BoundaryDef startB = winFrame.getStart();
+    BoundaryDef endB = winFrame.getEnd();
 
     int start, end;
-    if (rowFrame) {
+    if (winFrame.getWindowType() == WindowType.ROWS) {
       start = getRowBoundaryStart(startB, currRow);
       end = getRowBoundaryEnd(endB, currRow, p);
     } else {
-      ValueBoundaryScanner vbs;
-      if ( startB instanceof ValueBoundaryDef ) {
-        ValueBoundaryDef startValueBoundaryDef = (ValueBoundaryDef)startB;
-        if (startValueBoundaryDef.getOrderDef().getExpressions().size() != 1) {
-          vbs = MultiValueBoundaryScanner.getScanner(startValueBoundaryDef);
-        } else {
-          vbs = SingleValueBoundaryScanner.getScanner(startValueBoundaryDef);
-        }
-      }
-      else {
-        ValueBoundaryDef endValueBoundaryDef = (ValueBoundaryDef)endB;
-        if (endValueBoundaryDef.getOrderDef().getExpressions().size() != 1) {
-          vbs = MultiValueBoundaryScanner.getScanner(endValueBoundaryDef);
-        } else {
-          vbs = SingleValueBoundaryScanner.getScanner(endValueBoundaryDef);
-        }
-      }
-      vbs.reset(startB);
-      start =  vbs.computeStart(currRow, p);
-      vbs.reset(endB);
-      end =  vbs.computeEnd(currRow, p);
+      ValueBoundaryScanner vbs = ValueBoundaryScanner.getScanner(winFrame);
+      start = vbs.computeStart(currRow, p);
+      end = vbs.computeEnd(currRow, p);
     }
     start = start < 0 ? 0 : start;
     end = end > p.size() ? p.size() : end;
@@ -775,30 +750,38 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
 
 
   static abstract class ValueBoundaryScanner {
-    BoundaryDef bndDef;
+    BoundaryDef start, end;
 
-    public ValueBoundaryScanner(BoundaryDef bndDef) {
-      this.bndDef = bndDef;
-    }
-
-    public void reset(BoundaryDef bndDef) {
-      this.bndDef = bndDef;
+    public ValueBoundaryScanner(BoundaryDef start, BoundaryDef end) {
+      this.start = start;
+      this.end = end;
     }
 
     protected abstract int computeStart(int rowIdx, PTFPartition p) throws HiveException;
 
     protected abstract int computeEnd(int rowIdx, PTFPartition p) throws HiveException;
+
+    public static ValueBoundaryScanner getScanner(WindowFrameDef winFrameDef)
+        throws HiveException {
+      OrderDef orderDef = winFrameDef.getOrderDef();
+      int numOrders = orderDef.getExpressions().size();
+      if (numOrders != 1) {
+        return new MultiValueBoundaryScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef);
+      } else {
+        return SingleValueBoundaryScanner.getScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef);
+      }
+    }
   }
 
   /*
    * - starting from the given rowIdx scan in the given direction until a row's expr
-   * evaluates to an amt that crosses the 'amt' threshold specified in the ValueBoundaryDef.
+   * evaluates to an amt that crosses the 'amt' threshold specified in the BoundaryDef.
    */
   static abstract class SingleValueBoundaryScanner extends ValueBoundaryScanner {
     OrderExpressionDef expressionDef;
 
-    public SingleValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef);
+    public SingleValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end);
       this.expressionDef = expressionDef;
     }
 
@@ -837,7 +820,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
      */
     @Override
     protected int computeStart(int rowIdx, PTFPartition p) throws HiveException {
-      switch(bndDef.getDirection()) {
+      switch(start.getDirection()) {
       case PRECEDING:
         return computeStartPreceding(rowIdx, p);
       case CURRENT:
@@ -849,7 +832,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeStartPreceding(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = start.getAmt();
       // Use Case 1.
       if ( amt == BoundarySpec.UNBOUNDED_AMOUNT ) {
         return 0;
@@ -924,7 +907,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeStartFollowing(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = start.getAmt();
       Object sortKey = computeValue(p.getAt(rowIdx));
 
       Object rowVal = sortKey;
@@ -1001,7 +984,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
      */
     @Override
     protected int computeEnd(int rowIdx, PTFPartition p) throws HiveException {
-      switch(bndDef.getDirection()) {
+      switch(end.getDirection()) {
       case PRECEDING:
         return computeEndPreceding(rowIdx, p);
       case CURRENT:
@@ -1013,7 +996,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeEndPreceding(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = end.getAmt();
       // Use Case 1.
       // amt == UNBOUNDED, is caught during translation
 
@@ -1081,7 +1064,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeEndFollowing(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = end.getAmt();
 
       // Use Case 8.
       if ( amt == BoundarySpec.UNBOUNDED_AMOUNT ) {
@@ -1148,13 +1131,13 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
 
 
     @SuppressWarnings("incomplete-switch")
-    public static SingleValueBoundaryScanner getScanner(ValueBoundaryDef vbDef)
+    public static SingleValueBoundaryScanner getScanner(BoundaryDef start, BoundaryDef end, OrderDef orderDef)
         throws HiveException {
-      if (vbDef.getOrderDef().getExpressions().size() != 1) {
+      if (orderDef.getExpressions().size() != 1) {
         throw new HiveException("Internal error: initializing SingleValueBoundaryScanner with"
                 + " multiple expression for sorting");
       }
-      OrderExpressionDef exprDef = vbDef.getOrderDef().getExpressions().get(0);
+      OrderExpressionDef exprDef = orderDef.getExpressions().get(0);
       PrimitiveObjectInspector pOI = (PrimitiveObjectInspector) exprDef.getOI();
       switch(pOI.getPrimitiveCategory()) {
       case BYTE:
@@ -1162,16 +1145,16 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
       case LONG:
       case SHORT:
       case TIMESTAMP:
-        return new LongValueBoundaryScanner(vbDef, exprDef);
+        return new LongValueBoundaryScanner(start, end, exprDef);
       case DOUBLE:
       case FLOAT:
-        return new DoubleValueBoundaryScanner(vbDef, exprDef);
+        return new DoubleValueBoundaryScanner(start, end, exprDef);
       case DECIMAL:
-        return new HiveDecimalValueBoundaryScanner(vbDef, exprDef);
+        return new HiveDecimalValueBoundaryScanner(start, end, exprDef);
       case DATE:
-        return new DateValueBoundaryScanner(vbDef, exprDef);
+        return new DateValueBoundaryScanner(start, end, exprDef);
       case STRING:
-        return new StringValueBoundaryScanner(vbDef, exprDef);
+        return new StringValueBoundaryScanner(start, end, exprDef);
       }
       throw new HiveException(
           String.format("Internal Error: attempt to setup a Window for datatype %s",
@@ -1180,8 +1163,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   }
 
   public static class LongValueBoundaryScanner extends SingleValueBoundaryScanner {
-    public LongValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef,expressionDef);
+    public LongValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end,expressionDef);
     }
 
     @Override
@@ -1212,8 +1195,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   }
 
   public static class DoubleValueBoundaryScanner extends SingleValueBoundaryScanner {
-    public DoubleValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef,expressionDef);
+    public DoubleValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end,expressionDef);
     }
 
     @Override
@@ -1244,8 +1227,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   }
 
   public static class HiveDecimalValueBoundaryScanner extends SingleValueBoundaryScanner {
-    public HiveDecimalValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef,expressionDef);
+    public HiveDecimalValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end,expressionDef);
     }
 
     @Override
@@ -1276,8 +1259,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   }
 
   public static class DateValueBoundaryScanner extends SingleValueBoundaryScanner {
-    public DateValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef,expressionDef);
+    public DateValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end,expressionDef);
     }
 
     @Override
@@ -1303,8 +1286,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   }
 
   public static class StringValueBoundaryScanner extends SingleValueBoundaryScanner {
-    public StringValueBoundaryScanner(BoundaryDef bndDef, OrderExpressionDef expressionDef) {
-      super(bndDef,expressionDef);
+    public StringValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderExpressionDef expressionDef) {
+      super(start, end,expressionDef);
     }
 
     @Override
@@ -1331,8 +1314,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
   static class MultiValueBoundaryScanner extends ValueBoundaryScanner {
     OrderDef orderDef;
 
-    public MultiValueBoundaryScanner(BoundaryDef bndDef, OrderDef orderDef) {
-      super(bndDef);
+    public MultiValueBoundaryScanner(BoundaryDef start, BoundaryDef end, OrderDef orderDef) {
+      super(start, end);
       this.orderDef = orderDef;
     }
 
@@ -1349,7 +1332,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
      */
     @Override
     protected int computeStart(int rowIdx, PTFPartition p) throws HiveException {
-      switch(bndDef.getDirection()) {
+      switch(start.getDirection()) {
       case PRECEDING:
         return computeStartPreceding(rowIdx, p);
       case CURRENT:
@@ -1362,7 +1345,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeStartPreceding(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = start.getAmt();
       if ( amt == BoundarySpec.UNBOUNDED_AMOUNT ) {
         return 0;
       }
@@ -1397,7 +1380,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
      */
     @Override
     protected int computeEnd(int rowIdx, PTFPartition p) throws HiveException {
-      switch(bndDef.getDirection()) {
+      switch(end.getDirection()) {
       case PRECEDING:
         throw new HiveException(
                 "PRECEDING not allowed for finishing RANGE with multiple expressions in ORDER BY");
@@ -1424,7 +1407,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     protected int computeEndFollowing(int rowIdx, PTFPartition p) throws HiveException {
-      int amt = bndDef.getAmt();
+      int amt = end.getAmt();
       if ( amt == BoundarySpec.UNBOUNDED_AMOUNT ) {
         return p.size();
       }
@@ -1458,15 +1441,6 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
       }
       return true;
     }
-
-    public static MultiValueBoundaryScanner getScanner(ValueBoundaryDef vbDef)
-        throws HiveException {
-      if (vbDef.getOrderDef().getExpressions().size() <= 1) {
-        throw new HiveException("Internal error: initializing SingleValueBoundaryScanner with"
-                + " multiple expression for sorting");
-      }
-      return new MultiValueBoundaryScanner(vbDef, vbDef.getOrderDef());
-    }
   }
 
   public static class SameList<E> extends AbstractList<E> {

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/org/apache/hadoop/hive/ql/udaf/TestStreamingSum.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udaf/TestStreamingSum.java b/ql/src/test/org/apache/hadoop/hive/ql/udaf/TestStreamingSum.java
index c26de3f..95e3176 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udaf/TestStreamingSum.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udaf/TestStreamingSum.java
@@ -28,9 +28,8 @@ import org.apache.hadoop.hive.common.type.HiveDecimal;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec;
 import org.apache.hadoop.hive.ql.parse.WindowingSpec.Direction;
+import org.apache.hadoop.hive.ql.parse.WindowingSpec.WindowType;
 import org.apache.hadoop.hive.ql.plan.ptf.BoundaryDef;
-import org.apache.hadoop.hive.ql.plan.ptf.CurrentRowDef;
-import org.apache.hadoop.hive.ql.plan.ptf.RangeBoundaryDef;
 import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer;
@@ -52,18 +51,18 @@ public class TestStreamingSum {
   public static WindowFrameDef wdwFrame(int p, int f) {
     BoundaryDef start, end;
     if (p == 0) {
-      start = new CurrentRowDef();
+      start = new BoundaryDef(Direction.CURRENT, 0);
     } else {
-      start = new RangeBoundaryDef(Direction.PRECEDING, p);
+      start = new BoundaryDef(Direction.PRECEDING, p);
     }
 
     if (f == 0) {
-      end = new CurrentRowDef();
+      end = new BoundaryDef(Direction.CURRENT, 0);
     } else {
-      end = new RangeBoundaryDef(Direction.FOLLOWING, f);
+      end = new BoundaryDef(Direction.FOLLOWING, f);
     }
 
-    return new WindowFrameDef(start, end);
+    return new WindowFrameDef(WindowType.ROWS, start, end);
   }
 
   public void sumDouble(Iterator<Double> inVals, int inSz, int numPreceding,

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/distinct_windowing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/distinct_windowing.q.out b/ql/src/test/results/clientpositive/distinct_windowing.q.out
index e6cde90..61ea8ee 100644
--- a/ql/src/test/results/clientpositive/distinct_windowing.q.out
+++ b/ql/src/test/results/clientpositive/distinct_windowing.q.out
@@ -91,7 +91,7 @@ STAGE PLANS:
                         arguments: _col0
                         name: first_value
                         window function: GenericUDAFFirstValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 84795 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: first_value_window_0 (type: tinyint)
@@ -208,7 +208,7 @@ STAGE PLANS:
                         arguments: _col2
                         name: last_value
                         window function: GenericUDAFLastValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 127193 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: last_value_window_0 (type: int)
@@ -330,13 +330,13 @@ STAGE PLANS:
                         arguments: _col2
                         name: last_value
                         window function: GenericUDAFLastValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: first_value_window_1
                         arguments: _col0
                         name: first_value
                         window function: GenericUDAFFirstValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 84795 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: last_value_window_0 (type: int), first_value_window_1 (type: tinyint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/distinct_windowing_no_cbo.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/distinct_windowing_no_cbo.q.out b/ql/src/test/results/clientpositive/distinct_windowing_no_cbo.q.out
index 0e9091e..29c53c2 100644
--- a/ql/src/test/results/clientpositive/distinct_windowing_no_cbo.q.out
+++ b/ql/src/test/results/clientpositive/distinct_windowing_no_cbo.q.out
@@ -91,7 +91,7 @@ STAGE PLANS:
                         arguments: _col0
                         name: first_value
                         window function: GenericUDAFFirstValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 84795 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: first_value_window_0 (type: tinyint)
@@ -208,7 +208,7 @@ STAGE PLANS:
                         arguments: _col2
                         name: last_value
                         window function: GenericUDAFLastValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 127193 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: last_value_window_0 (type: int)
@@ -330,13 +330,13 @@ STAGE PLANS:
                         arguments: _col2
                         name: last_value
                         window function: GenericUDAFLastValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
                       window function definition
                         alias: first_value_window_1
                         arguments: _col0
                         name: first_value
                         window function: GenericUDAFFirstValueEvaluator
-                        window frame: PRECEDING(MAX)~
+                        window frame: PRECEDING(MAX)~CURRENT
             Statistics: Num rows: 84795 Data size: 1017544 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: last_value_window_0 (type: int), first_value_window_1 (type: tinyint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/llap/ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/ptf.q.out b/ql/src/test/results/clientpositive/llap/ptf.q.out
index aabe694..542347d2 100644
--- a/ql/src/test/results/clientpositive/llap/ptf.q.out
+++ b/ql/src/test/results/clientpositive/llap/ptf.q.out
@@ -116,7 +116,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -611,7 +611,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1674,7 +1674,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1852,7 +1852,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2091,7 +2091,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -2265,7 +2265,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_1
                               arguments: _col7
@@ -2499,13 +2499,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -2848,7 +2848,7 @@ STAGE PLANS:
                               arguments: _col2
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(2)~
+                              window frame: PRECEDING(2)~CURRENT
                   Statistics: Num rows: 13 Data size: 2574 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), sum_window_0 (type: double)
@@ -3086,7 +3086,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -3125,7 +3125,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(5)~
+                              window frame: PRECEDING(5)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col1 (type: string), _col2 (type: string), _col5 (type: int), sum_window_0 (type: bigint)
@@ -3539,7 +3539,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -3812,7 +3812,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4060,7 +4060,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4346,7 +4346,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -4613,7 +4613,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)
@@ -4867,7 +4867,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/ad335c1d/ql/src/test/results/clientpositive/llap/ptf_streaming.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/ptf_streaming.q.out b/ql/src/test/results/clientpositive/llap/ptf_streaming.q.out
index 440b95d..d410f5d 100644
--- a/ql/src/test/results/clientpositive/llap/ptf_streaming.q.out
+++ b/ql/src/test/results/clientpositive/llap/ptf_streaming.q.out
@@ -116,7 +116,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -836,7 +836,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1075,7 +1075,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1316,7 +1316,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1557,7 +1557,7 @@ STAGE PLANS:
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12974 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), _col5 (type: int), rank_window_0 (type: int), dense_rank_window_1 (type: int), sum_window_2 (type: double)
@@ -1779,13 +1779,13 @@ STAGE PLANS:
                               arguments: _col1
                               name: count
                               window function: GenericUDAFCountEvaluator
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: sum_window_3
                               arguments: _col7
                               name: sum
                               window function: GenericUDAFSumDouble
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                             window function definition
                               alias: lag_window_4
                               arguments: _col5, 1, _col5
@@ -2060,7 +2060,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2333,7 +2333,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint)
@@ -2589,7 +2589,7 @@ STAGE PLANS:
                               arguments: _col5
                               name: sum
                               window function: GenericUDAFSumLong
-                              window frame: PRECEDING(MAX)~
+                              window frame: PRECEDING(MAX)~CURRENT
                   Statistics: Num rows: 26 Data size: 12766 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col2 (type: string), _col1 (type: string), rank_window_0 (type: int), dense_rank_window_1 (type: int), _col5 (type: int), sum_window_2 (type: bigint), sum_window_2 (type: bigint)