-
Notifications
You must be signed in to change notification settings - Fork 53
/
parquet_test.go
67 lines (57 loc) · 1.91 KB
/
parquet_test.go
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
package goparquet
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func TestParquetTesting(t *testing.T) {
testingRoot := os.Getenv("PARQUET_TESTING_ROOT") // path where https://github.com/apache/parquet-testing has been cloned to.
if testingRoot == "" {
t.Skip("PARQUET_TESTING_ROOT not set, skipping test")
}
testFiles := []string{
"data/alltypes_dictionary.parquet",
"data/alltypes_plain.parquet",
"data/alltypes_plain.snappy.parquet",
"data/binary.parquet",
"data/byte_array_decimal.parquet",
"data/datapage_v2.snappy.parquet",
"data/delta_binary_packed.parquet",
//"data/delta_byte_array.parquet",
"data/delta_encoding_optional_column.parquet",
"data/delta_encoding_required_column.parquet",
// "data/dict-page-offset-zero.parquet",
"data/fixed_length_decimal.parquet",
"data/fixed_length_decimal_legacy.parquet",
// "data/hadoop_lz4_compressed.parquet", // LZ4 is currently unsupported out of the box.
// "data/hadoop_lz4_compressed_larger.parquet",
"data/int32_decimal.parquet",
"data/int64_decimal.parquet",
"data/list_columns.parquet",
"data/nested_lists.snappy.parquet",
"data/nested_maps.snappy.parquet",
// "data/nested_structs.rust.parquet", // uses ZSTD which is currently unsupported out of the box.
"data/nonnullable.impala.parquet",
"data/nullable.impala.parquet",
"data/nulls.snappy.parquet",
"data/repeated_no_annotation.parquet",
}
for _, file := range testFiles {
t.Run(file, func(t *testing.T) {
fullPath := filepath.Join(testingRoot, file)
f, err := os.Open(fullPath)
require.NoError(t, err)
defer f.Close()
r, err := NewFileReader(f)
require.NoError(t, err)
numRows := r.NumRows()
t.Logf("%s: got %d rows", file, numRows)
t.Logf("%s: schema = %s", file, r.GetSchemaDefinition().String())
for i := int64(0); i < numRows; i++ {
_, err := r.NextRow()
require.NoError(t, err)
}
})
}
}