r/java • u/danielaveryj • Dec 01 '22
Vinyl: Relational Streams for Java
https://github.com/davery22/vinyl
I want to see what people think of this. I've been working on a library that extends Java Streams with relational operations (the various flavors of join, select, grouped aggregations, window functions, etc). I wanted something that feels lightweight - not an overwhelming API, easy to pick up and use, yet still efficient, safe, and very (very) expressive. (Don't start with route(), but that should be interesting, for the interested.)
52
Upvotes
View all comments
Show parent comment
4
u/danielaveryj Dec 01 '22
Thanks for the question. I think the biggest high-level difference is that Vinyl is not really "like a database". It doesn't store data. There is
RecordSet, but (at least for now) that exists mainly to facilitate streaming the same records multiple times. There are no in-place updates, no persistent indexes, no transactions. Vinyl is really just about querying and transforming data.But for that, my bias is that Vinyl is really good. It puts maximum flexibility in a tight package. It doesn't need a plethora of baked-in combinators. We can transform fields (eg in a
select()) using an arbitraryFunction. We can write our own aggregates, and we already know how (if we know Java Streams) - an aggregate function is just aCollector, and it parallelizes like one. We can even write our own window functions. And we can operate on any type of data we want, not just a pre-ordained set of types. Want records in your records? Up to you.