Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaxin Gao committed May 17, 2024
1 parent 716e73a commit 7fb5579
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,28 @@ private String[][] computePreferredLocations() {
@Override
public PartitionReaderFactory createReaderFactory() {
if (useCometBatchReads()) {
return new SparkColumnarReaderFactory(
parquetBatchReadConf(readConf.parquetBatchSize(), ParquetReaderType.COMET));
return new SparkColumnarReaderFactory(parquetBatchReadConf(ParquetReaderType.COMET));

} else if (useParquetBatchReads()) {
return new SparkColumnarReaderFactory(
parquetBatchReadConf(readConf.parquetBatchSize(), ParquetReaderType.ICEBERG));
return new SparkColumnarReaderFactory(parquetBatchReadConf(ParquetReaderType.ICEBERG));

} else if (useOrcBatchReads()) {
return new SparkColumnarReaderFactory(orcBatchReadConf(readConf.orcBatchSize()));
return new SparkColumnarReaderFactory(orcBatchReadConf());

} else {
return new SparkRowReaderFactory();
}
}

private ParquetBatchReadConf parquetBatchReadConf(int batchSize, ParquetReaderType readerType) {
private ParquetBatchReadConf parquetBatchReadConf(ParquetReaderType readerType) {
return ImmutableParquetBatchReadConf.builder()
.batchSize(batchSize)
.batchSize(readConf.parquetBatchSize())
.readerType(readerType)
.build();
}

private OrcBatchReadConf orcBatchReadConf(int batchSize) {
return ImmutableOrcBatchReadConf.builder().batchSize(batchSize).build();
private OrcBatchReadConf orcBatchReadConf() {
return ImmutableOrcBatchReadConf.builder().batchSize(readConf.parquetBatchSize()).build();
}

// conditions for using Parquet batch reads:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@
import org.apache.spark.sql.vectorized.ColumnarBatch;

class SparkColumnarReaderFactory implements PartitionReaderFactory {
private ParquetBatchReadConf parquetConf;
private OrcBatchReadConf orcConf;
private final ParquetBatchReadConf parquetConf;
private final OrcBatchReadConf orcConf;

SparkColumnarReaderFactory(ParquetBatchReadConf conf) {
this.parquetConf = conf;
this.orcConf = null;
}

SparkColumnarReaderFactory(OrcBatchReadConf conf) {
this.orcConf = conf;
this.parquetConf = null;
}

@Override
Expand Down

0 comments on commit 7fb5579

Please sign in to comment.