Skip to content

Commit

Permalink
storage: Fix NPE at SampleIndexOnlyVariantQueryExecutor for non multi…
Browse files Browse the repository at this point in the history
…-file samples #TASK-4794
  • Loading branch information
j-coll committed Jul 26, 2023
1 parent 4de465a commit 2943017
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class SampleIndexOnlyVariantQueryExecutor extends VariantQueryExecutor {
private final VariantHadoopDBAdaptor dbAdaptor;
private final VariantQueryParser variantQueryParser;
private final VariantQueryProjectionParser variantQueryProjectionParser;
private Logger logger = LoggerFactory.getLogger(SampleIndexOnlyVariantQueryExecutor.class);
private static Logger logger = LoggerFactory.getLogger(SampleIndexOnlyVariantQueryExecutor.class);

private static final ExecutorService THREAD_POOL = Executors.newCachedThreadPool(new BasicThreadFactory.Builder()
.namingPattern("sample-index-async-count-%s")
Expand Down Expand Up @@ -373,6 +373,15 @@ enum FamilyRole {
for (Integer fileId : sampleFileIds) {
sampleFiles.add(metadataManager.getFileName(studyId, fileId));
}
} else {
List<Integer> fileIds = metadataManager.getFileIdsFromSampleId(studyId, sampleId, true);
if (fileIds.isEmpty()) {
logger.warn("Sample without indexed files!");
sampleFiles = Collections.singletonList("sample_without_indexed_files.vcf");
} else {
String fileName = metadataManager.getFileName(studyId, fileIds.get(0));
sampleFiles = Collections.singletonList(fileName);
}
}
filterField = schema.getFileIndex()
.getCustomField(IndexFieldConfiguration.Source.FILE, StudyEntry.FILTER);
Expand Down

0 comments on commit 2943017

Please sign in to comment.