[GitHub] spark pull request #18635: [SPARK-21415] Triage scapegoat warnings, part 1

2017-07-18 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/18635#discussion_r127970648
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/CompactibleFileStreamLog.scala
 ---
@@ -170,12 +170,8 @@ abstract class CompactibleFileStreamLog[T <: AnyRef : 
ClassTag](
   private def compact(batchId: Long, logs: Array[T]): Boolean = {
 val validBatches = getValidBatchesBeforeCompactionBatch(batchId, 
compactInterval)
 val allLogs = validBatches.flatMap(batchId => 
super.get(batchId)).flatten ++ logs
-if (super.add(batchId, compactLogs(allLogs).toArray)) {
-  true
-} else {
-  // Return false as there is another writer.
-  false
-}
+// Return false as there is another writer.
--- End diff --

Is this comment still valid?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18635: [SPARK-21415] Triage scapegoat warnings, part 1

2017-07-18 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/18635#discussion_r127970380
  
--- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/types/DecimalSuite.scala ---
@@ -109,8 +109,8 @@ class DecimalSuite extends SparkFunSuite with 
PrivateMethodTester {
 
   test("small decimals represented as unscaled long") {
 checkCompact(new Decimal(), true)
-checkCompact(Decimal(BigDecimal(10.03)), false)
-checkCompact(Decimal(BigDecimal(1e20)), false)
+checkCompact(Decimal(BigDecimal("10.03")), false)
+checkCompact(Decimal(BigDecimal("1")), false)
--- End diff --

might be better to write `1e20.toString`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18635: [SPARK-21415] Triage scapegoat warnings, part 1

2017-07-18 Thread srowen
Github user srowen closed the pull request at:

https://github.com/apache/spark/pull/18635


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18635: [SPARK-21415] Triage scapegoat warnings, part 1

2017-07-14 Thread srowen
GitHub user srowen opened a pull request:

https://github.com/apache/spark/pull/18635

[SPARK-21415] Triage scapegoat warnings, part 1

## What changes were proposed in this pull request?

Address scapegoat warnings for:
- BigDecimal double constructor
- Catching NPE
- Finalizer without super
- List.size is O(n)
- Prefer Seq.empty
- Prefer Set.empty
- reverse.map instead of reverseMap
- Type shadowing
- Unnecessary if condition.
- Use .log1p
- Var could be val

In some instances like Seq.empty, I avoided making the change even where 
valid in test code to keep the scope of the change smaller. Those issues are 
concerned with performance and it won't matter for tests.

## How was this patch tested?

Existing tests

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/srowen/spark Scapegoat1

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/18635.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #18635


commit e81ae14f5964ad492a46be611c4395d3e4e2b90b
Author: Sean Owen 
Date:   2017-07-14T07:52:33Z

Address scapegoat warnings for:

BigDecimal double constructor
Catching NPE
Finalizer without super
List.size is O
Prefer Seq.empty
Prefer Set.empty
reverse.map instead of reverseMap
Type shadowing
Unnecessary if condition.
Use .log1p
Var could be val




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org