bd389d2f0d
* Part 1 - Parse `not` and `not-join` * Part 2 - Validate `not` and `not-join` pre-algebrization * Address review comments rnewman. * Remove `WhereNotClause` and populate `NotJoin` with `WhereClause`. * Fix validation for `not` and `not-join`, removing tests that were invalid. * Address rustification comments. * Rebase against `rust` branch. * Part 3 - Add required types for NotJoin. * Implement `PartialEq` for `ConjoiningClauses` so `ComputedTable` can be included inside `ColumnConstraint::NotExists` * Part 4 - Implement `apply_not_join` * Part 5 - Call `apply_not_join` from inside `apply_clause` * Part 6 - Translate `not-join` into `NOT EXISTS` SQL * Address review comments. * Rename `projected` to `unified` to better describe the fact that we are not projecting any variables. * Check for presence of each unified var in either `column_bindings` or `input_bindings` and bail if not there. * Copy over `input_bindings` for each var in `unified`. * Only copy over the first `column_binding` for each variable in `unified` rather than the whole list. * Update tests. * Address review comments. * Make output from Debug for NotExists more useful * Clear up misunderstanding. Any single failing clause in the not will cause the entire not to be considered empty * Address review comments. * Remove Limit requirement from cc_to_exists. * Use Entry.or_insert instead of matching on the entry to add to column_bindings. * Move addition of value_bindings to before apply_clauses on template. * Tidy up tests with some variable reuse. * Addressed nits, * Address review comments. * Move addition of column_bindings to above apply_clause. * Update tests. * Add test to ensure that unbound vars fail * Improve test for unbound variable to check for correct variable and error * address nits
69 lines
2.4 KiB
Rust
69 lines
2.4 KiB
Rust
// 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_core::ValueType;
|
|
|
|
use self::mentat_query::{
|
|
PlainSymbol,
|
|
};
|
|
|
|
error_chain! {
|
|
types {
|
|
Error, ErrorKind, ResultExt, Result;
|
|
}
|
|
|
|
errors {
|
|
InputTypeDisagreement(var: PlainSymbol, declared: ValueType, provided: ValueType) {
|
|
description("input type disagreement")
|
|
display("value of type {} provided for var {}, expected {}", provided, var, declared)
|
|
}
|
|
|
|
UnknownFunction(name: PlainSymbol) {
|
|
description("no such function")
|
|
display("no function named {}", name)
|
|
}
|
|
|
|
InvalidNumberOfArguments(name: PlainSymbol, number: usize, expected: usize) {
|
|
description("invalid number of arguments")
|
|
display("invalid number of arguments to {}: expected {}, got {}.", name, expected, number)
|
|
}
|
|
|
|
UnboundVariable(name: PlainSymbol) {
|
|
description("unbound variable in order clause or function call")
|
|
display("unbound variable: {}", name)
|
|
}
|
|
|
|
NonNumericArgument(function: PlainSymbol, position: usize) {
|
|
description("invalid argument")
|
|
display("invalid argument to {}: expected numeric in position {}.", function, position)
|
|
}
|
|
|
|
InvalidLimit(val: String, kind: ValueType) {
|
|
description("invalid limit")
|
|
display("invalid limit {} of type {}: expected natural number.", val, kind)
|
|
}
|
|
|
|
NonMatchingVariablesInOrClause {
|
|
// TODO: flesh out.
|
|
description("non-matching variables in 'or' clause")
|
|
display("non-matching variables in 'or' clause")
|
|
}
|
|
|
|
NonMatchingVariablesInNotClause {
|
|
// TODO: flesh out.
|
|
description("non-matching variables in 'not' clause")
|
|
display("non-matching variables in 'not' clause")
|
|
}
|
|
}
|
|
}
|
|
|