Giter Site home page Giter Site logo

Comments (6)

pjungwir avatar pjungwir commented on July 19, 2024

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.

msqr avatar msqr commented on July 19, 2024

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.

pjungwir avatar pjungwir commented on July 19, 2024

from aggs_for_vecs.

pjungwir avatar pjungwir commented on July 19, 2024

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.

msqr avatar msqr commented on July 19, 2024

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.

msqr avatar msqr commented on July 19, 2024

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)

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.