kensho-technologies / graphql-compiler

Turn complex GraphQL queries into optimized database queries.
Apache License 2.0
553 stars 50 forks source link

NotImplementedError when calling toGremlin in FoldedContextField #260

Open dirkkolb opened 5 years ago

dirkkolb commented 5 years ago

Hey guys!

First of all, thanks a lot for this awesome work. I was testing the compiler in combination with Gremlin. The following GraphQL is mentioned in your Readme, but causes a NotImplementedError when trying to generate a Gremlin statement out of it:

Animal {
        name @output(out_name: "name")
        out_Animal_ParentOf @fold {
            _x_count @filter(op_name: ">=", value: ["$min_children"])
                    @output(out_name: "number_of_children")
            name @filter(op_name: "has_substring", value: ["$substr"])
                 @output(out_name: "child_names")
        }
    }

Is it a bug or is it just not implemented.

Many thanks!

obi1kenobi commented 5 years ago

Hi! Thank you for checking out our project!

It is actually just not implemented, we are juggling a few different things at once and just haven't gotten around to it yet. It's not difficult though, and if you are interested in looking into it, I'd be more than happy to help you put together a PR. How does that sound?

dirkkolb commented 5 years ago

Hi! We started to implement our own Java based compiler for Datastax DSE Graph. I will let you know when I touch this point and create a PR.

Again many thanks! The project is really awesome!

obi1kenobi commented 5 years ago

Neat -- I think this is the first time our Gremlin backend will get tested with something other than OrientDB as the Gremlin execution engine. It's possible that some minor updates to the generated Gremlin could be necessary, since many implementors of Gremlin tend to add extensions for things like vertex types etc.

Please let us know how it goes, and good luck! We're all happy to assist if you get stuck.

dirkkolb commented 5 years ago

The only thing the DSE Graph and OrientDB have in common in g.. That's it ;). DSE Graph doesn't allow lambdas.

obi1kenobi commented 5 years ago

Oh, interesting! How does filtering work, then? Assuming you've figured out the syntax DSE Graph uses, it shouldn't be too difficult to add a customized Gremlin backend that can emit the correct Gremlin syntax for DSE Graph as well -- I am happy to guide you in that process, if you are interested.