Box the ConjoiningClauses in the enum ComputedTable to lower the size of that struct.
This commit is contained in:
parent
b41bcf40f3
commit
a8223d11c9
4 changed files with 19 additions and 13 deletions
|
@ -209,9 +209,12 @@ macro_rules! def_from_option {
|
|||
macro_rules! def_is {
|
||||
($name: ident, $pat: pat) => {
|
||||
pub fn $name(&self) -> bool {
|
||||
match *self { $pat => true, _ => false }
|
||||
match *self {
|
||||
$pat => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Creates `as_$TYPE` helper functions for Value or SpannedValue, like
|
||||
|
@ -231,9 +234,12 @@ macro_rules! def_as {
|
|||
macro_rules! def_as_ref {
|
||||
($name: ident, $kind: path, $t: ty) => {
|
||||
pub fn $name(&self) -> Option<&$t> {
|
||||
match *self { $kind(ref v) => Some(v), _ => None }
|
||||
match *self {
|
||||
$kind(ref v) => Some(v),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Creates `into_$TYPE` helper functions for Value or SpannedValue, like
|
||||
|
|
|
@ -66,7 +66,7 @@ impl ConjoiningClauses {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let subquery = ComputedTable::Subquery(template);
|
||||
let subquery = ComputedTable::Subquery(Box::new(template));
|
||||
|
||||
self.wheres
|
||||
.add_intersection(ColumnConstraint::NotExists(subquery));
|
||||
|
@ -256,7 +256,7 @@ mod testing {
|
|||
john
|
||||
)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::NotExists(
|
||||
ComputedTable::Subquery(subquery)
|
||||
ComputedTable::Subquery(Box::new(subquery))
|
||||
)),
|
||||
])
|
||||
);
|
||||
|
@ -355,7 +355,7 @@ mod testing {
|
|||
)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::Equals(d2v.clone(), john)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::NotExists(
|
||||
ComputedTable::Subquery(subquery),
|
||||
ComputedTable::Subquery(Box::new(subquery)),
|
||||
)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::Equals(
|
||||
d0e.clone(),
|
||||
|
@ -467,7 +467,7 @@ mod testing {
|
|||
right: QueryValue::TypedValue(TypedValue::Long(30)),
|
||||
}),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::NotExists(
|
||||
ComputedTable::Subquery(subquery)
|
||||
ComputedTable::Subquery(Box::new(subquery))
|
||||
)),
|
||||
])
|
||||
);
|
||||
|
@ -578,7 +578,7 @@ mod testing {
|
|||
bill
|
||||
)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::NotExists(
|
||||
ComputedTable::Subquery(subquery)
|
||||
ComputedTable::Subquery(Box::new(subquery))
|
||||
)),
|
||||
])
|
||||
);
|
||||
|
@ -662,7 +662,7 @@ mod testing {
|
|||
bill
|
||||
)),
|
||||
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::NotExists(
|
||||
ComputedTable::Subquery(subquery)
|
||||
ComputedTable::Subquery(Box::new(subquery))
|
||||
)),
|
||||
])
|
||||
);
|
||||
|
|
|
@ -32,7 +32,7 @@ pub enum DatomsTable {
|
|||
/// A source of rows that isn't a named table -- typically a subquery or union.
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum ComputedTable {
|
||||
Subquery(::clauses::ConjoiningClauses),
|
||||
Subquery(Box<::clauses::ConjoiningClauses>),
|
||||
Union {
|
||||
projection: BTreeSet<Variable>,
|
||||
type_extraction: BTreeSet<Variable>,
|
||||
|
|
|
@ -298,7 +298,7 @@ fn table_for_computed(computed: ComputedTable, alias: TableAlias) -> TableOrSubq
|
|||
// datoms03.value_type_tag AS `?x_value_type_tag`
|
||||
let extract = cc.extracted_types
|
||||
.get(var)
|
||||
.expect("Expected variable to have a known type or an extracted type");
|
||||
.expect("Expected variable to have a known type, or an extracted type");
|
||||
ColumnOrExpression::Column(extract.clone())
|
||||
};
|
||||
let type_column = VariableColumn::VariableTypeTag(var.clone());
|
||||
|
@ -315,7 +315,7 @@ fn table_for_computed(computed: ComputedTable, alias: TableAlias) -> TableOrSubq
|
|||
alias)
|
||||
}
|
||||
ComputedTable::Subquery(subquery) => {
|
||||
TableOrSubquery::Subquery(Box::new(cc_to_exists(subquery)))
|
||||
TableOrSubquery::Subquery(Box::new(cc_to_exists(*subquery)))
|
||||
}
|
||||
ComputedTable::NamedValues { names, values } => {
|
||||
// We assume column homogeneity, so we won't have any type tag columns.
|
||||
|
|
Loading…
Reference in a new issue