4 ms·
So the way all underlieing communication is done is through a protobuf. So in python I know they hijack the expression and they can then construct the protobuf
by dkhenry 13y ago
So the way all underlieing communication is done is through a protobuf. So in python I know they hijack the expression and they can then construct the protobuf from the passed in python lambda. In Java land we can't really do that since lambdas are desugared at compile time to just be functions. In Java I can't even overload operators like you can in Scala or C++ to make it a little nicer. The result is your pretty much left with rolling the protobuf by hand.
- coffeemug 13y agoAh, got it! The upcoming 1.13 release will introduce a pure JSON interface for queries (which official drivers will switch to). You'll be able to construct JSON directly, and send it to the server -- no protobufs. Would that make things easier?
- dkhenry 13y agoIt will make it on par with the interface for other document oriented databases. I think it will be a lot more user friendly then the protobuf, and it might be the best that Java can do.
- RyanZAG 13y agoSounds like that would work well - it's the approach ElasticSearch has taken with their APIs and they're generally very nice to use.
- coffeemug 13y agoTo clarify, in 1.13 JSON will be a communication protocol for queries. It's not intended to be used by the end user, but by the client drivers. You can use it as an end user, but it isn't nearly as nice as native language drivers. The change is meant to simplify driver development, packaging, and improve performance. Protobuf is worse than JSON in almost all of these categories.
- InAnEmergency 13y agoFWIW, I think this will make it much easier to implement drivers. Getting protobufs to work is a real pain.
- RyanZAG 13y agoTake a look at this work by jooq: http://blog.jooq.org/2014/03/21/java-8-friday-java-8-will-revolutionize-database-access/ http://blog.jooq.org/2014/03/21/java-8-friday-java-8-will-re... You may be able to utilize a lot of their code for converting the lambda bytecode.. or not. Anyway it's interesting to see how they're dealing with the problem you've run into.
- dkhenry 13y agoWell that looks promising. I will need to make a JDK8 branch to integrate this.