@@ -276,7 +276,6 @@ public void getNullMetadataTest() throws Exception
276
276
assertNull ("Meta should be null for nonexistent file" ,meta );
277
277
}
278
278
279
-
280
279
private static final String ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_" ;
281
280
private static final SecureRandom RANDOM = new SecureRandom ();
282
281
@@ -376,6 +375,47 @@ public void unsigned8ToDecimalTest() throws Exception
376
375
}
377
376
}
378
377
378
+ @ Test
379
+ public void longStringTest () throws Exception
380
+ {
381
+ // Create a large record dataset
382
+ FieldDef [] fieldDefs = new FieldDef [4 ];
383
+ fieldDefs [0 ] = new FieldDef ("LongVarUnicode" , FieldType .VAR_STRING , "" , 4 , false , false , HpccSrcType .UTF16LE , new FieldDef [0 ]);
384
+ fieldDefs [1 ] = new FieldDef ("LongUnicode" , FieldType .STRING , "" , 64 , true , false , HpccSrcType .UTF16LE , new FieldDef [0 ]);
385
+ fieldDefs [2 ] = new FieldDef ("LongVarString" , FieldType .VAR_STRING , "" , 4 , false , false , HpccSrcType .SINGLE_BYTE_CHAR , new FieldDef [0 ]);
386
+ fieldDefs [3 ] = new FieldDef ("LongString" , FieldType .STRING , "" , 64 , true , false , HpccSrcType .SINGLE_BYTE_CHAR , new FieldDef [0 ]);
387
+ FieldDef recordDef = new FieldDef ("RootRecord" , FieldType .RECORD , "rec" , 4 , false , false , HpccSrcType .LITTLE_ENDIAN , fieldDefs );
388
+
389
+ List <HPCCRecord > originalRecords = new ArrayList <HPCCRecord >();
390
+ for (int i = 0 ; i < 10 ; i ++)
391
+ {
392
+ Object [] fields = new Object [4 ];
393
+ fields [0 ] = generateRandomString (1024 );
394
+ fields [1 ] = generateRandomString (64 );
395
+ fields [2 ] = generateRandomString (1024 );
396
+ fields [3 ] = generateRandomString (64 );
397
+ HPCCRecord record = new HPCCRecord (fields , recordDef );
398
+ originalRecords .add (record );
399
+ }
400
+
401
+ String datasetName = "benchmark::long_string::10rows" ;
402
+ writeFile (originalRecords , datasetName , recordDef ,connTO );
403
+
404
+ HPCCFile file = new HPCCFile (datasetName , connString , hpccUser , hpccPass );
405
+ List <HPCCRecord > readRecords = readFile (file , connTO , false );
406
+ if (readRecords .size () < 10 )
407
+ {
408
+ Assert .fail ("Failed to read " + datasetName + " dataset" );
409
+ }
410
+
411
+ for (int i = 0 ; i < 10 ; i ++)
412
+ {
413
+ HPCCRecord originalRecord = originalRecords .get (i );
414
+ HPCCRecord readRecord = originalRecords .get (i );
415
+ Assert .assertEquals (originalRecord , readRecord );
416
+ }
417
+ }
418
+
379
419
@ Test
380
420
public void numericOverflowTest () throws Exception
381
421
{
0 commit comments