-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-12489][Core][SQL][MLib]Fix minor issues found by FindBugs #10440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -293,9 +293,7 @@ private class ServerConnection extends LauncherConnection { | |
| protected void handle(Message msg) throws IOException { | ||
| try { | ||
| if (msg instanceof Hello) { | ||
| synchronized (timeout) { | ||
| timeout.cancel(); | ||
| } | ||
| timeout.cancel(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| timeout = null; | ||
| Hello hello = (Hello) msg; | ||
| ChildProcAppHandle handle = pending.remove(hello.secret); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ private static class MainClassOptionParser extends SparkSubmitOptionParser { | |
|
|
||
| @Override | ||
| protected boolean handle(String opt, String value) { | ||
| if (opt == CLASS) { | ||
| if (CLASS.equals(opt)) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch |
||
| className = value; | ||
| } | ||
| return false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -386,9 +386,9 @@ private[tree] object LearningNode { | |
| var levelsToGo = indexToLevel(nodeIndex) | ||
| while (levelsToGo > 0) { | ||
| if ((nodeIndex & (1 << levelsToGo - 1)) == 0) { | ||
| tmpNode = tmpNode.leftChild.asInstanceOf[LearningNode] | ||
| tmpNode = tmpNode.leftChild.get | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkbradley was this code never run before? |
||
| } else { | ||
| tmpNode = tmpNode.rightChild.asInstanceOf[LearningNode] | ||
| tmpNode = tmpNode.rightChild.get | ||
| } | ||
| levelsToGo -= 1 | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,30 +122,35 @@ private[sql] object JDBCRDD extends Logging { | |
| val dialect = JdbcDialects.get(url) | ||
| val conn: Connection = getConnector(properties.getProperty("driver"), url, properties)() | ||
| try { | ||
| val rs = conn.prepareStatement(s"SELECT * FROM $table WHERE 1=0").executeQuery() | ||
| val statement = conn.prepareStatement(s"SELECT * FROM $table WHERE 1=0") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of changes are space changes. See https://github.com/apache/spark/pull/10440/files?w=1 |
||
| try { | ||
| val rsmd = rs.getMetaData | ||
| val ncols = rsmd.getColumnCount | ||
| val fields = new Array[StructField](ncols) | ||
| var i = 0 | ||
| while (i < ncols) { | ||
| val columnName = rsmd.getColumnLabel(i + 1) | ||
| val dataType = rsmd.getColumnType(i + 1) | ||
| val typeName = rsmd.getColumnTypeName(i + 1) | ||
| val fieldSize = rsmd.getPrecision(i + 1) | ||
| val fieldScale = rsmd.getScale(i + 1) | ||
| val isSigned = rsmd.isSigned(i + 1) | ||
| val nullable = rsmd.isNullable(i + 1) != ResultSetMetaData.columnNoNulls | ||
| val metadata = new MetadataBuilder().putString("name", columnName) | ||
| val columnType = | ||
| dialect.getCatalystType(dataType, typeName, fieldSize, metadata).getOrElse( | ||
| getCatalystType(dataType, fieldSize, fieldScale, isSigned)) | ||
| fields(i) = StructField(columnName, columnType, nullable, metadata.build()) | ||
| i = i + 1 | ||
| val rs = statement.executeQuery() | ||
| try { | ||
| val rsmd = rs.getMetaData | ||
| val ncols = rsmd.getColumnCount | ||
| val fields = new Array[StructField](ncols) | ||
| var i = 0 | ||
| while (i < ncols) { | ||
| val columnName = rsmd.getColumnLabel(i + 1) | ||
| val dataType = rsmd.getColumnType(i + 1) | ||
| val typeName = rsmd.getColumnTypeName(i + 1) | ||
| val fieldSize = rsmd.getPrecision(i + 1) | ||
| val fieldScale = rsmd.getScale(i + 1) | ||
| val isSigned = rsmd.isSigned(i + 1) | ||
| val nullable = rsmd.isNullable(i + 1) != ResultSetMetaData.columnNoNulls | ||
| val metadata = new MetadataBuilder().putString("name", columnName) | ||
| val columnType = | ||
| dialect.getCatalystType(dataType, typeName, fieldSize, metadata).getOrElse( | ||
| getCatalystType(dataType, fieldSize, fieldScale, isSigned)) | ||
| fields(i) = StructField(columnName, columnType, nullable, metadata.build()) | ||
| i = i + 1 | ||
| } | ||
| return new StructType(fields) | ||
| } finally { | ||
| rs.close() | ||
| } | ||
| return new StructType(fields) | ||
| } finally { | ||
| rs.close() | ||
| statement.close() | ||
| } | ||
| } finally { | ||
| conn.close() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary to use
ReentrantLockhere since we only usesynchronized