Skip to content

Commit 48e2dbd

Browse files
authored
Avoid Long boxing on the write path (#3462)
1 parent 4f868ef commit 48e2dbd

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/InternalParquetRecordWriter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ public long getDataSize() {
174174

175175
private void checkBlockSizeReached() throws IOException {
176176
if (recordCount >= rowGroupRecordCountThreshold) {
177-
LOG.debug("record count reaches threshold: flushing {} records to disk.", recordCount);
177+
if (LOG.isDebugEnabled()) {
178+
LOG.debug("record count reaches threshold: flushing {} records to disk.", recordCount);
179+
}
178180
flushRowGroupToStore();
179181
initStore();
180182
recordCountForNextMemCheck = min(
@@ -188,7 +190,9 @@ private void checkBlockSizeReached() throws IOException {
188190
// flush the row group if it is within ~2 records of the limit
189191
// it is much better to be slightly under size than to be over at all
190192
if (memSize > (nextRowGroupSize - 2 * recordSize)) {
191-
LOG.debug("mem size {} > {}: flushing {} records to disk.", memSize, nextRowGroupSize, recordCount);
193+
if (LOG.isDebugEnabled()) {
194+
LOG.debug("mem size {} > {}: flushing {} records to disk.", memSize, nextRowGroupSize, recordCount);
195+
}
192196
flushRowGroupToStore();
193197
initStore();
194198
recordCountForNextMemCheck = min(
@@ -204,7 +208,9 @@ private void checkBlockSizeReached() throws IOException {
204208
recordCount
205209
+ props.getMaxRowCountForPageSizeCheck() // will not look more than max records ahead
206210
);
207-
LOG.debug("Checked mem at {} will check again at: {}", recordCount, recordCountForNextMemCheck);
211+
if (LOG.isDebugEnabled()) {
212+
LOG.debug("Checked mem at {} will check again at: {}", recordCount, recordCountForNextMemCheck);
213+
}
208214
}
209215
}
210216
}

0 commit comments

Comments
 (0)