@@ -155,6 +155,7 @@ public void testJavaWriteReadPkTable() throws Exception {
155155 .column ("ts" , DataTypes .TIMESTAMP ())
156156 .column ("ts_ltz" , DataTypes .TIMESTAMP_WITH_LOCAL_TIME_ZONE ())
157157 .column ("t" , DataTypes .TIME ())
158+ .column ("bin_data" , DataTypes .BINARY (20 ))
158159 .column (
159160 "metadata" ,
160161 DataTypes .ROW (
@@ -186,8 +187,18 @@ public void testJavaWriteReadPkTable() throws Exception {
186187
187188 write .write (
188189 createRow7Cols (
189- 1 , "Apple" , "Fruit" , 1.5 , 1000000L , 2000000L , 1000 , "store1" , 1001L ,
190- "Beijing" , "China" ));
190+ 1 ,
191+ "Apple" ,
192+ "Fruit" ,
193+ 1.5 ,
194+ 1000000L ,
195+ 2000000L ,
196+ 1000 ,
197+ "apple_bin_data" .getBytes (),
198+ "store1" ,
199+ 1001L ,
200+ "Beijing" ,
201+ "China" ));
191202 write .write (
192203 createRow7Cols (
193204 2 ,
@@ -197,6 +208,7 @@ public void testJavaWriteReadPkTable() throws Exception {
197208 1000001L ,
198209 2000001L ,
199210 2000 ,
211+ "banana_bin" .getBytes (),
200212 "store1" ,
201213 1002L ,
202214 "Shanghai" ,
@@ -210,6 +222,7 @@ public void testJavaWriteReadPkTable() throws Exception {
210222 1000002L ,
211223 2000002L ,
212224 3000 ,
225+ "carrot" .getBytes (),
213226 "store2" ,
214227 1003L ,
215228 "Tokyo" ,
@@ -223,18 +236,39 @@ public void testJavaWriteReadPkTable() throws Exception {
223236 1000003L ,
224237 2000003L ,
225238 4000 ,
239+ "broccoli_binary_data" .getBytes (),
226240 "store2" ,
227241 1004L ,
228242 "Seoul" ,
229243 "Korea" ));
230244 write .write (
231245 createRow7Cols (
232- 5 , "Chicken" , "Meat" , 5.0 , 1000004L , 2000004L , 5000 , "store3" ,
233- 1005L , "NewYork" , "USA" ));
246+ 5 ,
247+ "Chicken" ,
248+ "Meat" ,
249+ 5.0 ,
250+ 1000004L ,
251+ 2000004L ,
252+ 5000 ,
253+ "chicken" .getBytes (),
254+ "store3" ,
255+ 1005L ,
256+ "NewYork" ,
257+ "USA" ));
234258 write .write (
235259 createRow7Cols (
236- 6 , "Beef" , "Meat" , 8.0 , 1000005L , 2000005L , 6000 , "store3" , 1006L ,
237- "London" , "UK" ));
260+ 6 ,
261+ "Beef" ,
262+ "Meat" ,
263+ 8.0 ,
264+ 1000005L ,
265+ 2000005L ,
266+ 6000 ,
267+ "beef_data" .getBytes (),
268+ "store3" ,
269+ 1006L ,
270+ "London" ,
271+ "UK" ));
238272 // Row with null partition value -> __DEFAULT_PARTITION__
239273 write .write (
240274 GenericRow .of (
@@ -245,6 +279,7 @@ public void testJavaWriteReadPkTable() throws Exception {
245279 org .apache .paimon .data .Timestamp .fromEpochMillis (1000006L ),
246280 org .apache .paimon .data .Timestamp .fromEpochMillis (2000006L ),
247281 7000 ,
282+ "tofu" .getBytes (),
248283 GenericRow .of (
249284 BinaryString .fromString ("store4" ),
250285 1007L ,
@@ -262,13 +297,13 @@ public void testJavaWriteReadPkTable() throws Exception {
262297 getResult (read , splits , row -> rowToStringWithStruct (row , table .rowType ()));
263298 assertThat (res )
264299 .containsExactlyInAnyOrder (
265- "+I[1, Apple, Fruit, 1.5, 1970-01-01T00:16:40, 1970-01-01T00:33:20, 1000, (store1, 1001, (Beijing, China))]" ,
266- "+I[2, Banana, Fruit, 0.8, 1970-01-01T00:16:40.001, 1970-01-01T00:33:20.001, 2000, (store1, 1002, (Shanghai, China))]" ,
267- "+I[3, Carrot, Vegetable, 0.6, 1970-01-01T00:16:40.002, 1970-01-01T00:33:20.002, 3000, (store2, 1003, (Tokyo, Japan))]" ,
268- "+I[4, Broccoli, Vegetable, 1.2, 1970-01-01T00:16:40.003, 1970-01-01T00:33:20.003, 4000, (store2, 1004, (Seoul, Korea))]" ,
269- "+I[5, Chicken, Meat, 5.0, 1970-01-01T00:16:40.004, 1970-01-01T00:33:20.004, 5000, (store3, 1005, (NewYork, USA))]" ,
270- "+I[6, Beef, Meat, 8.0, 1970-01-01T00:16:40.005, 1970-01-01T00:33:20.005, 6000, (store3, 1006, (London, UK))]" ,
271- "+I[7, Tofu, NULL, 3.0, 1970-01-01T00:16:40.006, 1970-01-01T00:33:20.006, 7000, (store4, 1007, (Paris, France))]" );
300+ "+I[1, Apple, Fruit, 1.5, 1970-01-01T00:16:40, 1970-01-01T00:33:20, 1000, [97, 112, 112, 108, 101, 95, 98, 105, 110, 95, 100, 97, 116, 97], (store1, 1001, (Beijing, China))]" ,
301+ "+I[2, Banana, Fruit, 0.8, 1970-01-01T00:16:40.001, 1970-01-01T00:33:20.001, 2000, [98, 97, 110, 97, 110, 97, 95, 98, 105, 110], (store1, 1002, (Shanghai, China))]" ,
302+ "+I[3, Carrot, Vegetable, 0.6, 1970-01-01T00:16:40.002, 1970-01-01T00:33:20.002, 3000, [99, 97, 114, 114, 111, 116], (store2, 1003, (Tokyo, Japan))]" ,
303+ "+I[4, Broccoli, Vegetable, 1.2, 1970-01-01T00:16:40.003, 1970-01-01T00:33:20.003, 4000, [98, 114, 111, 99, 99, 111, 108, 105, 95, 98, 105, 110, 97, 114, 121, 95, 100, 97, 116, 97], (store2, 1004, (Seoul, Korea))]" ,
304+ "+I[5, Chicken, Meat, 5.0, 1970-01-01T00:16:40.004, 1970-01-01T00:33:20.004, 5000, [99, 104, 105, 99, 107, 101, 110], (store3, 1005, (NewYork, USA))]" ,
305+ "+I[6, Beef, Meat, 8.0, 1970-01-01T00:16:40.005, 1970-01-01T00:33:20.005, 6000, [98, 101, 101, 102, 95, 100, 97, 116, 97], (store3, 1006, (London, UK))]" ,
306+ "+I[7, Tofu, NULL, 3.0, 1970-01-01T00:16:40.006, 1970-01-01T00:33:20.006, 7000, [116, 111, 102, 117], (store4, 1007, (Paris, France))]" );
272307 }
273308 }
274309
@@ -792,6 +827,7 @@ private static InternalRow createRow7Cols(
792827 long ts ,
793828 long tsLtz ,
794829 int timeMillis ,
830+ byte [] binData ,
795831 String metadataSource ,
796832 long metadataCreatedAt ,
797833 String city ,
@@ -809,6 +845,7 @@ private static InternalRow createRow7Cols(
809845 org .apache .paimon .data .Timestamp .fromEpochMillis (ts ),
810846 org .apache .paimon .data .Timestamp .fromEpochMillis (tsLtz ),
811847 timeMillis ,
848+ binData ,
812849 metadataRow );
813850 }
814851
0 commit comments