Github user arina-ielchiieva commented on a diff in the pull request:
https://github.com/apache/drill/pull/990#discussion_r144603055
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/PhysicalPlan.java
---
@@ -94,6 +94,14 @@ public double totalCost() {
for (final PhysicalOperator ops : getSortedOperators()) {
totalCost += ops.getCost();
}
+
+ // As it turns out, sometimes the total cost can be out of range.
+ // This throws off other code, so clamp the cost at the maximum
+ // double value.
+
+ if (Double.isNaN(totalCost)) {
+ totalCost = Double.MAX_VALUE;
--- End diff --
May be better to replace with 0 or negative number, like -1 (like the
second option better). Won't be max double value confusing in this case? It's
just nan is not a number and replace it with double max value.
---