More tests

This commit is contained in:
Colin Dellow 2018-03-07 20:30:25 -05:00
parent 35fcde926c
commit 2d616c54fb
7 changed files with 326 additions and 1 deletions

View File

@ -34,7 +34,7 @@ COPY nulls FROM '$here/nulls.csv';
CREATE OR REPLACE FUNCTION quote(TEXT) RETURNS TEXT AS \$\$ CREATE OR REPLACE FUNCTION quote(TEXT) RETURNS TEXT AS \$\$
BEGIN BEGIN
RETURN \$1; RETURN CASE WHEN \$1 IS NULL THEN 'NULL' ELSE \$1 END;
END; END;
\$\$ LANGUAGE 'plpgsql' IMMUTABLE; \$\$ LANGUAGE 'plpgsql' IMMUTABLE;

10
tests/create-query Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
query=${1:?must provide query}
echo "$query"
psql parquet postgres <<EOF
COPY ($query) TO STDOUT WITH (DELIMITER '|', NULL '');
EOF

View File

@ -0,0 +1,11 @@
select rowid % 10, count(*) from nulls group by 1 order by 1
0|10
1|10
2|10
3|10
4|10
5|10
6|10
7|10
8|10
9|10

View File

@ -0,0 +1,101 @@
select string_7 from no_nulls1 order by string_7
0
1
10
11
12
13
14
15
16
17
18
19
2
20
21
22
23
24
25
26
27
28
29
3
30
31
32
33
34
35
36
37
38
39
4
40
41
42
43
44
45
46
47
48
49
5
50
51
52
53
54
55
56
57
58
59
6
60
61
62
63
64
65
66
67
68
69
7
70
71
72
73
74
75
76
77
78
79
8
80
81
82
83
84
85
86
87
88
89
9
90
91
92
93
94
95
96
97
98
99

View File

@ -0,0 +1,101 @@
select string_8 from no_nulls1 order by string_8
000
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099

View File

@ -0,0 +1,51 @@
select rowid, bool_0, quote(binary_10) from nulls where string_7 is null
10||NULL
11||NULL
12||NULL
13||NULL
14||NULL
15||NULL
16||NULL
17||NULL
18||NULL
19||NULL
21|0|X'15'
23|0|X'17'
25|0|X'19'
27|0|X'1B'
29|0|X'1D'
31|0|X'1F'
33|0|X'21'
35|0|X'23'
37|0|X'25'
39|0|X'27'
41|0|X'29'
43|0|X'2B'
45|0|X'2D'
47|0|X'2F'
49|0|X'31'
51|0|X'33'
53|0|X'35'
55|0|X'37'
57|0|X'39'
59|0|X'3B'
61|0|X'3D'
63|0|X'3F'
65|0|X'41'
67|0|X'43'
69|0|X'45'
71|0|X'47'
73|0|X'49'
75|0|X'4B'
77|0|X'4D'
79|0|X'4F'
81|0|X'51'
83|0|X'53'
85|0|X'55'
87|0|X'57'
89|0|X'59'
91|0|X'5B'
93|0|X'5D'
95|0|X'5F'
97|0|X'61'
99|0|X'63'

View File

@ -0,0 +1,51 @@
select rowid, bool_0, quote(binary_10) from nulls where string_7 is not null
0|1|X'00'
1|0|X'01'
2|1|X'02'
3|0|X'03'
4|1|X'04'
5|0|X'05'
6|1|X'06'
7|0|X'07'
8|1|X'08'
9|0|X'09'
20||NULL
22||NULL
24||NULL
26||NULL
28||NULL
30||NULL
32||NULL
34||NULL
36||NULL
38||NULL
40||NULL
42||NULL
44||NULL
46||NULL
48||NULL
50||NULL
52||NULL
54||NULL
56||NULL
58||NULL
60||NULL
62||NULL
64||NULL
66||NULL
68||NULL
70||NULL
72||NULL
74||NULL
76||NULL
78||NULL
80||NULL
82||NULL
84||NULL
86||NULL
88||NULL
90||NULL
92||NULL
94||NULL
96||NULL
98||NULL