Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
- [has_error](super-sql/functions/errors/has_error.md)
- [is_error](super-sql/functions/errors/is_error.md)
- [missing](super-sql/functions/errors/missing.md)
- [quiet](super-sql/functions/errors/quiet.md)
- [Generics](super-sql/functions/generics/intro.md)
- [coalesce](super-sql/functions/generics/coalesce.md)
- [compare](super-sql/functions/generics/compare.md)
Expand Down
57 changes: 0 additions & 57 deletions book/src/super-sql/functions/errors/quiet.md

This file was deleted.

2 changes: 1 addition & 1 deletion book/src/super-sql/functions/generics/coalesce.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ values coalesce(null, error("missing"), error({x:"foo"}), this)
# spq
values coalesce(null, error({x:"foo"}), this)
# input
error("quiet")
error("bar")
# expected output
null
```
15 changes: 0 additions & 15 deletions book/src/super-sql/functions/types/nameof.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,3 @@ type port=int16
"port"
error("missing")
```

---

_The missing value can be ignored with quiet_

```mdtest-spq
# spq
values quiet(nameof(this))
# input
type port=int16
80::port
80
# expected output
"port"
```
15 changes: 0 additions & 15 deletions book/src/super-sql/operators/cut.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ simple field references, the _cut_ operation resembles the Unix shell command, e
```
... | cut a,c | ...
```
If an expression results in `error("quiet")`, the corresponding field is omitted
from the output. This allows you to wrap expressions in a `quiet()` function
to filter out missing errors.

If an input value to cut is not a record, then cut still operates as defined
resulting in `error("missing")` for expressions that reference fields of `this`.
Expand Down Expand Up @@ -74,18 +71,6 @@ cut a,d

---

_The missing fields can be ignored with quiet_
```mdtest-spq
# spq
cut a:=quiet(a),d:=quiet(d)
# input
{a:1,b:2,c:3}
# expected output
{a:1}
```

---

_Non-record values generate missing errors for fields not present in a non-record `this`_
```mdtest-spq {data-layout="stacked"}
# spq
Expand Down
26 changes: 1 addition & 25 deletions book/src/super-sql/types/error.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ but having a first-class data type to manage them all while allowing them to
peacefully coexist with valid production data is a novel and
useful approach that SuperSQL enables.

## Missing and Quiet
## Missing

SuperDB's heterogeneous data model allows for queries
that operate over different types of data whose structure and type
Expand Down Expand Up @@ -146,16 +146,6 @@ values x
error("missing")
```

Sometimes you want missing errors to show up and sometimes you don't.
The [`quiet`](../functions/errors/quiet.md) function transforms missing errors into
"quiet errors". A quiet error is the value `error("quiet")` and is ignored
by most operators, in particular,
[`values`](../operators/values.md), e.g.,
```
values error("quiet")
```
produces no output.

## Examples

---
Expand Down Expand Up @@ -205,20 +195,6 @@ typeof(1/this)

---

_The `quiet` function suppresses error values_

```mdtest-spq
# spq
values quiet(x)
# input
{x:1}
{y:2}
# expected output
1
```

---

_Coalesce replaces `error("missing")` values with a default value_

```mdtest-spq
Expand Down
11 changes: 0 additions & 11 deletions book/src/tutorials/jq.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,17 +378,6 @@ produces
{val:1}
{val:error("missing")}
```
Sometimes you expect "missing" errors to occur sporadically and just want
to ignore them, which can you easily do with the
[quiet](../super-sql/functions/errors/quiet.md) function, e.g.,
```mdtest-command
echo '{s:"foo", val:1}{s:"bar"}' | super -s -c 'cut quiet(val)' -
```
produces
```mdtest-output
{val:1}
{}
```

### Union Types

Expand Down
4 changes: 2 additions & 2 deletions compiler/parser/ztests/unnest-expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script: |
echo === expression
super compile -C 'values (unnest a | ?b)'
echo === function
super compile -C 'quiet((unnest a | ?b))'
super compile -C 'typeof((unnest a | ?b))'
echo === grep
super compile -C 'grep("regexp", (unnest a | ?b))'

Expand All @@ -30,7 +30,7 @@ outputs:
| search b
)
=== function
quiet((
typeof((
unnest a
| search b
))
Expand Down
2 changes: 0 additions & 2 deletions compiler/rungen/vop.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (b *Builder) compileVamLeaf(o dag.Op, parent vio.Puller) (vio.Puller, error
if err != nil {
return nil, err
}
e = vamexpr.NewDequiet(b.sctx(), e)
return vamop.NewValues(b.sctx(), parent, []vamexpr.Evaluator{e}), nil
case *dag.DebugOp:
e, err := b.compileVamExpr(o.Expr)
Expand Down Expand Up @@ -268,7 +267,6 @@ func (b *Builder) compileVamLeaf(o dag.Op, parent vio.Puller) (vio.Puller, error
if err != nil {
return nil, err
}
e = vamexpr.NewDequiet(b.sctx(), e)
putter := vamexpr.NewPutter(b.sctx(), e)
return vamop.NewValues(b.sctx(), parent, []vamexpr.Evaluator{putter}), nil
case *dag.RenameOp:
Expand Down
11 changes: 4 additions & 7 deletions compiler/semantic/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,14 +1008,11 @@ func deriveNameFromExpr(e ast.Expr) string {
case *ast.AggFuncExpr:
return e.Name
case *ast.CallExpr:
var name string
if f, ok := e.Func.(*ast.FuncNameExpr); ok {
name = f.Name
}
if strings.ToLower(name) == "quiet" && len(e.Args) > 0 {
return deriveNameFromExpr(e.Args[0])
f, ok := e.Func.(*ast.FuncNameExpr)
if !ok {
return ""
}
return name
return f.Name
case *ast.BinaryExpr:
if name, ok := dottedName(e); ok {
return name
Expand Down
10 changes: 0 additions & 10 deletions compiler/ztests/implied-quiet-assignment.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions complex.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var ErrMissing = errors.New("missing")
// each operator has clearly defined semantics with respect to the Missing value.
// For example, "true AND MISSING" is MISSING.
var Missing = scode.Bytes("missing")
var Quiet = scode.Bytes("quiet")

type TypeError struct {
id int
Expand All @@ -62,10 +61,6 @@ func (t *TypeError) IsMissing(zv scode.Bytes) bool {
return t.Type == TypeString && bytes.Equal(zv, Missing)
}

func (t *TypeError) IsQuiet(zv scode.Bytes) bool {
return t.Type == TypeString && bytes.Equal(zv, Quiet)
}

type TypeEnum struct {
id int
Symbols []string
Expand Down
6 changes: 0 additions & 6 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,6 @@ func (c *Context) Missing() Value {
return NewValue(c.StringTypeError(), Missing)
}

func (c *Context) Quiet() Value {
return NewValue(c.StringTypeError(), Quiet)
}

// batch/allocator should handle these?

func (c *Context) NewErrorf(format string, args ...any) Value {
return NewValue(c.StringTypeError(), fmt.Appendf(nil, format, args...))
}
Expand Down
25 changes: 25 additions & 0 deletions f.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SELECT *
from
values
(10,'a0'),
(15,'a8'),
(20,'a1'),
(25,'a7'),
(30,'a2'),
(35,'a6'),
(40,'a3'),
(45,'a5'),
(50,'a4'),
(null,'a_null')
l (a,sa)
left join
values
(20,'b20.1'),
(20,'b20.2'),
(40,'b40'),
(40,'b40.2'),
(60,'b60'),
(null,'b_null')
r (b,sb)
on l.a = r.b
order by a
Binary file added o1.csup
Binary file not shown.
Binary file added o2.csup
Binary file not shown.
5 changes: 1 addition & 4 deletions runtime/sam/expr/agg.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@ func (a *Aggregator) Apply(sctx *super.Context, f agg.Function, this super.Value
return
}
}
v := a.expr.Eval(this)
if !v.IsQuiet() {
f.Consume(v)
}
f.Consume(a.expr.Eval(this))
}
66 changes: 0 additions & 66 deletions runtime/sam/expr/dequiet.go

This file was deleted.

3 changes: 0 additions & 3 deletions runtime/sam/expr/dropper.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ func (d *Dropper) Eval(in super.Value) super.Value {
if dropType == typ {
return in
}
if dropType == d.emptyType {
return d.sctx.Quiet()
}
b := &d.builder
b.Reset()
d.recode(b, typ, in.Bytes(), dropType, d.dropMap)
Expand Down
Loading
Loading