Use lisp-case for sexpression names

This commit is contained in:
Dan Spencer 2015-04-15 14:34:49 -06:00
parent 5fb3556641
commit 10d2b5002f
2 changed files with 10 additions and 10 deletions

View File

@ -145,14 +145,14 @@ To get the query execution plan for a query, prepend the query with the `EXPLAIN
EXPLAIN SELECT name, age FROM person WHERE age >= 18;
```
```lisp
(scan `person` :source_id 0
(scan `person` :source-id 0
(if
(>=
(column-field :source_id 0 :column_offset 2)
(column-field :source-id 0 :column-offset 2)
18)
(yield
(column-field :source_id 0 :column_offset 1)
(column-field :source_id 0 :column_offset 2))))
(column-field :source-id 0 :column-offset 1)
(column-field :source-id 0 :column-offset 2))))
```
The above syntax more or less matches the query plan's internal data structure.

View File

@ -73,19 +73,19 @@ where <DB as DatabaseInfo>::Table: 'a
match self {
&SExpression::Scan { table, source_id, ref yield_fn } => {
try!(writeln!(f, "(scan `{}` :source_id {}", table.get_name(), source_id));
try!(writeln!(f, "(scan `{}` :source-id {}", table.get_name(), source_id));
try!(yield_fn.format(f, indent + 1));
write!(f, ")")
},
&SExpression::Map { source_id, ref yield_in_fn, ref yield_out_fn } => {
try!(writeln!(f, "(map :source_id {}", source_id));
try!(writeln!(f, "(map :source-id {}", source_id));
try!(yield_in_fn.format(f, indent + 1));
try!(writeln!(f, ""));
try!(yield_out_fn.format(f, indent + 1));
write!(f, ")")
},
&SExpression::TempGroupBy { source_id, ref yield_in_fn, ref group_by_values, ref yield_out_fn } => {
try!(writeln!(f, "(temp-group-by :source_id {}", source_id));
try!(writeln!(f, "(temp-group-by :source-id {}", source_id));
try!(yield_in_fn.format(f, indent + 1));
try!(writeln!(f, ""));
write_indent!(indent+1);
@ -107,7 +107,7 @@ where <DB as DatabaseInfo>::Table: 'a
write!(f, ")")
},
&SExpression::ColumnField { source_id, column_offset } => {
write!(f, "(column-field :source_id {} :column_offset {})", source_id, column_offset)
write!(f, "(column-field :source-id {} :column-offset {})", source_id, column_offset)
},
&SExpression::If { ref predicate, ref yield_fn } => {
try!(writeln!(f, "(if "));
@ -124,12 +124,12 @@ where <DB as DatabaseInfo>::Table: 'a
write!(f, ")")
},
&SExpression::AggregateOp { ref op, source_id, ref value } => {
try!(writeln!(f, "({} :source_id {} ", op.name(), source_id));
try!(writeln!(f, "({} :source-id {} ", op.name(), source_id));
try!(value.format(f, indent + 1));
write!(f, ")")
},
&SExpression::CountAll { source_id } => {
write!(f, "(count-all :source_id {})", source_id)
write!(f, "(count-all :source-id {})", source_id)
},
&SExpression::Value(ref v) => {
write!(f, "{}", v)