MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / handle_define

Function handle_define

src/expr-parser/src/command.rs:16–28  ·  view source on GitHub ↗
(catalog: &mut TestCatalog, input: &str)

Source from the content-addressed store, hash-verified

14use crate::{Def, TestCatalog, try_parse_def, try_parse_mir};
15
16pub fn handle_define(catalog: &mut TestCatalog, input: &str) -> String {
17 // Parse the relation, returning early on parse error.
18 let result = match try_parse_def(catalog, input) {
19 Ok(def) => match def {
20 Def::Source { name, cols, typ } => match catalog.insert(&name, cols, typ, true) {
21 Ok(id) => format!("Source defined as {id}"),
22 Err(err) => err,
23 },
24 },
25 Err(err) => err,
26 };
27 result + "\n"
28}
29
30pub fn handle_roundtrip(catalog: &TestCatalog, input: &str) -> String {
31 let output = match try_parse_mir(catalog, input) {

Callers 2

run_roundtrip_testsFunction · 0.85
run_testsFunction · 0.85

Calls 2

try_parse_defFunction · 0.85
insertMethod · 0.45

Tested by 2

run_roundtrip_testsFunction · 0.68
run_testsFunction · 0.68