Repository navigation
Expand file tree
/
Copy pathgolden_test.go
More file actions
417 lines (410 loc) · 16.2 KB
/
Copy pathgolden_test.go
File metadata and controls
417 lines (410 loc) · 16.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
package columns
import (
"bytes"
"reflect"
"testing"
)
// goldenFile is the bytes of a three row group, thirteen column write, captured
// from the round trip test's inputs. It pins the file the writer produces for a
// known set of values, so a change to the layout on disk has to be deliberate.
//
// The columns are written with the layout their type implies: no Optimize pass
// has read them, so the golden file is also what a caller gets for doing
// nothing. Chunks are unchanged by the tokenized column format; the footer
// carries the tokenizer index a column names, which is zero for every column
// here, so a reader built before that field reads this file the same way.
var goldenFile = []byte{
65, 66, 67, 68, 1, 2, 0, 1, 0, 0, 0, 1,
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 1, 0, 0, 0, 9, 96, 3, 0, 0,
0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 1,
0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 3, 0, 1, 0, 0, 0, 24, 0, 0,
0, 24, 0, 0, 0, 1, 0, 0, 0, 24, 0, 0,
0, 24, 0, 0, 0, 9, 1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
40, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0,
40, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
3, 0, 1, 0, 0, 0, 24, 0, 0, 0, 24, 0,
0, 0, 1, 0, 0, 0, 24, 0, 0, 0, 24, 0,
0, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 3, 0, 0, 0, 0, 0, 40, 0, 0,
0, 40, 0, 0, 0, 1, 0, 0, 0, 40, 0, 0,
0, 40, 0, 0, 0, 0, 0, 0, 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89, 64, 0, 0, 0, 0, 0, 80, 89, 64, 0, 0,
0, 0, 0, 208, 89, 64, 0, 0, 0, 0, 0, 16,
90, 64, 1, 0, 0, 0, 0, 0, 35, 0, 0, 0,
35, 0, 0, 0, 1, 0, 0, 0, 35, 0, 0, 0,
35, 0, 0, 0, 3, 0, 0, 0, 100, 101, 102, 3,
0, 0, 0, 101, 102, 103, 3, 0, 0, 0, 102, 103,
104, 3, 0, 0, 0, 103, 104, 105, 3, 0, 0, 0,
104, 105, 106, 1, 0, 1, 0, 0, 0, 36, 0, 0,
0, 36, 0, 0, 0, 1, 0, 0, 0, 36, 0, 0,
0, 36, 0, 0, 0, 4, 5, 0, 0, 0, 118, 45,
49, 45, 48, 5, 0, 0, 0, 118, 45, 49, 45, 49,
5, 0, 0, 0, 118, 45, 49, 45, 51, 5, 0, 0,
0, 118, 45, 49, 45, 52, 2, 0, 1, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 18, 192, 3, 0,
0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0,
1, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0,
200, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 24, 0,
0, 0, 24, 0, 0, 0, 1, 0, 0, 0, 24, 0,
0, 0, 24, 0, 0, 0, 18, 200, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 40, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0,
0, 40, 0, 0, 0, 40, 0, 0, 0, 200, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0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 67,
0, 128, 75, 67, 0, 128, 76, 67, 1, 0, 1, 0,
0, 0, 24, 0, 0, 0, 24, 0, 0, 0, 1, 0,
0, 0, 24, 0, 0, 0, 24, 0, 0, 0, 18, 0,
0, 0, 0, 0, 8, 105, 64, 0, 0, 0, 0, 0,
72, 105, 64, 0, 0, 0, 0, 0, 104, 105, 64, 1,
0, 0, 0, 0, 0, 35, 0, 0, 0, 35, 0, 0,
0, 1, 0, 0, 0, 35, 0, 0, 0, 35, 0, 0,
0, 3, 0, 0, 0, 200, 201, 202, 3, 0, 0, 0,
201, 202, 203, 3, 0, 0, 0, 202, 203, 204, 3, 0,
0, 0, 203, 204, 205, 3, 0, 0, 0, 204, 205, 206,
1, 0, 1, 0, 0, 0, 27, 0, 0, 0, 27, 0,
0, 0, 1, 0, 0, 0, 27, 0, 0, 0, 27, 0,
0, 0, 18, 5, 0, 0, 0, 118, 45, 50, 45, 48,
5, 0, 0, 0, 118, 45, 50, 45, 50, 5, 0, 0,
0, 118, 45, 50, 45, 51, 46, 127, 3, 1, 1, 6,
70, 111, 111, 116, 101, 114, 1, 255, 128, 0, 1, 2,
1, 6, 83, 99, 104, 101, 109, 97, 1, 255, 132, 0,
1, 9, 82, 111, 119, 71, 114, 111, 117, 112, 115, 1,
255, 140, 0, 0, 0, 37, 255, 131, 2, 1, 1, 22,
91, 93, 99, 111, 108, 117, 109, 110, 115, 46, 67, 111,
108, 117, 109, 110, 83, 99, 104, 101, 109, 97, 1, 255,
132, 0, 1, 255, 130, 0, 0, 57, 255, 129, 3, 1,
1, 12, 67, 111, 108, 117, 109, 110, 83, 99, 104, 101,
109, 97, 1, 255, 130, 0, 1, 3, 1, 4, 78, 97,
109, 101, 1, 12, 0, 1, 4, 84, 121, 112, 101, 1,
6, 0, 1, 8, 78, 117, 108, 108, 97, 98, 108, 101,
1, 2, 0, 0, 0, 37, 255, 139, 2, 1, 1, 22,
91, 93, 99, 111, 108, 117, 109, 110, 115, 46, 82, 111,
119, 71, 114, 111, 117, 112, 77, 101, 116, 97, 1, 255,
140, 0, 1, 255, 134, 0, 0, 66, 255, 133, 3, 1,
1, 12, 82, 111, 119, 71, 114, 111, 117, 112, 77, 101,
116, 97, 1, 255, 134, 0, 1, 3, 1, 7, 78, 117,
109, 82, 111, 119, 115, 1, 6, 0, 1, 10, 66, 121,
116, 101, 79, 102, 102, 115, 101, 116, 1, 4, 0, 1,
7, 67, 111, 108, 117, 109, 110, 115, 1, 255, 138, 0,
0, 0, 32, 255, 137, 2, 1, 1, 17, 91, 93, 99,
111, 108, 117, 109, 110, 115, 46, 67, 111, 108, 77, 101,
116, 97, 1, 255, 138, 0, 1, 255, 136, 0, 0, 255,
134, 255, 135, 3, 1, 1, 7, 67, 111, 108, 77, 101,
116, 97, 1, 255, 136, 0, 1, 9, 1, 10, 66, 121,
116, 101, 76, 101, 110, 103, 116, 104, 1, 4, 0, 1,
9, 78, 117, 108, 108, 67, 111, 117, 110, 116, 1, 6,
0, 1, 6, 77, 105, 110, 86, 97, 108, 1, 10, 0,
1, 6, 77, 97, 120, 86, 97, 108, 1, 10, 0, 1,
6, 77, 105, 110, 76, 101, 110, 1, 6, 0, 1, 6,
77, 97, 120, 76, 101, 110, 1, 6, 0, 1, 8, 69,
110, 99, 111, 100, 105, 110, 103, 1, 6, 0, 1, 8,
67, 111, 109, 112, 114, 101, 115, 115, 1, 6, 0, 1,
9, 84, 111, 107, 101, 110, 105, 122, 101, 114, 1, 4,
0, 0, 0, 254, 4, 39, 255, 128, 1, 13, 1, 6,
99, 111, 108, 48, 95, 49, 1, 1, 1, 1, 0, 1,
6, 99, 111, 108, 49, 95, 50, 1, 2, 0, 1, 6,
99, 111, 108, 50, 95, 51, 1, 3, 1, 1, 0, 1,
6, 99, 111, 108, 51, 95, 52, 1, 4, 0, 1, 6,
99, 111, 108, 52, 95, 53, 1, 5, 1, 1, 0, 1,
6, 99, 111, 108, 53, 95, 54, 1, 6, 0, 1, 6,
99, 111, 108, 54, 95, 55, 1, 7, 1, 1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 3, 4, 5, 6, 1, 3, 1, 3, 1,
1, 0, 1, 108, 1, 2, 1, 5, 118, 45, 48, 45,
49, 1, 5, 118, 45, 48, 45, 52, 1, 5, 1, 5,
1, 1, 0, 0, 1, 5, 1, 254, 5, 146, 1, 13,
1, 56, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 2, 0, 1, 255, 132, 2, 1, 100, 1,
1, 104, 1, 1, 1, 1, 1, 3, 0, 1, 118, 1,
1, 1, 2, 100, 0, 1, 2, 104, 0, 1, 2, 1,
2, 1, 3, 0, 1, 255, 132, 2, 4, 100, 0, 0,
0, 1, 4, 104, 0, 0, 0, 1, 4, 1, 4, 1,
3, 0, 1, 118, 1, 1, 1, 8, 100, 0, 0, 0,
0, 0, 0, 0, 1, 8, 104, 0, 0, 0, 0, 0,
0, 0, 1, 8, 1, 8, 1, 3, 0, 1, 255, 132,
2, 1, 100, 1, 1, 104, 1, 1, 1, 1, 1, 3,
0, 1, 118, 1, 1, 1, 2, 100, 0, 1, 2, 104,
0, 1, 2, 1, 2, 1, 3, 0, 1, 255, 132, 2,
4, 101, 0, 0, 0, 1, 4, 105, 0, 0, 0, 1,
4, 1, 4, 1, 3, 0, 1, 118, 1, 1, 1, 8,
101, 0, 0, 0, 0, 0, 0, 0, 1, 8, 105, 0,
0, 0, 0, 0, 0, 0, 1, 8, 1, 8, 1, 3,
0, 1, 92, 2, 4, 0, 0, 201, 66, 1, 4, 0,
0, 209, 66, 1, 4, 1, 4, 1, 1, 0, 1, 118,
1, 1, 1, 8, 0, 0, 0, 0, 0, 16, 89, 64,
1, 8, 0, 0, 0, 0, 0, 16, 90, 64, 1, 8,
1, 8, 1, 1, 0, 1, 122, 2, 3, 100, 101, 102,
1, 3, 104, 105, 106, 1, 3, 1, 3, 1, 1, 0,
1, 126, 1, 1, 1, 5, 118, 45, 49, 45, 48, 1,
5, 118, 45, 49, 45, 52, 1, 5, 1, 5, 1, 1,
0, 0, 1, 5, 1, 254, 11, 124, 1, 13, 1, 56,
1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
1, 2, 0, 1, 255, 132, 2, 1, 200, 1, 1, 204,
1, 1, 1, 1, 1, 3, 0, 1, 102, 1, 2, 1,
2, 200, 0, 1, 2, 203, 0, 1, 2, 1, 2, 1,
3, 0, 1, 255, 132, 2, 4, 200, 0, 0, 0, 1,
4, 204, 0, 0, 0, 1, 4, 1, 4, 1, 3, 0,
1, 102, 1, 2, 1, 8, 200, 0, 0, 0, 0, 0,
0, 0, 1, 8, 203, 0, 0, 0, 0, 0, 0, 0,
1, 8, 1, 8, 1, 3, 0, 1, 255, 132, 2, 1,
200, 1, 1, 204, 1, 1, 1, 1, 1, 3, 0, 1,
102, 1, 2, 1, 2, 200, 0, 1, 2, 203, 0, 1,
2, 1, 2, 1, 3, 0, 1, 255, 132, 2, 4, 201,
0, 0, 0, 1, 4, 205, 0, 0, 0, 1, 4, 1,
4, 1, 3, 0, 1, 102, 1, 2, 1, 8, 201, 0,
0, 0, 0, 0, 0, 0, 1, 8, 204, 0, 0, 0,
0, 0, 0, 0, 1, 8, 1, 8, 1, 3, 0, 1,
92, 2, 4, 0, 128, 72, 67, 1, 4, 0, 128, 76,
67, 1, 4, 1, 4, 1, 1, 0, 1, 102, 1, 2,
1, 8, 0, 0, 0, 0, 0, 8, 105, 64, 1, 8,
0, 0, 0, 0, 0, 104, 105, 64, 1, 8, 1, 8,
1, 1, 0, 1, 122, 2, 3, 200, 201, 202, 1, 3,
204, 205, 206, 1, 3, 1, 3, 1, 1, 0, 1, 108,
1, 2, 1, 5, 118, 45, 50, 45, 48, 1, 5, 118,
45, 50, 45, 51, 1, 5, 1, 5, 1, 1, 0, 0,
0, 203, 5, 0, 0, 65, 66, 67, 68,
}
// The writer must be byte stable, so the file it produces for a known set of
// inputs is pinned here. The golden bytes are the round trip test's three row
// groups and thirteen typed columns, stored the way their types imply. The inputs
// are deterministic, so the comparison is exact rather than statistical.
//
// The columns are written with compression off. Go does not promise that
// compress/flate's encoded output stays the same between releases — the 1.27
// notes say it may differ from 1.26 — so a golden that stored a compressed column
// would be pinning the toolchain it was generated on rather than this format, and
// would stop opening under the next Go. Uncompressed, every byte in the file is
// this package's own: the encodings, the block framing and the gob footer. What
// compression does to a column is pinned by the round trip, which reads back what
// the writer earned rather than the bytes it happened to produce.
func TestWriterOutputUnchanged(t *testing.T) {
var buf bytes.Buffer
w := NewWriterWithOptions(&buf, buildSchema(), Options{Compress: CompressNone})
for g := 0; g < 3; g++ {
if err := w.AddRowGroup(buildColumns(g)); err != nil {
t.Fatalf("AddRowGroup(%d): %v", g, err)
}
}
if err := w.Close(); err != nil {
t.Fatalf("Close: %v", err)
}
golden := goldenFile
if !bytes.Equal(buf.Bytes(), golden) {
t.Fatalf("writer output changed: wrote %d bytes, golden is %d bytes",
buf.Len(), len(golden))
}
// Reproducing the bytes only proves the writer still writes what it wrote.
// The golden also has to be a file a reader opens, and its contents have to
// be the ones it was captured from, or a regeneration that drifted from
// buildColumns would pin a plausible set of bytes for the wrong values.
r, err := NewReader(bytes.NewReader(golden))
if err != nil {
t.Fatalf("NewReader(golden): %v", err)
}
if got, want := r.RowGroupCount(), 3; got != want {
t.Fatalf("golden has %d row groups, want %d", got, want)
}
all := make([]int, len(allTypes))
for i := range all {
all[i] = i
}
for g := 0; g < 3; g++ {
want := buildColumns(g)
got, err := r.ReadRowGroup(g, all)
if err != nil {
t.Fatalf("ReadRowGroup(%d, all): %v", g, err)
}
for c := range want {
if !reflect.DeepEqual(got[c], want[c]) {
t.Errorf("golden row group %d column %d: got %v, want %v",
g, c, got[c], want[c])
}
}
}
}
// TestWriterDeterministic guards the tiebreak in BenchmarkLayouts, which Optimize
// picks a layout on. Two candidates that compress to the same size used to be
// ordered by measured decode time, which varies run to run. The same columns
// could then pick different layouts and write a different file.
func TestWriterDeterministic(t *testing.T) {
write := func() []byte {
var buf bytes.Buffer
w := NewWriter(&buf, buildSchema())
for g := 0; g < 3; g++ {
if err := w.AddRowGroup(buildColumns(g)); err != nil {
t.Fatalf("AddRowGroup(%d): %v", g, err)
}
}
if err := w.Close(); err != nil {
t.Fatalf("Close: %v", err)
}
return buf.Bytes()
}
first := write()
for i := 0; i < 5; i++ {
if got := write(); !bytes.Equal(got, first) {
j := 0
for j < len(first) && j < len(got) && first[j] == got[j] {
j++
}
t.Fatalf("repeat %d wrote a different file, first differing byte at %d", i+1, j)
}
}
}