Stub out query algebrizer.

This commit is contained in:
Richard Newman 2017-02-03 15:52:02 -08:00
parent b165a0b2ad
commit 42f03f55a2
5 changed files with 40 additions and 0 deletions

View file

@ -34,5 +34,8 @@ path = "query"
[dependencies.mentat_query_parser]
path = "query-parser"
[dependencies.mentat_query_algebrizer]
path = "query-algebrizer"
[dependencies.mentat_tx_parser]
path = "tx-parser"

View file

@ -0,0 +1,7 @@
[package]
name = "mentat_query_algebrizer"
version = "0.0.1"
[dependencies]
[dependencies.mentat_query]
path = "../query"

View file

@ -0,0 +1,5 @@
This crate turns a parsed query, as defined by the `query` crate and produced by the `query-parser` crate, into an *algebrized tree*, also called a *query processor tree*.
This is something of a wooly definition: a query algebrizer in a traditional relational database is the component that combines the schema — including column type constraints — with the query, resolving names, and that sort of thing. Much of that work is unnecessary in our model; for example, we don't need to resolve column aliases, deal with table names, or that sort of thing. But the similarity is strong enough to give us the name of this crate.
The result of this process is traditionally handed to the *query optimizer* to yield an *execution plan*. In our case the execution plan is deterministically derived from the algebrized tree, and the real optimization (such as it is) takes place within the underlying SQLite database.

View file

@ -0,0 +1,24 @@
// Copyright 2016 Mozilla
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
extern crate mentat_query;
use mentat_query::{
FindQuery,
SrcVar,
Variable,
WhereClause,
};
pub struct AlgebrizedQuery {
}
pub fn algebrize(parsed: FindQuery) -> AlgebrizedQuery {
AlgebrizedQuery {}
}

View file

@ -20,6 +20,7 @@ extern crate mentat_core;
extern crate mentat_db;
extern crate mentat_query;
extern crate mentat_query_parser;
extern crate mentat_query_algebrizer;
use rusqlite::Connection;