main
Ziyang Hu 2 years ago
parent 302e248a34
commit 6cce3e97da

@ -6,7 +6,7 @@ Operations
* [x] `left_join(left, right, ...conds)`, similarly for `right_join`, `outer_join`)
* [x] `concat(...rels)`
* [x] `intersect(...rels)`, similarly for `union`
* [ ] `diff(left, right)`, similarly for `sym_diff`
* [x] `diff(left, right)`, similarly for `sym_diff`
* [x] `select(rel, binding: {..})`
* [x] `where(rel, ..conds)`
* [x] `take(rel, n)`
@ -41,6 +41,7 @@ Differentiation
Others
* [ ] assoc magic better work
* [ ] language within query
* [ ] constraints and indices
* [ ] datetime and array types

@ -3,7 +3,7 @@ use crate::algebra::op::{
};
use crate::algebra::parser::{build_relational_expr, AlgebraParseError, RaBox};
use crate::context::TempDbContext;
use crate::data::tuple::{OwnTuple, Tuple};
use crate::data::tuple::{OwnTuple};
use crate::data::tuple_set::{BindingMap, TupleSet};
use crate::ddl::reify::{DdlContext, TableInfo};
use crate::parser::Pairs;

@ -65,10 +65,10 @@ pub(crate) fn build_chain<'a>(ctx: &'a TempDbContext<'a>, arg: Pair) -> Result<R
}
let mut prev_el = first_el;
let mut prev_tid = ctx
let tid = ctx
.resolve_table(&prev_el.target)
.ok_or_else(|| AlgebraParseError::TableNotFound(prev_el.target.clone()))?;
let mut prev_info = ctx.get_table_info(prev_tid)?;
let mut prev_info = ctx.get_table_info(tid)?;
let mut seen_outer = false;
@ -112,7 +112,6 @@ pub(crate) fn build_chain<'a>(ctx: &'a TempDbContext<'a>, arg: Pair) -> Result<R
}));
prev_info = table_info;
prev_tid = node_id;
}
ChainPart::Edge { dir, join } => {
// Node to edge join
@ -141,7 +140,6 @@ pub(crate) fn build_chain<'a>(ctx: &'a TempDbContext<'a>, arg: Pair) -> Result<R
key_is_prefix: true,
}));
prev_info = table_info;
prev_tid = edge_id;
}
}
prev_el = cur_el;

@ -100,7 +100,7 @@ impl RelationalAlgebra for RelationFromValues {
.binding_map
.inner_map
.iter()
.map(|(k, v)| k.to_string())
.map(|(k, _v)| k.to_string())
.collect())
}

@ -350,7 +350,7 @@ pub(crate) mod tests {
#[test]
fn parse_ra() -> Result<()> {
let (db, mut sess) = create_test_db("_test_parser.db");
let (_db, mut sess) = create_test_db("_test_parser.db");
let start = Instant::now();
{
let ctx = sess.temp_ctx(true);

@ -30,9 +30,6 @@ pub enum EvalError {
#[error("Incomplete evaluation {0}")]
IncompleteEvaluation(String),
#[error("Called resolve on null context")]
NullContext,
}
// type Result<T> = result::Result<T, EvalError>;

@ -331,28 +331,6 @@ impl TryFrom<StaticValue> for Expr {
}
}
fn build_value_from_binop<'a>(name: &str, (left, right): (Expr, Expr)) -> Value<'a> {
build_tagged_value(
EXPR_TAG_APPLY,
vec![
Value::from(name.to_string()),
Value::from(vec![Value::from(left), Value::from(right)]),
]
.into(),
)
}
fn build_value_from_uop<'a>(name: &str, arg: Expr) -> Value<'a> {
build_tagged_value(
EXPR_TAG_APPLY,
vec![
Value::from(name.to_string()),
Value::from(vec![Value::from(arg)]),
]
.into(),
)
}
pub(crate) const EXPR_TAG_CONST: &str = "Const";
pub(crate) const EXPR_TAG_LIST: &str = "List";
pub(crate) const EXPR_TAG_DICT: &str = "Dict";

@ -182,7 +182,7 @@ pub(crate) const OP_MINUS: BuiltinFn = BuiltinFn {
name: NAME_OP_MINUS,
arity: Some(1),
non_null_args: true,
func: op_mul,
func: op_minus,
};
pub(crate) const NAME_OP_MINUS: &str = "--";

@ -5,8 +5,6 @@ use anyhow::Result;
use std::borrow::Cow;
use std::collections::BTreeMap;
pub(crate) struct OpConcat;
pub(crate) const NAME_OP_CONCAT: &str = "concat";
pub(crate) fn row_eval_concat<'a, T: RowEvalContext + 'a>(

@ -5,7 +5,7 @@ use crate::data::tuple::{
DataKind, OwnTuple, Tuple, DATAKIND_ASSOC, DATAKIND_EDGE, DATAKIND_INDEX, DATAKIND_NODE,
DATAKIND_SEQUENCE,
};
use crate::data::tuple_set::{BindingMap, TableId, TupleSetIdx};
use crate::data::tuple_set::{TableId, TupleSetIdx};
use crate::data::value::{StaticValue, Value};
use crate::ddl::parser::{
AssocSchema, ColSchema, DdlSchema, EdgeSchema, IndexSchema, NodeSchema, SequenceSchema,
@ -144,9 +144,6 @@ impl TableInfo {
TableInfo::Sequence(t) => t.tid = id,
}
}
pub(crate) fn binding_map(&self) -> BindingMap {
todo!()
}
}
impl<T: AsRef<[u8]>> TryFrom<Tuple<T>> for TableInfo {

@ -13,18 +13,6 @@ pub enum DbInstanceError {
#[error("Cannot obtain session lock")]
SessionLock,
#[error("Cannot obtain table access lock")]
TableAccessLock,
#[error("Cannot obtain table mutation lock")]
TableMutationLock,
#[error("Table does not exist: {0}")]
TableDoesNotExist(u32),
#[error("Name conflict {0}")]
NameConflict(String),
#[error("Parse error {0}")]
Parse(String),

Loading…
Cancel
Save