Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-31

Implement WindowsFrame Reference Operator

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.1.0-m1
    • None

    Description

      Window Frame (1)

      For each record of an incoming stream (let’s call this the target record), the window operator will create a segment containing the records in a sliding window surrounding the target record. The sliding window will include a specified number of records before and/or after the target record. The window frame operator can operate across an entire input stream or can be told to only allow operations within each incoming segment.
      A simple example: a window range of -2 start and 0 end is applied to a 5 record single segment input [0,1,2,3,4]. This would result in an output of 12 rows (brackets describe each output segment) [0] [0,1] [0,1,2] [1,2,3] [2,3,4]. Each output record would have contain two additional fields: ref.segment which holds the current window segment and ref.position which will the negative, positive or zero position within the window. For the example data, the values to each of these would be: ref.segment: [0,1,1,2,2,2,3,3,3,4,4,4], ref.position: [0,-1,0,-1,0,1,-1,0,1,-1,0,1]
      A window operator can also optionally take a segment key as input. This key is used to restrict the windows so that they do not cross segment boundaries. The window operator takes as inputs a ‘start’ and an ‘end’ value. These values define the range of the window. The window range is defined based on thinking of the target record as zero, and each record after incrementing positively and each record before incrementing negatively. In the case that start or end is not defined, that portion of the range will be unbounded. In all cases, start must be greater than or equal to end. At least one of start or end must be defined.
      { @id†: <opref>, op: “windowframe”,

      input†: <input>,

      within*: <name>,

      start*: <number>,

      end*: <number>

      ref:

      { segment: <name>, position: <name> }

      ,

      }

      Attachments

        Activity

          People

            tnachen Timothy Chen
            tnachen Timothy Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: