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

Schema Engine Revamp #135

Merged
merged 34 commits into from
Aug 30, 2017
Merged

Schema Engine Revamp #135

merged 34 commits into from
Aug 30, 2017

Conversation

tabdulradi
Copy link
Member

@tabdulradi tabdulradi commented Dec 30, 2016

Current implementation of Schema engine is not flexible enough to support UDTs, UDFs, and UDAs without too much hassle. The main reason is all Cassandra relation logic is implemented as a normal run-time-style code, that gets executed via macros in compile-time! This made extending and configuring troy very hard task.

This PR aims to demolish the current schema engine, splitting it into two parts

  1. Schema Builder: Code/macro capable of parsing schema.cql file and generating a form of schema code (see below for more details)
  2. Schema-agnostic Query analyzer: Code/macro capable of parsing queries, and generating code describing this query. Without using the schema to make any sense of the queries.

After the macros are executed, we should have in place queries written in an internal-dsl (designed as part of this PR), that expected specific implicits to be imported somewhere, those implicits are effectively the schema plus cassandra built-ins.

The approach I took, makes heavy use of literal types (so we moved to type-level compiler till the feature is merged into the Lightbend Scala), typeclasses, and HLists.

  • Select columns
  • Select functions
  • UDF
  • UDT
  • Simple Where
  • Macro
  • Integration test

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 87.926% when pulling a45a6e8 on feature/schema-engine-revamp into 368459f on master.

@Eman-Shaaban
Copy link
Member

LGTM 😎

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 88.152% when pulling 6af6772 on feature/schema-engine-revamp into 368459f on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.4%) to 86.611% when pulling 616b523 on feature/schema-engine-revamp into 368459f on master.

Ideally schema should be generated once but imported for all queries, but this would break backward compatbility. So will it as improvement in next major version.
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 86.853% when pulling b2c738f on feature/schema-engine-revamp into 368459f on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.3%) to 85.754% when pulling c377713 on feature/schema-engine-revamp into 368459f on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.4%) to 83.602% when pulling 210bbe9 on feature/schema-engine-revamp into 368459f on master.

Adjusts implicit instances, and utilises macros, so that a special
implicit instance would resolve if a non existing column was selected.
This special implicit is implemented via macro, to show a compile error.
Using macro WeakTypeTag, we extract the column name (from the literal
type), then show it as part of compiler error message
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.8%) to 83.221% when pulling 99fb9f6 on feature/schema-engine-revamp into 368459f on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.3%) to 83.78% when pulling acbd27e on feature/schema-engine-revamp into 368459f on master.

@tabdulradi
Copy link
Member Author

Merging anyway, master shall be broken temporarily until we migrate to the new implementation.

@tabdulradi tabdulradi merged commit 4190d8e into master Aug 30, 2017
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

Successfully merging this pull request may close these issues.

3 participants