Changeset: a0445900a140 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a0445900a140
Modified Files:
        sql/benchmarks/tpcds/Tests/one.test.in
        sql/common/sql_types.c
        sql/server/rel_select.c
        sql/server/sql_semantic.c
Branch: cleanup_types
Log Message:

small fixes for the no hugeint case


diffs (71 lines):

diff --git a/sql/benchmarks/tpcds/Tests/one.test.in 
b/sql/benchmarks/tpcds/Tests/one.test.in
--- a/sql/benchmarks/tpcds/Tests/one.test.in
+++ b/sql/benchmarks/tpcds/Tests/one.test.in
@@ -6377,7 +6377,7 @@ 3590.470
 102.500
 3305.820
 94.400
-3501.600
+3501.603
 
 query TTIRRRRRRR rowsort
 -- query 59
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -174,7 +174,7 @@ int sql_type_convert (int from, int to)
 
 static int convert_preference_matrix[EC_MAX][EC_MAX] = {
 /* FROM,                        A,  T,  B,  C,  V,BLB,  P,  N,  M,  S,  D,  F, 
 T, TZ,  D, TS,TSZ,  G,  E */
-/* EC_ANY */     { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
10, 10, 10, 10 },/*NULL*/
+/* EC_ANY */     { 10, 10, 10, 10, 10, 10, 10, 10,  5,  5, 10, 10, 10, 10, 10, 
10, 10, 10, 10 },/*NULL*/
 /* EC_TABLE */   { 10,  0,  0, -1, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
 0,  0,  0,  0 },
 /* EC_BIT */     { 10,  0, 99, -1, -1,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0, 
 0,  0,  0,  0 },
 /* EC_CHAR */    { 10,  0,-10, 99, 20,-10,  0, -1,  0,  0,  
0,-99,-10,-10,-10,-10,-10,-10,-10 },
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -408,7 +408,7 @@ exp_fix_scale(mvc *sql, sql_subtype *ct,
                                return e;
                        sql_subtype st;
                        int scale = ct->scale;
-                       int digits = et->digits-et->scale+scale;
+                       int digits = ((et->type->eclass == 
EC_NUM)?bits2digits(et->digits):et->digits)-et->scale+scale;
                        (void)sql_find_subtype(&st, ct->type->base.name, 
digits, scale);
                        return exp_convert(sql->sa, e, et, &st);
                }
@@ -497,7 +497,6 @@ check_arguments_and_find_largest_any_typ
                        return NULL;
                if (sf->func->fix_scale == SCALE_FIX) {
                        ntp = sql_create_subtype(sql->sa, 
a->type.type->localtype?a->type.type:t?t->type:atp->type, digits, scale);
-
                        e = exp_fix_scale(sql, ntp, e);
                } else if (sf->func->fix_scale == SCALE_EQ) {
                        e = exp_fix_scale(sql, &a->type, e);
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -511,10 +511,10 @@ score_func( sql_func *f, list *tl, bool 
                        score++;
                        if (ec == EC_DEC)
                                return 0;
-                       if (a && EC_NUMBER(ec))
+                       if (a && EC_NUMBER(ec) && !EC_INTERVAL(ec))
                                score += a->type.type->localtype * 10; /* 
premium on larger types */
                        else if (a) /* all other types */
-                               score += 110;
+                               score += 109;
                        continue;
                }
 
@@ -525,6 +525,10 @@ score_func( sql_func *f, list *tl, bool 
                        t->type->eclass == EC_EXTERNAL &&
                        t->type->localtype == a->type.type->localtype)
                                nscore = 10;
+               if (nscore &&
+                       t->type->eclass == EC_NUM && a->type.type->eclass == 
EC_DEC &&
+                       t->type->localtype > a->type.type->localtype)
+                       *downcast = true;
                if (nscore == 0)
                        return 0;
                nscore *= 100; /* first based on prefered conversions */
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to