Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmcmu committed Feb 25, 2025
1 parent 8054126 commit 5d8da55
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,51 @@ public void integrationReadWriteBackTest() throws Exception
}
}

@Test
public void readBufferSizeTest() throws Exception
{
HPCCFile file = new HPCCFile(datasets[0], connString , hpccUser, hpccPass);
DataPartition[] fileParts = file.getFileParts();
if (fileParts == null || fileParts.length == 0)
{
Assert.fail("No file parts found");
}

FieldDef originalRD = file.getRecordDefinition();
if (originalRD == null || originalRD.getNumDefs() == 0)
{
Assert.fail("Invalid or null record definition");
}

ArrayList<HPCCRecord> records = new ArrayList<HPCCRecord>();
for (int i = 0; i < fileParts.length; i++)
{
HpccRemoteFileReader.FileReadContext readContext = new HpccRemoteFileReader.FileReadContext();
readContext.originalRD = originalRD;
readContext.readBufferSizeKB = 1024;
HPCCRecordBuilder recordBuilder = new HPCCRecordBuilder(file.getProjectedRecordDefinition());

HpccRemoteFileReader<HPCCRecord> fileReader = new HpccRemoteFileReader<HPCCRecord>(readContext, fileParts[i], recordBuilder);

while (fileReader.hasNext())
{
HPCCRecord record = fileReader.next();
if (record == null)
{
Assert.fail("Received null record during read");
}

records.add(record);
}
fileReader.close();

if (fileReader.getRemoteReadMessageCount() > 0)
System.out.println("Messages from file part (" + i + ") read operation:\n" + fileReader.getRemoteReadMessages());
}

assertEquals("Number of records did not match during read.", expectedCounts[0], records.size());
}

@Test
public void readResumeTest() throws Exception
{
Expand Down

0 comments on commit 5d8da55

Please sign in to comment.