From 5789628871a47ebadc502a48e5137aa18d8d283e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Coll=20Morag=C3=B3n?= Date: Tue, 29 Oct 2024 16:02:35 +0000 Subject: [PATCH] storage: Do not interrupt header with empty records. #TASK-6722 --- .../hadoop/variant/mr/StreamVariantReducer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/mr/StreamVariantReducer.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/mr/StreamVariantReducer.java index 3a52bfbfbc..81e31be888 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/mr/StreamVariantReducer.java +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/mr/StreamVariantReducer.java @@ -1,5 +1,6 @@ package org.opencb.opencga.storage.hadoop.variant.mr; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; @@ -44,8 +45,13 @@ protected void reduce(ImmutableBytesWritable key, Iterable values, context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "header_records").increment(1); } } else { - // No more header, assume all header is written - headerWritten = true; + if (value.getLength() < 3 && StringUtils.isBlank(value.toString())) { + context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "stdout_records_empty").increment(1); + // Do not interrupt header with empty records + } else { + // No more header, assume all header is written + headerWritten = true; + } mos.write("stdout", key, value); context.getCounter(VariantsTableMapReduceHelper.COUNTER_GROUP_NAME, "body_records").increment(1); }