SQL: Fix checkstyle in sql/rule package (elastic/x-pack-elasticsearch#3446)

* Replaces long line comment with rewritten javadoc with nice line feeds
* Adds some line breaks in a few log lines

Original commit: elastic/x-pack-elasticsearch@00dc7cc9c8
This commit is contained in:
Nik Everett 2017-12-29 14:44:21 -05:00 committed by GitHub
parent 92a55df8e6
commit 5dcde97fdf
2 changed files with 23 additions and 26 deletions

View File

@ -12,17 +12,14 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.xpack.sql.tree.Node;
import org.elasticsearch.xpack.sql.util.ReflectionUtils;
// Rule class that applies a transformation to a tree.
// In addition, performs type filtering so that a rule that works only on a type node can be skipped if necessary just based on the class signature.
// Implementation detail:
// While lambdas are nice, actual node rules tend to be fairly large and are much better suited as full blown classes.
// In addition as they already embed their type information (all rule implementations end up with the generic information on them)
// this can be leveraged to perform the type filtering (as mentioned above).
// As a side note, getting the generic information from lambdas is very hacky and not portable (not without completely messing the JVM SM)
// apply - indicates how to apply the rule (transformUp/Down, transformExpressions..) on the target
// rule - contains the actual rule logic.
/**
* Rules that apply transformation to a tree. In addition, performs
* type filtering so that a rule that the rule implementation doesn't
* have to manually filter.
* <p>
* Rules <strong>could</strong> could be built as lambdas but most
* rules are much larger so we keep them as full blown subclasses.
*/
public abstract class Rule<E extends T, T extends Node<T>> implements UnaryOperator<T> {
protected Logger log = Loggers.getLogger(getClass());

View File

@ -180,14 +180,14 @@ public abstract class RuleExecutor<TreeType extends Node<TreeType>> {
before = tfs.get(0).before;
after = tfs.get(tfs.size() - 1).after;
}
log.trace("Batch {} applied took {}\n{}", batch.name, TimeValue.timeValueMillis(batchDuration), NodeUtils.diffString(before, after));
log.trace("Batch {} applied took {}\n{}",
batch.name, TimeValue.timeValueMillis(batchDuration), NodeUtils.diffString(before, after));
}
}
if (!currentPlan.equals(plan)) {
if (log.isDebugEnabled()) {
log.debug("Tree transformation took {}\n{}", TimeValue.timeValueMillis(totalDuration), NodeUtils.diffString(plan, currentPlan));
}
if (false == currentPlan.equals(plan) && log.isDebugEnabled()) {
log.debug("Tree transformation took {}\n{}",
TimeValue.timeValueMillis(totalDuration), NodeUtils.diffString(plan, currentPlan));
}
return new ExecutionInfo(plan, currentPlan, transformations);