clintropolis commented on a change in pull request #8950: Support orc format
for native batch ingestion
URL: https://github.com/apache/incubator-druid/pull/8950#discussion_r351058801
##########
File path:
extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcHadoopInputRowParserTest.java
##########
@@ -217,54 +217,70 @@ private static HadoopDruidIndexerConfig
loadHadoopDruidIndexerConfig(String conf
return HadoopDruidIndexerConfig.fromFile(new File(configPath));
}
- private static OrcStruct getFirstRow(Job job, String orcPath) throws
IOException, InterruptedException
+ private static OrcStruct getFirstRow(Job job, String orcPath) throws
IOException
{
File testFile = new File(orcPath);
Path path = new Path(testFile.getAbsoluteFile().toURI());
- FileSplit split = new FileSplit(path, 0, testFile.length(), null);
+ FileSplit split = new FileSplit(path, 0, testFile.length(), new
String[]{"host"});
- InputFormat inputFormat = ReflectionUtils.newInstance(
+ InputFormat<NullWritable, OrcStruct> inputFormat =
ReflectionUtils.newInstance(
OrcInputFormat.class,
job.getConfiguration()
);
- TaskAttemptContext context = new
TaskAttemptContextImpl(job.getConfiguration(), new TaskAttemptID());
-
- try (RecordReader reader = inputFormat.createRecordReader(split, context))
{
-
- reader.initialize(split, context);
- reader.nextKeyValue();
- return (OrcStruct) reader.getCurrentValue();
+ RecordReader<NullWritable, OrcStruct> reader = inputFormat.getRecordReader(
+ split,
+ new JobConf(job.getConfiguration()),
+ null
+ );
+ try {
+ final NullWritable key = reader.createKey();
+ final OrcStruct value = reader.createValue();
+ if (reader.next(key, value)) {
+ return value;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+ finally {
+ reader.close();
}
}
- private static List<InputRow> getAllRows(HadoopDruidIndexerConfig config)
- throws IOException, InterruptedException
+ // This method returns a list of the final rows. This is definitely a bug,
but it should be better to delete
Review comment:
thanks for commenting about this, I noticed a while ago but then forgot
about it :rofl:
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]