[
https://issues.apache.org/jira/browse/HIVE-15498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15770642#comment-15770642
]
Aihua Xu commented on HIVE-15498:
---------------------------------
The only change in the code is:
{noformat}
wFrame = new WindowFrameSpec(
new ValueBoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
new CurrentRowSpec()
);
{noformat}
to
{noformat}
wFrame = new WindowFrameSpec(
new RangeBoundarySpec(Direction.PRECEDING, BoundarySpec.UNBOUNDED_AMOUNT),
new CurrentRowSpec()
);
{noformat}
RangeBoundarySpec is for "ROWS BETWEEN" and ValueBoundarySpec is for "RANGE
BETWEEN". So it's a little confusing.
> sum() over (order by c) should default the windowing spec to RangeBoundarySpec
> ------------------------------------------------------------------------------
>
> Key: HIVE-15498
> URL: https://issues.apache.org/jira/browse/HIVE-15498
> Project: Hive
> Issue Type: Bug
> Components: PTF-Windowing
> Affects Versions: 2.1.0
> Reporter: Aihua Xu
> Assignee: Aihua Xu
> Attachments: HIVE-15498.1.patch
>
>
> Currently {{sum() over (partition by a)}} without order by will default
> windowing to RangeBoundarySpec while {{sum() over (partition by a order by
> c)}} will default to ValueBoundarySpec.
> From the comment
> {noformat}
> /*
> * - 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 Specification with no Order and no Window Frame is
> interpreted as:
> ROW BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
> */
> {noformat}
> We were trying to set as "row between", not "range between".
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)