Baoqi commented on a change in pull request #1021: spotbugs: make map traversal
more efficient
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/1021#discussion_r335423512
##########
File path:
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
##########
@@ -355,9 +355,8 @@ private PreparedStatement
prepareStatementAndBind(Connection connection, SqlBind
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if(params != null){
- for(Integer key : params.keySet()){
- Property prop = params.get(key);
-
ParameterUtils.setInParameter(key,stmt,prop.getType(),prop.getValue());
+ for(Map.Entry<Integer, Property> entry:
sqlBinds.getParamsMap().entrySet()) {
+
ParameterUtils.setInParameter(entry.getKey(),stmt,entry.getValue().getType(),entry.getValue().getValue());
Review comment:
To make it easier to read, Here, I would sugguest to change to:
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(),
prop.getValue());
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services