Git Product home page Git Product logo

Comments (7)

rapimo avatar rapimo commented on June 18, 2024

I'd prefere more generic option to achieve this.
I.e. we already have compact(istore) and istore_val_larger(istore, istore)
How about adding istore_val_larger(istore, int) so that

SELECT istore_val_larger({1 => 2, 2 => -3, 3 => -1, 4 => -3}, 0) gives
{1 => 2}
on could then SUM(istore_val_larger(istore_col,int) to achieve the same.

functionality would be the same as clamp_below just with values instead of keys

from istore.

ildus avatar ildus commented on June 18, 2024

I think @alexeyklyukin is already working on this in #86. Problem with these functions that the function should make another istore and allocate more memory on each tuple.

from istore.

einhverfr avatar einhverfr commented on June 18, 2024

Yeah my thinking was this function would be more efficient than creating new istores and summing.

I can see two ways of looking at this.

  1. With faster hardware, we need to worry less about this efficiency.
  2. With faster hardware, we are catching up with the hardware fast enough to make this have a possibly significant difference.

from istore.

rapimo avatar rapimo commented on June 18, 2024

well efficiency is always good, I was just wondering about the use cases because this alone seems not to be a full api you might also want to check equality or less than, so maybe

sum_if_val(istorecol, op, int) would be a more flexible thing ?
SELECT sum_if_val(col, '>', 0)

Not sure how the implementation would end up performance wise though

from istore.

ildus avatar ildus commented on June 18, 2024

Thinking about the performance, it could be better to just generate the code for each operator, and in the end we will have five different functions like: sum_gt, sum_gte, sum_eq, sum_lt and sum_lte. And same for other aggregation functions.

from istore.

alexeyklyukin avatar alexeyklyukin commented on June 18, 2024

In the vast majority of cases we aggregate with the sum; the idea of a specialized aggregate here comes from the desire to avoid doing two passes over a single istore (one to correct values and another to accumulate values for the keys) and allocate memory for the istores that don't need to be changed.

The less-common cases are covered by #86: one can filter on istore_in_range function before passing the istore to the respective aggregate or apply istore_floor/istore_ceiling ones to correct them.

from istore.

einhverfr avatar einhverfr commented on June 18, 2024

Not sure this is needed anymore or has a legitimate use case. closing.

from istore.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.