New WIndow Functions ... question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

New WIndow Functions ... question

Keith Medcalf
They are part of the current draft release:
http://www.sqlite.org/draft/releaselog/3_25_0.html

Dan,

I see that there is a new create function to create the window functions which have some slight changes to the methods being called and what they do.  

I presume that a function defined with the new API can continue to be used as a "normal" aggregate function, but that the new API must be used to define aggregates that can be used with the windowing calls (that is they must be able to compute "interim" results, be able to unwind or reverse value additions, and have a separate destroy function) ... and that if the definition does not include the new methods defined by the windowing API they cannot be used with the Windowing API .. is this a correct interpretation of the code?

On another note, what a really nice addition!  

Now to figure out how to "unwind" value additions to a bunch of running computations so they can be used in the windowing API ...

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.





_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: New WIndow Functions ... question

R Smith-2
On 2018/07/02 1:20 AM, Keith Medcalf wrote:
> http://www.sqlite.org/draft/releaselog/3_25_0.html
>
> Dan,
> ...
>
> On another note, what a really nice addition!
+1
Yup, two solid thumbs up - this is probably the most exciting news since
the addition of CTEs. Can't wait!
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: New WIndow Functions ... question

Dan Kennedy-4
In reply to this post by Keith Medcalf
On 07/02/2018 06:20 AM, Keith Medcalf wrote:
> They are part of the current draft release:
> http://www.sqlite.org/draft/releaselog/3_25_0.html
>
> Dan,
>
> I see that there is a new create function to create the window functions which have some slight changes to the methods being called and what they do.
>
> I presume that a function defined with the new API can continue to be used as a "normal" aggregate function, but that the new API must be used to define aggregates that can be used with the windowing calls (that is they must be able to compute "interim" results, be able to unwind or reverse value additions, and have a separate destroy function) ... and that if the definition does not include the new methods defined by the windowing API they cannot be used with the Windowing API .. is this a correct interpretation of the code?

That's right. Any function created with sqlite3_create_window_function()
can also be used as regular aggregate function. If you pass NULL for
both xValue and xInverse, it can only be used as an aggregate function -
just like aggregates created with the existing
sqlite3_create_function*() APIs. To create a function that can be used
as a window function all 4 callbacks - xStep, xFinal, xValue and
xInverse - passed to sqlite3_create_window_function() must be non-NULL.

The xDestroy() callback is like the one to sqlite3_create_function_v2().
It's invoked either when the database handle is closed or when the
function is overridden. If you need to delete whatever the (void*)
pointer passed as the 5th argument to sqlite3_create_window_function()
points to.

Dan.





>
> On another note, what a really nice addition!
>
> Now to figure out how to "unwind" value additions to a bunch of running computations so they can be used in the windowing API ...
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.
>
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users