Re: question about window function in C - Mailing list pgsql-general

From Merlin Moncure
Subject Re: question about window function in C
Date
Msg-id CAHyXU0xezPf=3ddLyzTZk5iHKXH6BSeqG44oLkOMJKBduksiWg@mail.gmail.com
Whole thread Raw
In response to Re: question about window function in C  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: question about window function in C
List pgsql-general
On Fri, Dec 26, 2014 at 11:41 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
> On Fri, Dec 26, 2014 at 1:19 PM, Dan S <strd911@gmail.com> wrote:
>> Well I'm trying to implement a window-function that works on range_types and
>> produces 'atomic ranges' for each input range.
>> Let's say I have a set of ranges some overlapping some not, and I want to
>> split each range at every boundary of every overlapping range and return
>> those.
>> So for each range r I want to return an array of ranges that consists of
>> range r split at every overlapping range boundary.
>> I need to consider both upper and lower boundaries and to be able to do this
>> in one pass over the data I need to sort both the upper and lower boundaries
>> and also sort the original ranges so I can loop over the ranges and
>> boundaries in lockstep to produce the arrays.
>> As a last step I sort back the arrays of atomic ranges in the original order
>> in the window so I can read out the tuplesort in that order and return each
>> array to its corresponding range r.
>>
>> (The result can be used to answer questions like what are the maximum number
>> of simultaneously overlapping ranges and at which ranges the maximum occurs)

shoot -- sorry for empty mail -- misclick.

anyways, can you give some precise examples of what you want to occur?
 for example, a set of sql taking actual inputs and the output you
would like to see...

merlin


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: question about window function in C
Next
From: Dan S
Date:
Subject: Re: question about window function in C