Skip to content

Commit 5f4530e

Browse files
Yash DattaYash Datta
authored andcommitted
SPARK-3968: Fix scala code style
1 parent f304667 commit 5f4530e

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTableOperations.scala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case class ParquetTableScan(
114114

115115
// Set this in configuration of ParquetInputFormat, needed for RowGroupFiltering
116116
val filter: Filter = ParquetFilters.createRecordFilter(columnPruningPred)
117-
if (filter!= null){
117+
if (filter != null){
118118
val filterPredicate = filter.asInstanceOf[FilterPredicateCompat].getFilterPredicate()
119119
ParquetInputFormat.setFilterPredicate(conf, filterPredicate)
120120
}
@@ -497,15 +497,16 @@ private[parquet] class FilteringParquetRowInputFormat
497497

498498
val splits = mutable.ArrayBuffer.empty[ParquetInputSplit]
499499
val filter: Filter = ParquetInputFormat.getFilter(configuration)
500-
var rowGroupsDropped :Long = 0
501-
var totalRowGroups :Long = 0
500+
var rowGroupsDropped: Long = 0
501+
var totalRowGroups: Long = 0
502502

503503
// Ugly hack, stuck with it until PR:
504504
// https://github.com/apache/incubator-parquet-mr/pull/17
505505
// is resolved
506506
val generateSplits =
507507
Class.forName("parquet.hadoop.ClientSideMetadataSplitStrategy")
508-
.getDeclaredMethods.find(_.getName == "generateSplits").get
508+
.getDeclaredMethods.find(_.getName == "generateSplits").getOrElse(
509+
sys.error(s"Failed to reflectively invoke ClientSideMetadataSplitStrategy.generateSplits"))
509510
generateSplits.setAccessible(true)
510511

511512
for (footer <- footers) {
@@ -521,7 +522,7 @@ private[parquet] class FilteringParquetRowInputFormat
521522
parquetMetaData.getFileMetaData.getSchema)
522523
rowGroupsDropped = rowGroupsDropped + (blocks.size - filteredBlocks.size)
523524

524-
if(!filteredBlocks.isEmpty){
525+
if (!filteredBlocks.isEmpty){
525526
var blockLocations: Array[BlockLocation] = null
526527
if (!cacheMetadata) {
527528
blockLocations = fs.getFileBlockLocations(status, 0, status.getLen)
@@ -543,10 +544,10 @@ private[parquet] class FilteringParquetRowInputFormat
543544
}
544545
}
545546

546-
if(rowGroupsDropped > 0 && totalRowGroups > 0){
547+
if (rowGroupsDropped > 0 && totalRowGroups > 0){
547548
val percentDropped = ((rowGroupsDropped/totalRowGroups.toDouble) * 100).toInt
548-
logInfo("Dropping " + rowGroupsDropped + " row groups that do not pass filter predicate! ("
549-
+ percentDropped + "%)")
549+
logInfo(s"Dropping $rowGroupsDropped row groups that do not pass filter predicate "
550+
+ s"($percentDropped %) !")
550551
}
551552
else {
552553
logInfo("There were no row groups that could be dropped due to filter predicates")
@@ -569,7 +570,9 @@ private[parquet] class FilteringParquetRowInputFormat
569570
// is resolved
570571
val generateSplits =
571572
Class.forName("parquet.hadoop.TaskSideMetadataSplitStrategy")
572-
.getDeclaredMethods.find(_.getName == "generateTaskSideMDSplits").get
573+
.getDeclaredMethods.find(_.getName == "generateTaskSideMDSplits").getOrElse(
574+
sys.error(
575+
s"Failed to reflectively invoke TaskSideMetadataSplitStrategy.generateTaskSideMDSplits"))
573576
generateSplits.setAccessible(true)
574577

575578
for (footer <- footers) {

0 commit comments

Comments
 (0)