Skip to content

Commit 83a6ef3

Browse files
committedMay 13, 2020
update tests to add tests for zstd
Updated tests to include test files for zstd compression. Originally created by @ldsands in JuliaIO#41 and available at https://github.com/JuliaIO/parquet-compatibility now.
1 parent e8d52f6 commit 83a6ef3

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
*.jl.*.cov
33
*.jl.mem
44
parquet-compatibility/
5+
julia-parquet-compatibility/
56
.vscode/settings.json

‎test/get_parcompat.jl

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ using Test
44
function get_parcompat(parcompat=joinpath(dirname(@__FILE__), "parquet-compatibility"))
55
# look for parquet-compatibility in test folder, clone to tempdir if not found
66
if !isdir(parcompat)
7-
parcompat = joinpath(dirname(@__FILE__), "parquet-compatibility")
87
run(`git clone https://github.com/Parquet/parquet-compatibility.git $parcompat`)
98
end
109
end
1110

11+
function get_juliaparcompat(juliaparcompat=joinpath(dirname(@__FILE__), "julia-parquet-compatibility"))
12+
# look for julia-parquet-compatibility in test folder, clone to tempdir if not found
13+
if !isdir(juliaparcompat)
14+
run(`git clone https://github.com/JuliaIO/parquet-compatibility.git $juliaparcompat`)
15+
end
16+
end
17+
1218
get_parcompat()
19+
get_juliaparcompat()

‎test/test_decode.jl

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Parquet
22
using Test
33

4-
function test_decode(file, parcompat=joinpath(dirname(@__FILE__), "parquet-compatibility"))
5-
p = ParFile(joinpath(parcompat, file))
4+
function test_decode(file)
5+
p = ParFile(file)
66
println("loaded $file")
77
@test isa(p.meta, Parquet.FileMetaData)
88

@@ -46,13 +46,23 @@ function test_decode(file, parcompat=joinpath(dirname(@__FILE__), "parquet-compa
4646
end
4747

4848
function test_decode_all_pages()
49+
testfolder = joinpath(@__DIR__, "parquet-compatibility")
4950
for encformat in ("SNAPPY", "GZIP", "NONE")
5051
for fname in ("nation", "customer")
51-
test_decode("parquet-testdata/impala/1.1.1-$encformat/$fname.impala.parquet")
52+
testfile = joinpath(testfolder, "parquet-testdata", "impala", "1.1.1-$encformat", "$fname.impala.parquet")
53+
test_decode(testfile)
5254
end
5355
end
56+
57+
testfolder = joinpath(@__DIR__, "julia-parquet-compatibility")
58+
for encformat in ("ZSTD", "SNAPPY", "GZIP", "NONE")
59+
for fname in ("nation", "customer")
60+
testfile = joinpath(testfolder, "Parquet_Files", "$(encformat)_pandas_pyarrow_$(fname).parquet")
61+
test_decode(testfile)
62+
end
63+
end
64+
65+
test_decode(joinpath(@__DIR__, "missingvalues", "synthetic_data.parquet"))
5466
end
5567

5668
test_decode_all_pages()
57-
58-
test_decode("synthetic_data.parquet", "missingvalues")

‎test/test_load.jl

+17-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using Parquet
22
using Test
33
using Dates
44

5-
function test_load(file, parcompat=joinpath(dirname(@__FILE__), "parquet-compatibility"))
6-
p = ParFile(joinpath(parcompat, file))
5+
function test_load(file::String)
6+
p = ParFile(file)
77
println("loaded $file")
88
@test isa(p.meta, Parquet.FileMetaData)
99

@@ -47,8 +47,8 @@ function print_names(indent, t)
4747
end
4848
end
4949

50-
function test_schema(file, schema_name::Symbol, parcompat=joinpath(dirname(@__FILE__), "parquet-compatibility"))
51-
p = ParFile(joinpath(parcompat, file))
50+
function test_schema(file, schema_name::Symbol)
51+
p = ParFile(file)
5252
println("loaded $file")
5353

5454
#mod_name = string(schema_name) * "Module"
@@ -77,10 +77,21 @@ function test_schema(file, schema_name::Symbol, parcompat=joinpath(dirname(@__F
7777
end
7878

7979
function test_load_all_pages()
80+
testfolder = joinpath(@__DIR__, "parquet-compatibility")
8081
for encformat in ("SNAPPY", "GZIP", "NONE")
8182
for fname in ("nation", "customer")
82-
test_load("parquet-testdata/impala/1.1.1-$encformat/$fname.impala.parquet")
83-
test_schema("parquet-testdata/impala/1.1.1-$encformat/$fname.impala.parquet", Symbol(fname * "_" * encformat))
83+
testfile = joinpath(testfolder, "parquet-testdata", "impala", "1.1.1-$encformat", "$fname.impala.parquet")
84+
test_load(testfile)
85+
test_schema(testfile, Symbol(fname * "_" * encformat))
86+
end
87+
end
88+
89+
testfolder = joinpath(@__DIR__, "julia-parquet-compatibility")
90+
for encformat in ("ZSTD", "SNAPPY", "GZIP", "NONE")
91+
for fname in ("nation", "customer")
92+
testfile = joinpath(testfolder, "Parquet_Files", "$(encformat)_pandas_pyarrow_$(fname).parquet")
93+
test_load(testfile)
94+
test_schema(testfile, Symbol(fname * "_jl_" * encformat))
8495
end
8596
end
8697
end

0 commit comments

Comments
 (0)
Please sign in to comment.