Pre: Fold query-translator into query-projector

This commit is contained in:
Grisha Kruglov 2018-08-08 13:03:27 -07:00
parent 9444559f6c
commit cd0bd46232
10 changed files with 9 additions and 84 deletions

View file

@ -79,9 +79,6 @@ path = "query-pull-traits"
[dependencies.mentat_query_sql] [dependencies.mentat_query_sql]
path = "query-sql" path = "query-sql"
[dependencies.mentat_query_translator]
path = "query-translator"
[dependencies.mentat_tolstoy] [dependencies.mentat_tolstoy]
path = "tolstoy" path = "tolstoy"
optional = true optional = true

View file

@ -74,6 +74,8 @@ use mentat_query_sql::{
Projection, Projection,
}; };
pub mod translate;
mod binding_tuple; mod binding_tuple;
pub use binding_tuple::{ pub use binding_tuple::{
BindingTuple, BindingTuple,

View file

@ -49,7 +49,7 @@ use mentat_query_algebrizer::{
VariableColumn, VariableColumn,
}; };
use mentat_query_projector::{ use ::{
CombinedProjection, CombinedProjection,
ConstantProjector, ConstantProjector,
Projector, Projector,

View file

@ -13,7 +13,6 @@ extern crate mentat_core;
extern crate core_traits; extern crate core_traits;
extern crate mentat_query_algebrizer; extern crate mentat_query_algebrizer;
extern crate mentat_query_projector; extern crate mentat_query_projector;
extern crate mentat_query_translator;
extern crate mentat_sql; extern crate mentat_sql;
use std::collections::BTreeMap; use std::collections::BTreeMap;
@ -49,7 +48,7 @@ use mentat_query_projector::{
ConstantProjector, ConstantProjector,
}; };
use mentat_query_translator::{ use mentat_query_projector::translate::{
ProjectedSelect, ProjectedSelect,
query_to_select, query_to_select,
}; };

View file

@ -1,32 +0,0 @@
[package]
name = "mentat_query_translator"
version = "0.0.1"
workspace = ".."
[dependencies]
failure = "0.1.1"
failure_derive = "0.1.1"
[dependencies.edn]
path = "../edn"
[dependencies.mentat_core]
path = "../core"
[dependencies.core_traits]
path = "../core-traits"
[dependencies.mentat_sql]
path = "../sql"
[dependencies.mentat_query_algebrizer]
path = "../query-algebrizer"
[dependencies.mentat_query_projector]
path = "../query-projector"
[dependencies.query_projector_traits]
path = "../query-projector-traits"
[dependencies.mentat_query_sql]
path = "../query-sql"

View file

@ -1,3 +0,0 @@
This crate turns an algebrized Datalog query into a domain-specific representation of a SQL query, and then uses `mentat_sql` to turn that into a SQL string to be executed.
This subsumes both planning and query construction, because in Mentat the SQL query is effectively a query plan.

View file

@ -1,36 +0,0 @@
// 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 failure;
extern crate edn;
extern crate core_traits;
extern crate mentat_core;
extern crate mentat_query_algebrizer;
extern crate mentat_query_projector;
extern crate query_projector_traits;
extern crate mentat_query_sql;
extern crate mentat_sql;
mod translate;
pub use mentat_query_sql::{
Projection,
};
pub use translate::{
ProjectedSelect,
cc_to_exists,
query_to_select,
};
// query-translator could be folded into query-projector; for now, just type alias the errors.
pub type TranslatorError = query_projector_traits::errors::ProjectorError;
pub type Result<T> = std::result::Result<T, TranslatorError>;

View file

@ -32,7 +32,6 @@ extern crate mentat_query_projector;
extern crate query_projector_traits; extern crate query_projector_traits;
extern crate mentat_query_pull; extern crate mentat_query_pull;
extern crate query_pull_traits; extern crate query_pull_traits;
extern crate mentat_query_translator;
extern crate mentat_sql; extern crate mentat_sql;
#[cfg(feature = "syncable")] #[cfg(feature = "syncable")]

View file

@ -57,15 +57,15 @@ use mentat_query_projector::{
Projector, Projector,
}; };
use mentat_sql::{ use mentat_query_projector::translate::{
SQLQuery,
};
use mentat_query_translator::{
ProjectedSelect, ProjectedSelect,
query_to_select, query_to_select,
}; };
use mentat_sql::{
SQLQuery,
};
pub use mentat_query_algebrizer::{ pub use mentat_query_algebrizer::{
Known, Known,
}; };

View file

@ -20,7 +20,6 @@ extern crate mentat_db;
// TODO: when we switch to `failure`, make this more humane. // TODO: when we switch to `failure`, make this more humane.
extern crate query_algebrizer_traits; // For errors; extern crate query_algebrizer_traits; // For errors;
extern crate query_projector_traits; // For errors. extern crate query_projector_traits; // For errors.
extern crate mentat_query_translator; // For errors.
use std::str::FromStr; use std::str::FromStr;