@@ -68,107 +68,79 @@ public class RawFormatSerDeSchemaTest {
68
68
@ Parameterized .Parameters (name = "{index}: {0}" )
69
69
public static List <TestSpec > testData () {
70
70
return Arrays .asList (
71
- TestSpec .type (TINYINT ())
72
- .values (new Byte [] {Byte .MAX_VALUE })
73
- .binary (new byte [][] {{Byte .MAX_VALUE }}),
71
+ TestSpec .type (TINYINT ()).values (Byte .MAX_VALUE ).binary (new byte [] {Byte .MAX_VALUE }),
72
+ TestSpec .type (SMALLINT ()).values (Short .MAX_VALUE ).binary (hexStringToByte ("7fff" )),
74
73
TestSpec .type (SMALLINT ())
75
- .values (new Short [] {Short .MAX_VALUE })
76
- .binary (new byte [][] {hexStringToByte ("7fff" )}),
77
- TestSpec .type (SMALLINT ())
78
- .values (new Short [] {Short .MAX_VALUE })
74
+ .values (Short .MAX_VALUE )
79
75
.withLittleEndian ()
80
- .binary (new byte [][] {hexStringToByte ("ff7f" )}),
81
- TestSpec .type (INT ())
82
- .values (new Integer [] {Integer .MAX_VALUE })
83
- .binary (new byte [][] {hexStringToByte ("7fffffff" )}),
76
+ .binary (hexStringToByte ("ff7f" )),
77
+ TestSpec .type (INT ()).values (Integer .MAX_VALUE ).binary (hexStringToByte ("7fffffff" )),
84
78
TestSpec .type (INT ())
85
- .values (new Integer [] { Integer .MAX_VALUE } )
79
+ .values (Integer .MAX_VALUE )
86
80
.withLittleEndian ()
87
- .binary (new byte [][] { hexStringToByte ("ffffff7f" )} ),
81
+ .binary (hexStringToByte ("ffffff7f" )),
88
82
TestSpec .type (BIGINT ())
89
- .values (new Long [] { Long .MAX_VALUE } )
90
- .binary (new byte [][] { hexStringToByte ("7fffffffffffffff" )} ),
83
+ .values (Long .MAX_VALUE )
84
+ .binary (hexStringToByte ("7fffffffffffffff" )),
91
85
TestSpec .type (BIGINT ())
92
- .values (new Long [] { Long .MAX_VALUE } )
86
+ .values (Long .MAX_VALUE )
93
87
.withLittleEndian ()
94
- .binary (new byte [][] {hexStringToByte ("ffffffffffffff7f" )}),
95
- TestSpec .type (FLOAT ())
96
- .values (new Float [] {Float .MAX_VALUE })
97
- .binary (new byte [][] {hexStringToByte ("7f7fffff" )}),
88
+ .binary (hexStringToByte ("ffffffffffffff7f" )),
89
+ TestSpec .type (FLOAT ()).values (Float .MAX_VALUE ).binary (hexStringToByte ("7f7fffff" )),
98
90
TestSpec .type (FLOAT ())
99
- .values (new Float [] { Float .MAX_VALUE } )
91
+ .values (Float .MAX_VALUE )
100
92
.withLittleEndian ()
101
- .binary (new byte [][] { hexStringToByte ("ffff7f7f" )} ),
93
+ .binary (hexStringToByte ("ffff7f7f" )),
102
94
TestSpec .type (DOUBLE ())
103
- .values (new Double [] { Double .MAX_VALUE } )
104
- .binary (new byte [][] { hexStringToByte ("7fefffffffffffff" )} ),
95
+ .values (Double .MAX_VALUE )
96
+ .binary (hexStringToByte ("7fefffffffffffff" )),
105
97
TestSpec .type (DOUBLE ())
106
- .values (new Double [] { Double .MAX_VALUE } )
98
+ .values (Double .MAX_VALUE )
107
99
.withLittleEndian ()
108
- .binary (new byte [][] {hexStringToByte ("ffffffffffffef7f" )}),
109
- TestSpec .type (BOOLEAN ())
110
- .values (new Boolean [] {true })
111
- .binary (new byte [][] {new byte [] {1 }}),
112
- TestSpec .type (BOOLEAN ())
113
- .values (new Boolean [] {false })
114
- .binary (new byte [][] {new byte [] {0 }}),
100
+ .binary (hexStringToByte ("ffffffffffffef7f" )),
101
+ TestSpec .type (BOOLEAN ()).values (true ).binary (new byte [] {1 }),
102
+ TestSpec .type (BOOLEAN ()).values (false ).binary (new byte [] {0 }),
103
+ TestSpec .type (STRING ()).values ("Hello World" ).binary ("Hello World" .getBytes ()),
115
104
TestSpec .type (STRING ())
116
- .values (new String [] { " Hello World"} )
117
- .binary (new byte [][] { " Hello World" .getBytes ()} ),
105
+ .values ("你好世界, Hello World" )
106
+ .binary ("你好世界, Hello World" .getBytes ()),
118
107
TestSpec .type (STRING ())
119
- .values (new String [] {"你好世界,Hello World" })
120
- .binary (new byte [][] {"你好世界,Hello World" .getBytes ()}),
121
- TestSpec .type (STRING ())
122
- .values (new String [] {"Flink Awesome!" })
108
+ .values ("Flink Awesome!" )
123
109
.withCharset ("UTF-16" )
124
- .binary (new byte [][] { "Flink Awesome!" .getBytes (StandardCharsets .UTF_16 )} ),
110
+ .binary ("Flink Awesome!" .getBytes (StandardCharsets .UTF_16 )),
125
111
TestSpec .type (STRING ())
126
- .values (new String [] { "Flink 帅哭!" } )
112
+ .values ("Flink 帅哭!" )
127
113
.withCharset ("UTF-16" )
128
- .binary (new byte [][] {"Flink 帅哭!" .getBytes (StandardCharsets .UTF_16 )}),
129
- TestSpec .type (STRING ())
130
- .values (new String [] {"" })
131
- .binary (new byte [][] {"" .getBytes ()}),
132
- TestSpec .type (VARCHAR (5 ))
133
- .values (new String [] {"HELLO" })
134
- .binary (new byte [][] {"HELLO" .getBytes ()}),
114
+ .binary ("Flink 帅哭!" .getBytes (StandardCharsets .UTF_16 )),
115
+ TestSpec .type (STRING ()).values ("" ).binary ("" .getBytes ()),
116
+ TestSpec .type (VARCHAR (5 )).values ("HELLO" ).binary ("HELLO" .getBytes ()),
135
117
TestSpec .type (STRING ())
136
- .values (new String [] {"line 1" , "line 2" , "line 3" })
137
- .binary (
138
- new byte [][] {
139
- "line 1" .getBytes (), "line 2" .getBytes (), "line 3" .getBytes ()
140
- }),
118
+ .values ("line 1" , "line 2" , "line 3" )
119
+ .binary ("line 1" .getBytes (), "line 2" .getBytes (), "line 3" .getBytes ()),
141
120
TestSpec .type (BYTES ())
142
- .values (new byte [][] {{1 , 3 , 5 , 7 , 9 }})
143
- .binary (new byte [][] {{1 , 3 , 5 , 7 , 9 }}),
144
- TestSpec .type (BYTES ()).values (new byte [][] {}).binary (new byte [][] {{}}),
145
- TestSpec .type (BINARY (3 ))
146
- .values (new byte [][] {{1 , 3 , 5 }})
147
- .binary (new byte [][] {{1 , 3 , 5 }}),
121
+ .values (new byte [] {1 , 3 , 5 , 7 , 9 })
122
+ .binary (new byte [] {1 , 3 , 5 , 7 , 9 }),
123
+ TestSpec .type (BYTES ()).values (new byte [] {}).binary (new byte [] {}),
124
+ TestSpec .type (BINARY (3 )).values (new byte [] {1 , 3 , 5 }).binary (new byte [] {1 , 3 , 5 }),
148
125
TestSpec .type (RAW (LocalDateTime .class , new LocalDateTimeSerializer ()))
149
- .values (
150
- new LocalDateTime [] {
151
- LocalDateTime .parse ("2020-11-11T18:08:01.123" )
152
- })
126
+ .values (LocalDateTime .parse ("2020-11-11T18:08:01.123" ))
153
127
.binary (
154
- new byte [][] {
155
- serializeLocalDateTime (
156
- LocalDateTime .parse ("2020-11-11T18:08:01.123" ))
157
- }),
128
+ serializeLocalDateTime (
129
+ LocalDateTime .parse ("2020-11-11T18:08:01.123" ))),
158
130
159
131
// test nulls
160
- TestSpec .type (TINYINT ()).values (new Byte [] { null } ).binary (new byte [][] { null } ),
161
- TestSpec .type (SMALLINT ()).values (new Short [] { null } ).binary (new byte [][] { null } ),
162
- TestSpec .type (INT ()).values (new Integer [] { null } ).binary (new byte [][] { null } ),
163
- TestSpec .type (BIGINT ()).values (new Long [] { null } ).binary (new byte [][] { null } ),
164
- TestSpec .type (FLOAT ()).values (new Float [] { null } ).binary (new byte [][] { null } ),
165
- TestSpec .type (DOUBLE ()).values (new Double [] { null } ).binary (new byte [][] { null } ),
166
- TestSpec .type (BOOLEAN ()).values (new Boolean [] { null } ).binary (new byte [][] { null } ),
167
- TestSpec .type (STRING ()).values (new String [] { null } ).binary (new byte [][] { null } ),
168
- TestSpec .type (BYTES ()).values (new byte [][] { null } ).binary (new byte [][] { null } ),
132
+ TestSpec .type (TINYINT ()).values (( Object ) null ).binary (( byte []) null ),
133
+ TestSpec .type (SMALLINT ()).values (( Object ) null ).binary (( byte []) null ),
134
+ TestSpec .type (INT ()).values (( Object ) null ).binary (( byte []) null ),
135
+ TestSpec .type (BIGINT ()).values (( Object ) null ).binary (( byte []) null ),
136
+ TestSpec .type (FLOAT ()).values (( Object ) null ).binary (( byte []) null ),
137
+ TestSpec .type (DOUBLE ()).values (( Object ) null ).binary (( byte []) null ),
138
+ TestSpec .type (BOOLEAN ()).values (( Object ) null ).binary (( byte []) null ),
139
+ TestSpec .type (STRING ()).values (( Object ) null ).binary (( byte []) null ),
140
+ TestSpec .type (BYTES ()).values (( Object ) null ).binary (( byte []) null ),
169
141
TestSpec .type (RAW (LocalDateTime .class , new LocalDateTimeSerializer ()))
170
- .values (new LocalDateTime [] { null } )
171
- .binary (new byte [][] { null } ));
142
+ .values (( Object ) null )
143
+ .binary (( byte []) null ));
172
144
}
173
145
174
146
@ Parameterized .Parameter public TestSpec testSpec ;
@@ -247,12 +219,12 @@ public static TestSpec type(DataType fieldType) {
247
219
return new TestSpec (fieldType );
248
220
}
249
221
250
- public TestSpec values (Object [] values ) {
222
+ public TestSpec values (Object ... values ) {
251
223
this .values = values ;
252
224
return this ;
253
225
}
254
226
255
- public TestSpec binary (byte [][] bytes ) {
227
+ public TestSpec binary (byte []... bytes ) {
256
228
this .binary = bytes ;
257
229
return this ;
258
230
}
0 commit comments