Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.apache.spark.internal.SparkLoggerFactory;
import org.apache.spark.internal.LogKeys;
import org.apache.spark.internal.MDC;
import org.apache.spark.network.util.JavaUtils;
import org.apache.spark.util.ThreadUtils;

/**
Expand Down Expand Up @@ -104,8 +103,10 @@ public class ReadAheadInputStream extends InputStream {
*/
public ReadAheadInputStream(
InputStream inputStream, int bufferSizeInBytes) {
JavaUtils.checkArgument(bufferSizeInBytes > 0,
"bufferSizeInBytes should be greater than 0, but the value is " + bufferSizeInBytes);
if (bufferSizeInBytes <= 0) {
throw new IllegalArgumentException(
"bufferSizeInBytes should be greater than 0, but the value is " + bufferSizeInBytes);
}
activeBuffer = ByteBuffer.allocate(bufferSizeInBytes);
readAheadBuffer = ByteBuffer.allocate(bufferSizeInBytes);
this.underlyingInputStream = inputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.parquet.column.values.bitpacking.Packer;
import org.apache.parquet.io.ParquetDecodingException;

import org.apache.spark.network.util.JavaUtils;
import org.apache.spark.sql.catalyst.util.RebaseDateTime;
import org.apache.spark.sql.execution.datasources.DataSourceUtils;
import org.apache.spark.sql.execution.vectorized.WritableColumnVector;
Expand Down Expand Up @@ -89,8 +88,10 @@ public class VectorizedDeltaBinaryPackedReader extends VectorizedReaderBase {

@Override
public void initFromPage(int valueCount, ByteBufferInputStream in) throws IOException {
JavaUtils.checkArgument(valueCount >= 1,
"Page must have at least one value, but it has " + valueCount);
if (valueCount < 1) {
throw new IllegalArgumentException(
"Page must have at least one value, but it has " + valueCount);
}
this.in = in;
// Read the header
this.blockSizeInValues = BytesUtils.readUnsignedVarInt(in);
Expand All @@ -105,8 +106,10 @@ public void initFromPage(int valueCount, ByteBufferInputStream in) throws IOExce
+ miniBlockNumInABlock + " (block size in values: " + blockSizeInValues + ")");
}
double miniSize = (double) blockSizeInValues / miniBlockNumInABlock;
JavaUtils.checkArgument(miniSize % 8 == 0,
"miniBlockSize must be multiple of 8, but it's " + miniSize);
if (miniSize % 8 != 0) {
throw new IllegalArgumentException(
"miniBlockSize must be multiple of 8, but it's " + miniSize);
}
this.miniBlockSizeInValues = (int) miniSize;
// True value count. May be less than valueCount because of nulls
this.totalValueCount = BytesUtils.readUnsignedVarInt(in);
Expand Down