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

expressions need to pass through expressions to DB's #13

Open
araddon opened this issue Aug 2, 2015 · 2 comments
Open

expressions need to pass through expressions to DB's #13

araddon opened this issue Aug 2, 2015 · 2 comments

Comments

@araddon
Copy link
Owner

araddon commented Aug 2, 2015

As a proxy, expressions in SQL could potentially be evaluated in one of several points of the lifecycle:;

  1. Initial Proxy Routing/Evaluation context: ie proxy recieves sql, evaluate before passing through to datastore
  2. DataStore: pass through expressions to db, used for db's that support them natively, either as a function in db, or a translation such as mutations ie col +1 or set type operations in cassandra, n1ql or postgres or mongo
  3. return, after returning data from datastore, before returning to requester, perform manipulations on it.

How to express these 3 different contexts? Currently I think only 1 is supported for update/insert/delete and 2 is not supported at all and 3 for select only.

UPDATE counterks.page_view_counts
  SET counter_value = counter_value + 2
  WHERE url_name='www.datastax.com' AND page_name='home';

CQL set operation

UPDATE users
  SET emails = emails + {'fb@friendsofmordor.org'} WHERE user_id = 'frodo';
@araddon araddon changed the title Vm needs to pass through expressions to DB's expressions need to pass through expressions to DB's Aug 2, 2015
@dreamer-dead
Copy link

Hi, sorry for the questions unrelated to this concrete issue.
Could you say, is it possible to pass expressions/filters to a remote datasource with qlbridge?
For example, if I have a REST API like site.com/rest/users and query like select count(*) from users where name = "Joe", can I pass that filter name=Joe to the REST or I should get all users and then filter locally (like full table scan)?
That is not clear to me from the first glance, sorry =(

@araddon
Copy link
Owner Author

araddon commented Nov 27, 2018

It is possible.

The exec package is the Query Runtime (a single thread query runtime).

It recognizes Sources (ie, each table name is from a source), each table name is loaded into a schema so that multiple tables can exist in same schema, from different sources.

Each Source TYPE must be implemented to do predicate pushdown (ie, rewrite queries to push down to underlying store). This implementation i call a Generator and basically involves walking the AST of the SQL to re-write and push down.

This ticket above is referring to the fact that WHICH functions to pass down (and which not to) needs to have a cleaner, better way of deciding.

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

2 participants