mod access;
mod agg;
mod binding;
mod clause_kind;
mod expr_check;
mod expr_text;
mod inline;
mod literal;
mod names;
mod namespaces;
mod order;
mod pattern;
mod plan;
mod query_type;
mod resolve;
mod rewrite;
mod scan_order;
mod stats;
mod use_target;
mod validate;
pub use crate::clause_kind::{
clause_is_ddl_command, clause_keyword, clause_mutates_store, clause_projects_rows,
};
pub use crate::expr_text::expr_text;
pub use crate::inline::{hit_is_inline_safe, plan_is_bounded_work, plan_references_auto_parameter};
pub use crate::names::{conditional_declared_columns, query_with_persistent_imports};
pub use crate::namespaces::{
admin_command_heads_statement, composed_show_current_user, composed_show_databases,
composed_show_disallowed_clause, is_database_admin_command, is_show_databases_with_next,
is_write, plan_calls_write_procedure, unsupported_system_clause_names,
};
pub use crate::order::{
apply_degree, apply_hop_bound, apply_path_degree, best_seek, endpoint_estimate,
seed_on_rel_start, seed_rows, walk_cost, where_conjuncts_of, Bound, Estimate, Hop, SeekPick,
};
pub use crate::order::{crossover_scan_rows, range_seek_gated};
pub use crate::plan::{
plan, plan_any_clause, plan_contains_dynamic_operands, plan_contains_in_transactions,
plan_has_bound_float_integer_site, plan_is_create_only, plan_missing_parameters,
plan_output_names, plan_output_names_expect, plan_parameter_names, plan_with_stats,
plan_with_tokens, query_any_clause, walk_plan_clauses, walk_plan_parts, walk_query_parts,
LogicalPlan,
};
pub use crate::query_type::{query_type, QueryType};
pub use crate::stats::{
ContainsCount, DegreeMoments, HeavyValue, KeyStats, NoPatternStats, PatternStats, Provenance,
RowEstimate,
};
pub use crate::validate::check_union_joiners;
#[cfg(test)]
pub(crate) fn plan_of(cypher: &str) -> LogicalPlan {
let ast =
relate_front::parse_cypher(cypher).unwrap_or_else(|error| panic!("{cypher}: {error}"));
plan(ast, &mut |_| false).unwrap_or_else(|error| panic!("{cypher}: {error}"))
}
#[cfg(test)]
pub(crate) fn part_error(query: &relate_ir::Query) -> String {
let [part] = query.parts.as_slice() else {
panic!("expected one part");
};
validate::validate_clauses_with_env(
&part.clauses,
validate::Scope::stage(binding::Env::new()),
validate::write::WriteHistory::empty(),
&mut |_| false,
)
.expect_err("the composition rule rejects this statement")
.to_string()
}
#[cfg(test)]
pub(crate) fn query_of(cypher: &str) -> relate_ir::Query {
relate_front::parse_and_lower(cypher).unwrap_or_else(|error| panic!("{cypher}: {error}"))
}
#[cfg(test)]
pub(crate) fn rejection(src: &str) -> String {
match relate_front::parse_and_lower(src) {
Ok(q) => plan(q, &mut |_| false).unwrap_err().to_string(),
Err(e) => e.to_string(),
}
}
#[cfg(test)]
mod tests;