You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Maryann Xue (JIRA)" <ji...@apache.org> on 2016/03/23 21:53:25 UTC

[jira] [Created] (CALCITE-1165) VocanoCost comparing floating point numbers might cause problems in a few places

Maryann Xue created CALCITE-1165:
------------------------------------

             Summary: VocanoCost comparing floating point numbers might cause problems in a few places
                 Key: CALCITE-1165
                 URL: https://issues.apache.org/jira/browse/CALCITE-1165
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.7.0
            Reporter: Maryann Xue
            Assignee: Julian Hyde
            Priority: Minor


The floating number comparison can be inaccurate and can break some logic in VolcanoPlanner. For example,
1) VolcanoPlanner.validate(): 
{code}
        for (RelNode rel : subset.getRels()) {
          RelOptCost relCost = getCost(rel, mq);
          if (relCost.isLt(subset.bestCost)) {
            throw new AssertionError(
                "rel [" + rel.getDescription()
                + "] has lower cost " + relCost
                + " than best cost " + subset.bestCost
                + " of subset [" + subset.getDescription() + "]");
          }
        }
{code}
2) VolcanoPlanner.getCost(RelNode, RelMetadataQuery)
{code}
    RelOptCost cost = mq.getNonCumulativeCost(rel);
    if (!zeroCost.isLt(cost)) {
      // cost must be positive, so nudge it
      cost = costFactory.makeTinyCost();
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)