Changeset: 21a781ce6ff6 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=21a781ce6ff6 Modified Files: pathfinder/compiler/sql/lalg2sql.brg Branch: default Log Message:
Merge git master into default diffs (113 lines): diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/algebra/opt/opt_algebra_cse.c --- a/pathfinder/compiler/algebra/opt/opt_algebra_cse.c Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/algebra/opt/opt_algebra_cse.c Tue Jul 13 17:51:47 2010 +0200 @@ -974,9 +974,9 @@ case la_bool_and: case la_bool_or: case la_to: - if ((ACTCOL (L(a), a->sem.binary.col1) && - ACTCOL (L(b), b->sem.binary.col1)) == - (ACTCOL (L(a), a->sem.binary.col2) && + if ((ACTCOL (L(a), a->sem.binary.col1) == + ACTCOL (L(b), b->sem.binary.col1)) && + (ACTCOL (L(a), a->sem.binary.col2) == ACTCOL (L(b), b->sem.binary.col2))) return true ; diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/algebra/opt/opt_reqval.c --- a/pathfinder/compiler/algebra/opt/opt_reqval.c Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/algebra/opt/opt_reqval.c Tue Jul 13 17:51:47 2010 +0200 @@ -123,10 +123,11 @@ PFprop_req_rank_col (p->prop, p->sem.sort.res)) *p = *rank (L(p), p->sem.sort.res, p->sem.sort.sortby); else if (p->kind == la_rowrank && - PFprop_req_multi_col_col (p->prop, p->sem.sort.res) && + (PFprop_req_bijective_col (p->prop, p->sem.sort.res) || + (PFprop_req_multi_col_col (p->prop, p->sem.sort.res) && /* single ascending order criterion */ + PFord_order_dir_at (p->sem.sort.sortby, 0) == DIR_ASC)) && PFord_count (p->sem.sort.sortby) == 1 && - PFord_order_dir_at (p->sem.sort.sortby, 0) == DIR_ASC && /* sort criterion should not stem from a rank operator */ PFprop_type_of (p, PFord_order_col_at (p->sem.sort.sortby, 0)) != aat_nat) { diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/debug/logdebug.c --- a/pathfinder/compiler/debug/logdebug.c Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/debug/logdebug.c Tue Jul 13 17:51:47 2010 +0200 @@ -348,6 +348,7 @@ case aat_bln: PFarray_printf (s, "bool"); break; case aat_uA: PFarray_printf (s, "uA"); break; case aat_qname_id: PFarray_printf (s, "qname"); break; + case aat_date: PFarray_printf (s, "date"); break; case aat_attr: PFarray_printf (s, "attr"); break; case aat_nkind: PFarray_printf (s, "pnode"); break; default: break; diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/sql/lalg2sql.brg --- a/pathfinder/compiler/sql/lalg2sql.brg Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/sql/lalg2sql.brg Tue Jul 13 17:51:47 2010 +0200 @@ -585,7 +585,8 @@ ty == aat_dbl || ty == aat_dec || ty == aat_str || ty == aat_uA || ty == aat_bln || ty == aat_pre || - ty == aat_qname_loc || ty == aat_qname_uri); + ty == aat_qname_loc || ty == aat_qname_uri || + ty == aat_date); *(sql_column_env_t *) PFarray_add (env) = (sql_column_env_t) { .type = ty, @@ -1848,6 +1849,7 @@ (t == aat_uA)) #define NUM_NOTEXPR(t) ((t == aat_int)) #define BOOL_TYPE(t) (t == aat_bln) + #define DATE_TYPE(t) (t == aat_date) /* Since we handle untypedAtomic and Strings the same * way in SQL, its obvious we don't have to @@ -1877,6 +1879,11 @@ else if (CHAR_TYPE (ty) && NUM_NOTEXPR (res_ty)) expr = cast (expr, type (aat_dbl)); + /* ensure that the cast to date only gets a string as input */ + if (DATE_TYPE (res_ty) && !CHAR_TYPE (ty)) + PFoops (OOPS_FATAL, + "can only cast values of type string to a date"); + return cast (expr, type (res_ty)); } diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/sql/sqlprint.c --- a/pathfinder/compiler/sql/sqlprint.c Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/sql/sqlprint.c Tue Jul 13 17:51:47 2010 +0200 @@ -652,10 +652,17 @@ case sql_cast: assert (R(n)->kind == sql_type); - PFprettyprintf ("CAST("); - print_statement (L(n)); - PFprettyprintf (" AS %s)", - PFsql_simple_type_str (R(n)->sem.type.t)); + if (R(n)->sem.type.t == aat_date) { + PFprettyprintf ("date ("); + print_statement (L(n)); + PFprettyprintf (")"); + } + else { + PFprettyprintf ("CAST("); + print_statement (L(n)); + PFprettyprintf (" AS %s)", + PFsql_simple_type_str (R(n)->sem.type.t)); + } break; case sql_schema_tbl_name: diff -r 5c23515c4b2c -r 21a781ce6ff6 pathfinder/compiler/xmlimport/xml2lalg_converters.c --- a/pathfinder/compiler/xmlimport/xml2lalg_converters.c Tue Jul 13 17:24:57 2010 +0200 +++ b/pathfinder/compiler/xmlimport/xml2lalg_converters.c Tue Jul 13 17:51:47 2010 +0200 @@ -241,6 +241,7 @@ else if (strcmp(typeString, "bool") == 0) return aat_bln; else if (strcmp(typeString, "uA") == 0) return aat_uA; else if (strcmp(typeString, "qname") == 0) return aat_qname; + else if (strcmp(typeString, "date")== 0) return aat_date; else if (strcmp(typeString, "node")== 0) return aat_node; else if (strcmp(typeString, "attr")== 0) return aat_anode; else if (strcmp(typeString, "pnode") == 0) return aat_pnode; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list