You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/01/15 23:51:46 UTC

incubator-calcite git commit: Oops; fix for [CALCITE-557] should compare rule matches by importance first, class name second

Repository: incubator-calcite
Updated Branches:
  refs/heads/master d0b5e373e -> 0c052cc68


Oops; fix for [CALCITE-557] should compare rule matches by importance first, class name second


Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/0c052cc6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/0c052cc6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/0c052cc6

Branch: refs/heads/master
Commit: 0c052cc68ac0e215ac53ae3fd5dae59c18eb145d
Parents: d0b5e37
Author: julianhyde <jh...@apache.org>
Authored: Thu Jan 15 11:25:00 2015 -0800
Committer: julianhyde <jh...@apache.org>
Committed: Thu Jan 15 11:25:00 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/calcite/plan/volcano/RuleQueue.java   | 10 +++++-----
 core/src/test/resources/sql/misc.oq                       |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/0c052cc6/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index 642ab59..bce60ab 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -653,14 +653,14 @@ class RuleQueue {
       implements Comparator<VolcanoRuleMatch> {
     public int compare(VolcanoRuleMatch match1,
         VolcanoRuleMatch match2) {
-      int c = match1.rule.getClass().getName()
-          .compareTo(match2.rule.getClass().getName());
+      double imp1 = match1.getImportance();
+      double imp2 = match2.getImportance();
+      int c = Double.compare(imp1, imp2);
       if (c != 0) {
         return -c;
       }
-      double imp1 = match1.getImportance();
-      double imp2 = match2.getImportance();
-      c = Double.compare(imp1, imp2);
+      c = match1.rule.getClass().getName()
+          .compareTo(match2.rule.getClass().getName());
       if (c != 0) {
         return -c;
       }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/0c052cc6/core/src/test/resources/sql/misc.oq
----------------------------------------------------------------------
diff --git a/core/src/test/resources/sql/misc.oq b/core/src/test/resources/sql/misc.oq
index 142eba6..152b827 100644
--- a/core/src/test/resources/sql/misc.oq
+++ b/core/src/test/resources/sql/misc.oq
@@ -480,7 +480,7 @@ from "sales_fact_1997" as s
   join "product_class" as pc using ("product_class_id")
 where c."city" = 'San Francisco'
  and pc."product_department" = 'Snacks';
-EnumerableCalc(expr#0..56=[{inputs}], product_id=[$t20], time_id=[$t21], customer_id=[$t22], promotion_id=[$t23], store_id=[$t24], store_sales=[$t25], store_cost=[$t26], unit_sales=[$t27], customer_id0=[$t28], account_num=[$t29], lname=[$t30], fname=[$t31], mi=[$t32], address1=[$t33], address2=[$t34], address3=[$t35], address4=[$t36], city=[$t37], state_province=[$t38], postal_code=[$t39], country=[$t40], customer_region_id=[$t41], phone1=[$t42], phone2=[$t43], birthdate=[$t44], marital_status=[$t45], yearly_income=[$t46], gender=[$t47], total_children=[$t48], num_children_at_home=[$t49], education=[$t50], date_accnt_opened=[$t51], member_card=[$t52], occupation=[$t53], houseowner=[$t54], num_cars_owned=[$t55], fullname=[$t56], product_class_id=[$t5], product_id0=[$t6], brand_name=[$t7], product_name=[$t8], SKU=[$t9], SRP=[$t10], gross_weight=[$t11], net_weight=[$t12], recyclable_package=[$t13], low_fat=[$t14], units_per_case=[$t15], cases_per_pallet=[$t16], shelf_width=[$t17], shel
 f_height=[$t18], shelf_depth=[$t19], product_class_id0=[$t0], product_subcategory=[$t1], product_category=[$t2], product_department=[$t3], product_family=[$t4])
+EnumerableCalc(expr#0..56=[{inputs}], $f0=[$t20], $f1=[$t21], $f2=[$t22], $f3=[$t23], $f4=[$t24], $f5=[$t25], $f6=[$t26], $f7=[$t27], $f8=[$t28], $f9=[$t29], $f10=[$t30], $f11=[$t31], $f12=[$t32], $f13=[$t33], $f14=[$t34], $f15=[$t35], $f16=[$t36], $f17=[$t37], $f18=[$t38], $f19=[$t39], $f20=[$t40], $f21=[$t41], $f22=[$t42], $f23=[$t43], $f24=[$t44], $f25=[$t45], $f26=[$t46], $f27=[$t47], $f28=[$t48], $f29=[$t49], $f30=[$t50], $f31=[$t51], $f32=[$t52], $f33=[$t53], $f34=[$t54], $f35=[$t55], $f36=[$t56], $f37=[$t5], $f38=[$t6], $f39=[$t7], $f40=[$t8], $f41=[$t9], $f42=[$t10], $f43=[$t11], $f44=[$t12], $f45=[$t13], $f46=[$t14], $f47=[$t15], $f48=[$t16], $f49=[$t17], $f50=[$t18], $f51=[$t19], $f52=[$t0], $f53=[$t1], $f54=[$t2], $f55=[$t3], $f56=[$t4])
   EnumerableJoin(condition=[=($6, $20)], joinType=[inner])
     EnumerableJoin(condition=[=($0, $5)], joinType=[inner])
       EnumerableCalc(expr#0..4=[{inputs}], expr#5=['Snacks'], expr#6=[=($t3, $t5)], proj#0..4=[{exprs}], $condition=[$t6])