Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for command SUMVAL #24

Closed
arpitbbhayani opened this issue Oct 16, 2022 · 16 comments
Closed

Add support for command SUMVAL #24

arpitbbhayani opened this issue Oct 16, 2022 · 16 comments
Assignees

Comments

@arpitbbhayani
Copy link
Contributor

Is your feature request related to a problem? Please describe.
There are no KV databases that support values-based aggregations. Doing a summation of integer values in the KV store would help us address a bunch of real-world use-cases

  • all expenses dumped as KV, summation will give net balance quickly

Describe the solution you'd like
Introduce a command SUMVAL that does a summation of all the values and returns the result.

@golu360
Copy link

golu360 commented Oct 16, 2022

Could we compute the summation at insert/ dumping time to ensure that results of this "SUMVAL" is quick to fetch?

@arpitbbhayani
Copy link
Contributor Author

@golu360 Yes. That would be an enhancement. The reason I was thinking of having a SUMVAL command is for in-memory ETL utilities implemented like UNIX-like PIPEs.

@golu360
Copy link

golu360 commented Oct 18, 2022

@golu360 Yes. That would be an enhancement. The reason I was thinking of having a SUMVAL command is for in-memory ETL utilities implemented like UNIX-like PIPEs.

Then similar to summation, could we also similar stuff like "AVGVAL" for average of all integer values?
I'm willing to pick up the SUMVAL piece :D

@golu360
Copy link

golu360 commented Oct 18, 2022

To summarize my solution,

  1. Calculate sum of integer values on "SET"
  2. Decrement on either "DELETE" or expiration.
  3. Retrieve the SUM on "SUMVAL" command.

@golu360
Copy link

golu360 commented Oct 19, 2022

@arpitbbhayani I would like to work on this! :D

@arpitbbhayani
Copy link
Contributor Author

@golu360 Let's do it on runtime; instead of keeping it pre-computed. Also, check for the encoding because not all values will be integers. The reason we are doing this is to support runtime piped operations in the future.

If you are okay with this let me know, I will assign it to you.

@golu360
Copy link

golu360 commented Oct 19, 2022

@arpitbbhayani Sounds even simpler then. Will do it on run-time.

@golu360
Copy link

golu360 commented Oct 20, 2022

@arpitbbhayani do we also need to submit a design doc for this?

@golu360
Copy link

golu360 commented Nov 1, 2022

@arpitbbhayani is this issue still open?

@arpitbbhayani
Copy link
Contributor Author

Yes. Are you interested in picking this up?

@golu360
Copy link

golu360 commented Nov 1, 2022

Yup. Up to pick it! @arpitbbhayani

@arpitbbhayani
Copy link
Contributor Author

Assigned it to you. Thanks for picking it up.

@golu360
Copy link

golu360 commented Nov 1, 2022

@arpitbbhayani are we only expecting integers or are we also expecting floats here?

@arpitbbhayani
Copy link
Contributor Author

Depends on the encoding. Right now we do not support float.

Go through the code and use types and encodings we explicitly maintain. Please understand the flow before you code.

@golu360
Copy link

golu360 commented Aug 19, 2024

@arpitbbhayani @JyotinderSingh Code base has change since this was assigned. I was also thinking if we could find the sum of all values given a string pattern as well.

SUMVAL transaction.*.amount

Which returns the sum of all transaction amounts.

If no key or pattern is passed, we return the sum of all the numeric values. What are your thoughts on this?

@arpitbbhayani
Copy link
Contributor Author

arpitbbhayani commented Aug 19, 2024

@golu360 I think we should skip this one. SUMVAL is not in our roadmap any more. we are chasing reactivity and this command does not fit into the scheme. Apologies for this. I should have closed this issue long time back.

You can find other issue to pick. thank you so much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants