|
18 | 18 | import org.apache.arrow.vector.types.FloatingPointPrecision;
|
19 | 19 | import org.apache.arrow.vector.types.pojo.ArrowType;
|
20 | 20 | import org.apache.arrow.vector.types.pojo.FieldType;
|
| 21 | +import org.apache.log4j.Level; |
21 | 22 | import org.apache.log4j.Logger;
|
22 | 23 | import org.apache.spark.sql.execution.arrow.ArrowUtils;
|
23 | 24 | import org.apache.spark.sql.sources.v2.reader.InputPartitionReader;
|
@@ -78,6 +79,8 @@ public class VCFInputPartitionReader implements InputPartitionReader<ColumnarBat
|
78 | 79 | /** Stats counter: number of bytes in allocated buffers. */
|
79 | 80 | private long statsTotalBufferBytes;
|
80 | 81 |
|
| 82 | + private Level enableStatsLogLevel; |
| 83 | + |
81 | 84 | /**
|
82 | 85 | * Creates a TileDB-VCF reader.
|
83 | 86 | *
|
@@ -115,6 +118,12 @@ public VCFInputPartitionReader(
|
115 | 118 | } else {
|
116 | 119 | this.samples = new String[] {};
|
117 | 120 | }
|
| 121 | + |
| 122 | + this.enableStatsLogLevel = Level.OFF; |
| 123 | + if (this.options.getTileDBStatsLogLevel().isPresent()) { |
| 124 | + // If an invalid log level is set, the default is DEBUG |
| 125 | + this.enableStatsLogLevel = Level.toLevel(this.options.getTileDBStatsLogLevel().get()); |
| 126 | + } |
118 | 127 | }
|
119 | 128 |
|
120 | 129 | @Override
|
@@ -183,6 +192,10 @@ public ColumnarBatch get() {
|
183 | 192 | public void close() {
|
184 | 193 | log.info("Closing VCFReader for partition " + (this.partitionId));
|
185 | 194 |
|
| 195 | + if (!this.enableStatsLogLevel.equals(Level.OFF)) { |
| 196 | + log.log(this.enableStatsLogLevel, this.vcfReader.stats()); |
| 197 | + } |
| 198 | + |
186 | 199 | if (vcfReader != null) {
|
187 | 200 | vcfReader.close();
|
188 | 201 | vcfReader = null;
|
@@ -251,6 +264,9 @@ private void initVCFReader() {
|
251 | 264 | vcfReader.setSortRegions(sortRegions.get().booleanValue());
|
252 | 265 | }
|
253 | 266 |
|
| 267 | + // Enable VCFReader stats |
| 268 | + if (!this.enableStatsLogLevel.equals(Level.OFF)) this.vcfReader.setStatsEnabled(true); |
| 269 | + |
254 | 270 | // Set logical partition in array
|
255 | 271 | vcfReader.setRangePartition(
|
256 | 272 | rangePartitionInfo.getNumPartitions(), rangePartitionInfo.getIndex());
|
|
0 commit comments