Comments (6)
Hmm, I don't love adding a parameter here for that, and then having to maintain two versions of each function. At the least I'd rather use a different name (e.g. varvec_to_sum
) so that we can still add new parameters for something else someday. But before that, how about we write a helper function that expands an input array by padding it will NULLs so that it is some fixed length? So you could do SELECT vec_to_sum(pad_vec(array_column, 8))
. It would be an error to give pad_vec
an array longer than the passed in integer.
That won't be as fast as your proposal, but I'd like to try it out and see if it's fast enough. I don't think it will be very expensive.
I'm happy to do the work on that one. Perhaps this weekend if I get the chance.
from aggs_for_vecs.
Ah, the padding function sounds interesting, thanks! Given I expect most rows to have the same size, would it work out that the function could simply return the input array without having to make a copy? That sounds pretty great, if so.
from aggs_for_vecs.
from aggs_for_vecs.
Okay I added this function on a pad_vec
branch.
Adding new functions is awkward, especially when collaborating, because they need to go into a new aggs_for_vecs--some-new-version.sql
file, but you don't want to make that file in every change and then get merge conflicts. I made a rel-1.3.0
branch that has a copy of it. I think I'll merge that into master
and then we can rebase things off that (e.g. this function).
from aggs_for_vecs.
This is great, thank you! I've pulled in your changes to my feature/numeric2 branch; it merged in fine, all tests pass, and I can play around with it.
from aggs_for_vecs.
I've been testing the new pad_vec
function works perfectly for this use case. Thanks for the quick turnaround on that.
from aggs_for_vecs.
Related Issues (9)
- Support for NUMERIC[] type HOT 32
- Two-step aggregation HOT 24
- Add vec_to_first and vec_to_last aggregates. HOT 2
- Debian package support HOT 2
- [QUESTION] Does this extension benefit from having an index of any type? HOT 2
- Allow processing more input rows than veccounts currently allows HOT 1
- Array math utilities like vec_add, vec_sub, vec_mul, vec_div HOT 6
- Possible to use existing Postgres aggregate functions like numeric_avg_accum, towards two-step aggregation HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aggs_for_vecs.