HIVE-4076

Summary: Refactor

Test Plan: Existing test cases passed.

Reviewers: hbutani

Differential Revision: https://reviews.facebook.net/D8931

git-svn-id: https://svn.apache.org/repos/asf/hive/branches/ptf-windowing@1450365 13f79535-47bb-0310-9956-ffa450edef68
Merge remote-tracking branch 'remotes/hive/ptf-windowing' into ptf