SivaTharun commented on a change in pull request #10676:
URL: https://github.com/apache/shardingsphere/pull/10676#discussion_r650419144
##########
File path:
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/RawExecutor.java
##########
@@ -62,10 +63,8 @@
// TODO Load query header for first query
List<ExecuteResult> results = execute(executionGroupContext,
(RawSQLExecutorCallback) null, callback);
ExecuteProcessEngine.finish(executionGroupContext.getExecutionID());
- if (null == results || results.isEmpty() || null ==
results.get(0)) {
- return Collections.singleton(new UpdateResult(0, 0L));
- }
- return results;
+ return CollectionUtils.isEmpty(results) ||
Objects.isNull(results.get(0)) ? Collections
+ .singleton(new UpdateResult(0, 0L)) : results;
Review comment:
Hi @tristaZero, `CollectionUtils.isEmpty` method inside apache common,
would check for `results == null || results.isEmpty()`. That essentially would
cover both the checks. i guess you don't want to have any dependency on apache
commons library.
Also, `Objects.isNull` is the java utility method of `Objects` class, which
encompasses the change for `null == results.get(0)`. i thought of using it,
resulting in cleaner looking code.
--
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]