Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix if style
  • Loading branch information
exmy committed Nov 15, 2024
commit 6ccf5014975ceb187fd83dc6cbdf1326705f9829
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private[spark] class HadoopDelegationTokenManager(
creds.addAll(newTokens)
}
})
if(!currentUser.equals(freshUGI)) {
if (!currentUser.equals(freshUGI)) {
FileSystem.closeAllForUGI(freshUGI)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ private[spark] class TaskSetManager(
val info = taskInfos(tid)
// SPARK-37300: when the task was already finished state, just ignore it,
// so that there won't cause successful and tasksSuccessful wrong result.
if(info.finished) {
if (info.finished) {
if (dropTaskInfoAccumulablesOnTaskCompletion) {
// SPARK-46383: Clear out the accumulables for a completed task to reduce accumulable
// lifetime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ private[spark] class BlockManager(
return true
}

if(master.isRDDBlockVisible(blockId)) {
if (master.isRDDBlockVisible(blockId)) {
// Cache the visibility status if block exists.
blockInfoManager.tryMarkBlockAsVisible(blockId)
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BitSet(numBits: Int) extends Serializable {
def setUntil(bitIndex: Int): Unit = {
val wordIndex = bitIndex >> 6 // divide by 64
Arrays.fill(words, 0, wordIndex, -1)
if(wordIndex < words.length) {
if (wordIndex < words.length) {
// Set the remaining bits (note that the mask could still be zero)
val mask = ~(-1L << (bitIndex & 0x3f))
words(wordIndex) |= mask
Expand All @@ -58,7 +58,7 @@ class BitSet(numBits: Int) extends Serializable {
def clearUntil(bitIndex: Int): Unit = {
val wordIndex = bitIndex >> 6 // divide by 64
Arrays.fill(words, 0, wordIndex, 0)
if(wordIndex < words.length) {
if (wordIndex < words.length) {
// Clear the remaining bits
val mask = -1L << (bitIndex & 0x3f)
words(wordIndex) &= mask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class TopologyAwareBlockReplicationPolicyBehavior extends RandomBlockReplication
assert(prioritizedPeers.toSet.size == numReplicas)
val priorityPeers = prioritizedPeers.take(2)
assert(priorityPeers.forall(p => p.host != blockManager.host))
if(numReplicas > 1) {
if (numReplicas > 1) {
// both these conditions should be satisfied when numReplicas > 1
assert(priorityPeers.exists(p => p.topologyInfo == blockManager.topologyInfo))
assert(priorityPeers.exists(p => p.topologyInfo != blockManager.topologyInfo))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MultilabelMetrics @Since("1.2.0") (predictionAndLabels: RDD[(Array[Double]
def f1Measure(label: Double): Double = {
val p = precision(label)
val r = recall(label)
if((p + r) == 0) 0.0 else 2 * p * r / (p + r)
if ((p + r) == 0) 0.0 else 2 * p * r / (p + r)
}

private lazy val sumTp = summary.tpPerClass.values.sum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private[k8s] class LoggingPodStatusWatcherImpl(conf: KubernetesDriverConf)

override def onClose(e: WatcherException): Unit = {
logDebug(s"Stopping watching application $appId with last-observed phase $phase")
if(e != null && e.isHttpGone) {
if (e != null && e.isHttpGone) {
resourceTooOldReceived = true
logDebug(s"Got HTTP Gone code, resource version changed in k8s api: $e")
} else {
Expand Down Expand Up @@ -108,7 +108,7 @@ private[k8s] class LoggingPodStatusWatcherImpl(conf: KubernetesDriverConf)
}
}

if(podCompleted) {
if (podCompleted) {
logInfo(
pod.map { p => log"Container final statuses:\n\n${MDC(STATUS, containersDescription(p))}" }
.getOrElse(log"No containers were found in the driver pod."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class InMemoryCatalog(
try {
val fs = tablePath.getFileSystem(hadoopConfig)
fs.mkdirs(newPartPath)
if(!fs.rename(oldPartPath, newPartPath)) {
if (!fs.rename(oldPartPath, newPartPath)) {
throw new IOException(s"Renaming partition path from $oldPartPath to " +
s"$newPartPath returned false")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ case class Cast(
try doubleStr.toDouble catch {
case _: NumberFormatException =>
val d = Cast.processFloatingPointSpecialLiterals(doubleStr, false)
if(ansiEnabled && d == null) {
if (ansiEnabled && d == null) {
throw QueryExecutionErrors.invalidInputInCastToNumberError(
DoubleType, s, getContextOrNull())
} else {
Expand Down Expand Up @@ -1602,7 +1602,7 @@ case class Cast(
val util = IntervalUtils.getClass.getCanonicalName.stripSuffix("$")
(c, evPrim, evNull) =>
code"""$evPrim = $util.safeStringToInterval($c);
if(${evPrim} == null) {
if (${evPrim} == null) {
${evNull} = true;
}
""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ case class CaseWhen(

// This generates code like:
// caseWhenResultState = caseWhen_1(i);
// if(caseWhenResultState != -1) {
// if (caseWhenResultState != -1) {
// continue;
// }
// caseWhenResultState = caseWhen_2(i);
// if(caseWhenResultState != -1) {
// if (caseWhenResultState != -1) {
// continue;
// }
// ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ case class MapZipWith(left: Expression, right: Expression, function: Expression)
val (bufferKey, indexes) = arrayBuffer(j)
if (ordering.equiv(bufferKey, key)) {
found = true
if(indexes(z).isEmpty) {
if (indexes(z).isEmpty) {
indexes(z) = Some(i)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ abstract class StringRegexExpression extends BinaryExpression

protected override def nullSafeEval(input1: Any, input2: Any): Any = {
val regex = pattern(input2.asInstanceOf[UTF8String].toString)
if(regex == null) {
if (regex == null) {
null
} else {
matches(regex, input1.asInstanceOf[UTF8String].toString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ object RuleIdCollection {
"org.apache.spark.sql.catalyst.optimizer.UnwrapCastInBinaryComparison" :: Nil
}

if(Utils.isTesting) {
if (Utils.isTesting) {
rulesNeedingIds = rulesNeedingIds ++ {
// In the production code path, the following rules are run in CombinedTypeCoercionRule, and
// hence we only need to add them for unit testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class SimpleWritableDataSource extends TestingV2Source {
try {
for (file <- fs.listStatus(jobPath).map(_.getPath)) {
val dest = new Path(finalPath, file.getName)
if(!fs.rename(file, dest)) {
if (!fs.rename(file, dest)) {
throw new IOException(s"failed to rename($file, $dest)")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ abstract class JsonSuite

// The following tests are about type coercion instead of JSON data source.
// Here we simply forcus on the behavior of non-Ansi.
if(!SQLConf.get.ansiEnabled) {
if (!SQLConf.get.ansiEnabled) {
// Number and Boolean conflict: resolve the type as number in this query.
checkAnswer(
sql("select num_bool - 10 from jsonTable where num_bool > 11"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ParquetDeltaLengthByteArrayEncodingSuite
val samples: Array[String] = new Array[String](numSamples)
for (i <- 0 until numSamples) {
var maxLen: Int = randomLen.nextInt(maxLength)
if(randomEmpty.nextInt() % 11 != 0) {
if (randomEmpty.nextInt() % 11 != 0) {
maxLen = 0;
}
samples(i) = RandomStringUtils.randomAlphanumeric(0, maxLen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ trait StreamTest extends QueryTest with SharedSparkSession with TimeLimits with

(1 to iterations).foreach { i =>
val rand = Random.nextDouble()
if(!running) {
if (!running) {
rand match {
case r if r < 0.7 => // AddData
addRandomData()
Expand Down Expand Up @@ -895,7 +895,7 @@ trait StreamTest extends QueryTest with SharedSparkSession with TimeLimits with
}
}
}
if(!running) { actions += StartStream() }
if (!running) { actions += StartStream() }
addCheck()
testStream(ds)(actions.toSeq: _*)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
val actualPartitionPath = new Path(currentFullPath, actualPartitionString)
try {
fs.mkdirs(expectedPartitionPath)
if(!fs.rename(actualPartitionPath, expectedPartitionPath)) {
if (!fs.rename(actualPartitionPath, expectedPartitionPath)) {
throw new IOException(s"Renaming partition path from $actualPartitionPath to " +
s"$expectedPartitionPath returned false")
}
Expand Down