File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
book/src/super-sql/operators Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ This operator is most often used with [`cut`](cut.md) and [`sort`](sort.md) to f
1717duplicate values.
1818
1919When run with the ` -c ` option, each value is output as a record with the
20- type signature ` {value:any,count:uint64 } ` , where the ` value ` field contains the
20+ type signature ` {value:any,count:int64 } ` , where the ` value ` field contains the
2121unique value and the ` count ` field indicates the number of consecutive duplicates
2222that occurred in the input for that output value.
2323
@@ -52,9 +52,9 @@ uniq -c
52522
53533
5454# expected output
55- {value:1,count:1::uint64 }
56- {value:2,count:2::uint64 }
57- {value:3,count:1::uint64 }
55+ {value:1,count:1}
56+ {value:2,count:2}
57+ {value:3,count:1}
5858```
5959
6060---
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ type Op struct {
1414 parent sbuf.Puller
1515 builder scode.Builder
1616 cflag bool
17- count uint64
17+ count int64
1818 last * super.Value
1919 eos bool
2020}
@@ -31,10 +31,10 @@ func (o *Op) wrap(t *super.Value) super.Value {
3131 if o .cflag {
3232 o .builder .Reset ()
3333 o .builder .Append (t .Bytes ())
34- o .builder .Append (super .EncodeUint (o .count ))
34+ o .builder .Append (super .EncodeInt (o .count ))
3535 typ := o .rctx .Sctx .MustLookupTypeRecord ([]super.Field {
3636 super .NewField ("value" , t .Type ()),
37- super .NewField ("count" , super .TypeUint64 ),
37+ super .NewField ("count" , super .TypeInt64 ),
3838 })
3939 return super .NewValue (typ , o .builder .Bytes ()).Copy ()
4040 }
Original file line number Diff line number Diff line change 88 {x:1}
99
1010output : |
11- {value:1,count:2::uint64 }
12- {value:{x:1},count:1::uint64 }
11+ {value:1,count:2}
12+ {value:{x:1},count:1}
You can’t perform that action at this time.
0 commit comments