Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Jul 14, 2017

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

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
@SparkQA
Copy link

SparkQA commented Jul 14, 2017

Test build #79607 has finished for PR 18635 at commit e81ae14.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 17, 2017

Test build #3843 has finished for PR 18635 at commit e81ae14.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member Author

srowen commented Jul 18, 2017

Merged to master

@srowen srowen closed this Jul 18, 2017
@srowen srowen deleted the Scapegoat1 branch July 18, 2017 07:48
srowen added a commit to srowen/spark that referenced this pull request Jul 18, 2017
## 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

Author: Sean Owen <sowen@cloudera.com>

Closes apache#18635 from srowen/Scapegoat1.
checkCompact(Decimal(BigDecimal(10.03)), false)
checkCompact(Decimal(BigDecimal(1e20)), false)
checkCompact(Decimal(BigDecimal("10.03")), false)
checkCompact(Decimal(BigDecimal("100000000000000000000")), false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to write 1e20.toString

// Return false as there is another writer.
false
}
// Return false as there is another writer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still valid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants