You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "JD Zheng (JIRA)" <ji...@apache.org> on 2017/06/14 20:46:00 UTC
[jira] [Created] (CALCITE-1843) Convert a RelOptCost to a
totally-ordered value
JD Zheng created CALCITE-1843:
---------------------------------
Summary: Convert a RelOptCost to a totally-ordered value
Key: CALCITE-1843
URL: https://issues.apache.org/jira/browse/CALCITE-1843
Project: Calcite
Issue Type: Improvement
Components: core
Reporter: JD Zheng
Assignee: Julian Hyde
Currently, we have dead code in VolcanoCost.java
{code:java}
public boolean isLe(RelOptCost other) {
VolcanoCost that = (VolcanoCost) other;
if (true) {
return this == that
|| this.rowCount <= that.rowCount;
}
return (this == that)
|| ((this.rowCount <= that.rowCount)
&& (this.cpu <= that.cpu)
&& (this.io <= that.io));
}
public boolean isLt(RelOptCost other) {
if (true) {
VolcanoCost that = (VolcanoCost) other;
return this.rowCount < that.rowCount;
}
return isLe(other) && !equals(other);
}
{code}
The reason for the “if (false)” is that we found that costs don’t work well if they form only a partial order, not a total order. If you have two RelNodes R1 and R2 in an equivalent set, and they have costs C1 and C2, and neither C1 <= C2 nor C2 <= C1 is true, which is the Volcano planner to pick? It will tend to pick the one that it saw first, and that is bad news because it is arbitrary and non-deterministic.
So, we should probably find a way to convert a RelOptCost to a totally-ordered value, such as by applying weights to cpu, io and memory cost and returning a double.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)