Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research how we can use Cassandra's source code to typecheck queries #144

Open
tabdulradi opened this issue Feb 3, 2018 · 0 comments
Open

Comments

@tabdulradi
Copy link
Member

The plan is to add Cassandra itself as a compile time dependency, where we call the Java code that is responsible to validate and type check the query (properly happens you prepare a statement).

The Java code will be called from a macro.

Note that the solution must NOT start Cassandra server, not even in memory.

The solutions should provide 2 methods that look something like this:

// Allow us to create Schema representation from schema.cql file
def createSchema(schemaDefinitionStatements: Seq[String]): Either[String, Schema]

// Allow us to know the signature of the query (how many selected rows, what are the types) how many bind markers, what are their types? 
def schemaCheck(schema: Schema, query: String): Either[String, QuerySignature]

These 2 function should call Cassandra's source code.

A proof of concept can be written in a seperate Gist/Repo.

Useful links:
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/Schema.java
https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/cql3/CQLTester.java#L810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant