Changeset: eca294a19490 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eca294a19490 Added Files: sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows.32bit sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out.Darwin.32bit sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out.Windows sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out.Windows.32.bit Modified Files: MonetDB.spec clients/odbc/driver/SQLGetTypeInfo.c gdk/gdk_bbp.c monetdb5/optimizer/opt_support.c sql/backends/monet5/datacell/receptor.c sql/backends/monet5/sql.mx sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out sql/benchmarks/tpch/LOCKED/Tests/01.stable.out sql/benchmarks/tpch/LOCKED/Tests/03.stable.out sql/benchmarks/tpch/LOCKED/Tests/05.stable.out sql/benchmarks/tpch/LOCKED/Tests/06.stable.out sql/benchmarks/tpch/LOCKED/Tests/07.stable.out sql/benchmarks/tpch/LOCKED/Tests/08.stable.out sql/benchmarks/tpch/LOCKED/Tests/09.stable.out sql/benchmarks/tpch/LOCKED/Tests/10.stable.out sql/benchmarks/tpch/LOCKED/Tests/11.stable.out sql/benchmarks/tpch/LOCKED/Tests/14.stable.out sql/benchmarks/tpch/LOCKED/Tests/15.stable.out sql/benchmarks/tpch/LOCKED/Tests/19.stable.out sql/benchmarks/tpch/Tests/01-22.stable.out sql/benchmarks/tpch/Tests/01.stable.out sql/benchmarks/tpch/Tests/03.stable.out sql/benchmarks/tpch/Tests/05.stable.out sql/benchmarks/tpch/Tests/06.stable.out sql/benchmarks/tpch/Tests/07.stable.out sql/benchmarks/tpch/Tests/08.stable.out sql/benchmarks/tpch/Tests/09.stable.out sql/benchmarks/tpch/Tests/10.stable.out sql/benchmarks/tpch/Tests/11.stable.out sql/benchmarks/tpch/Tests/14.stable.out sql/benchmarks/tpch/Tests/15.stable.out sql/benchmarks/tpch/Tests/19.stable.out sql/benchmarks/tpch/fileleak/Tests/delete_all.SQL.py sql/benchmarks/tpch/fileleak/Tests/leaks.SQL.py sql/common/sql_types.c sql/server/rel_exp.c sql/server/rel_optimizer.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/sql_parser.y sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out sql/test/BugTracker-2008/Tests/mul_div_bug.SF-2075135.stable.out sql/test/BugTracker-2009/Tests/arithmetic-small-values-null.SF-2921310.stable.out sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out.32bit sql/test/BugTracker-2011/Tests/and-power.Bug-3013.stable.out sql/test/BugTracker-2011/Tests/non-stable-select-bug.Bug-2894.stable.out sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.stable.out sql/test/BugTracker-2012/Tests/power_priority.Bug-2291.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit Branch: default Log Message:
Merged with Feb2013 branch. diffs (truncated from 1539 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -271,6 +271,7 @@ Requires: %{name}-client = %{version}-%{ Requires: perl Requires: perl(DBI) Requires: perl(Digest::SHA) +Requires: perl(Digest::MD5) %description client-perl MonetDB is a database management system that is developed from a diff --git a/clients/odbc/driver/SQLGetTypeInfo.c b/clients/odbc/driver/SQLGetTypeInfo.c --- a/clients/odbc/driver/SQLGetTypeInfo.c +++ b/clients/odbc/driver/SQLGetTypeInfo.c @@ -182,7 +182,7 @@ static struct types { { "bigint", /* type_name */ SQL_BIGINT, /* data_type */ - 19, /* column_size */ + 18, /* column_size */ NULL, /* literal_prefix */ NULL, /* literal_suffix */ "precision", /* create_params */ @@ -315,7 +315,7 @@ static struct types { { "numeric", /* type_name */ SQL_NUMERIC, /* data_type */ - 19, /* column_size */ + 18, /* column_size */ NULL, /* literal_prefix */ NULL, /* literal_suffix */ "precision,scale", /* create_params */ @@ -327,7 +327,7 @@ static struct types { SQL_FALSE, /* auto_unique_value */ NULL, /* local_type_name */ 0, /* minimum_scale */ - 19, /* maximum_scale */ + 18, /* maximum_scale */ SQL_NUMERIC, /* sql_data_type */ -1, /* sql_datetime_sub */ 10, /* num_prec_radix */ @@ -337,7 +337,7 @@ static struct types { { "decimal", /* type_name */ SQL_DECIMAL, /* data_type */ - 19, /* column_size */ + 18, /* column_size */ NULL, /* literal_prefix */ NULL, /* literal_suffix */ "precision,scale", /* create_params */ @@ -349,7 +349,7 @@ static struct types { SQL_FALSE, /* auto_unique_value */ NULL, /* local_type_name */ 0, /* minimum_scale */ - 19, /* maximum_scale */ + 18, /* maximum_scale */ SQL_DECIMAL, /* sql_data_type */ -1, /* sql_datetime_sub */ 10, /* num_prec_radix */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2965,6 +2965,8 @@ BBPquickdesc(bat bid, int delaccess) { BAT *b = BBP_cache(bid); + if ( bid == 0) + return NULL; if (bid < 0) { GDKerror("BBPquickdesc: called with negative batid.\n"); assert(0); diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c --- a/monetdb5/optimizer/opt_support.c +++ b/monetdb5/optimizer/opt_support.c @@ -827,13 +827,15 @@ int isAllScalar(MalBlkPtr mb, InstrPtr p * and should be conservative. */ int isMapOp(InstrPtr p){ - return (getModuleId(p) == malRef && getFunctionId(p) == multiplexRef) || + return getModuleId(p) && + ((getModuleId(p) == malRef && getFunctionId(p) == multiplexRef) || (getModuleId(p)== batcalcRef && getFunctionId(p) != mark_grpRef && getFunctionId(p) != rank_grpRef) || (getModuleId(p)== batmtimeRef) || (getModuleId(p)== batstrRef) || (getModuleId(p)== batmmathRef) || (getModuleId(p)== batxmlRef) || - (getModuleId(p)== mkeyRef); + (strcmp(getModuleId(p),"batsql") == 0) || + (getModuleId(p)== mkeyRef)); } int isLikeOp(InstrPtr p){ diff --git a/sql/backends/monet5/datacell/receptor.c b/sql/backends/monet5/datacell/receptor.c --- a/sql/backends/monet5/datacell/receptor.c +++ b/sql/backends/monet5/datacell/receptor.c @@ -606,7 +606,7 @@ bodyRestart: read it*/ if ((n = mnstr_readline(receptor, buf, MYBUFSIZ)) > 0) { - buf[n + 1] = 0; + buf[n] = 0; #ifdef _DEBUG_RECEPTOR_ mnstr_printf(RCout, "#Receptor buf [" SSZFMT "]:%s \n", n, buf); m = 0; @@ -634,7 +634,7 @@ bodyRestart: /* this code should be optimized for block-based reads */ while (cnt < counter) { if ((n = mnstr_readline(receptor, buf, MYBUFSIZ)) > 0) { - buf[n + 1] = 0; + buf[n] = 0; #ifdef _DEBUG_RECEPTOR_ mnstr_printf(RCout, "#Receptor buf [" SSZFMT "]:%s \n", n, buf); #endif diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx --- a/sql/backends/monet5/sql.mx +++ b/sql/backends/monet5/sql.mx @@ -696,11 +696,15 @@ comment "truncate the floating point v t @:mal_fround(dbl)@ command sql.alpha(dec:dbl, theta:dbl) :dbl -address SQLdbl_alpha +address SQLcst_alpha_cst comment "Implementation of astronomy alpha function: expands the radius theta depending on the declination"; command batsql.alpha(dec:bat[:oid,:dbl], theta:dbl) :bat[:oid,:dbl] -address SQLbat_alpha +address SQLbat_alpha_cst +comment "BAT implementation of astronomy alpha function"; + +command batsql.alpha(dec:dbl, theta:bat[:oid,:dbl]) :bat[:oid,:dbl] +address SQLcst_alpha_bat comment "BAT implementation of astronomy alpha function"; @= mal_cast @@ -1479,8 +1483,9 @@ sql5_export str @1_trunc_wrap( @1 *res, @:fround_export(dbl)@ #define radians(x) ((x) * 3.14159265358979323846 /180.0 ) #define degrees(x) ((x) * 180.0/3.14159265358979323846 ) -sql5_export str SQLdbl_alpha(dbl *res, dbl *decl, dbl *theta); -sql5_export str SQLbat_alpha(bat *res, bat *decl, dbl *theta); +sql5_export str SQLcst_alpha_cst(dbl *res, dbl *decl, dbl *theta); +sql5_export str SQLbat_alpha_cst(bat *res, bat *decl, dbl *theta); +sql5_export str SQLcst_alpha_bat(bat *res, dbl *decl, bat *theta); sql5_export str month_interval(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str second_interval(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str month_interval_daytime( int *ret, daytime *s, int *ek, int *sk ); @@ -4196,17 +4201,18 @@ mvc_import_table_wrap(Client cntxt, MalB #else s = bstream_create(ss, 0x2000000); #endif - if (!s) - throw(IO, "bstreams.create", "failed to create block stream"); - b = mvc_import_table(cntxt, be->mvc, s, *sname, *tname, (char*)tsep, (char*)rsep, (char*)ssep, (char*)ns, *sz, *offset, *locked); - bstream_destroy(s); + if (s != NULL) + b = mvc_import_table(cntxt, be->mvc, s, *sname, *tname, (char*)tsep, (char*)rsep, (char*)ssep, (char*)ns, *sz, *offset, *locked); + bstream_destroy(s); GDKfree(filename); GDKfree(tsep); GDKfree(rsep); - if(ssep) + if (ssep) GDKfree(ssep); GDKfree(ns); - if (!b) + if (s == NULL) + throw(IO, "bstreams.create", "failed to create block stream"); + if (b == NULL) throw(SQL, "importTable", "%sfailed to import table", be->mvc->errstr); bat2return(stk, pci, b); GDKfree(b); @@ -5068,7 +5074,7 @@ str @:fround(dbl)@ str -SQLdbl_alpha(dbl *res, dbl *decl, dbl *theta) +SQLcst_alpha_cst(dbl *res, dbl *decl, dbl *theta) { dbl s, c1, c2; char *msg = MAL_SUCCEED; @@ -5085,8 +5091,14 @@ SQLdbl_alpha(dbl *res, dbl *decl, dbl *t } return msg; } + +/* +sql5_export str SQLcst_alpha_cst(dbl *res, dbl *decl, dbl *theta); +sql5_export str SQLbat_alpha_cst(bat *res, bat *decl, dbl *theta); +sql5_export str SQLcst_alpha_bat(bat *res, dbl *decl, bat *theta); +*/ str -SQLbat_alpha(bat *res, bat *decl, dbl *theta) +SQLbat_alpha_cst(bat *res, bat *decl, dbl *theta) { BAT *b, *bn; BATiter bi; @@ -5125,6 +5137,45 @@ SQLbat_alpha(bat *res, bat *decl, dbl *t BBPunfix(b->batCacheid); return msg; } +str +SQLcst_alpha_bat(bat *res, dbl *decl, bat *theta) +{ + BAT *b, *bn; + BATiter bi; + BUN p,q; + dbl s, c1, c2, r; + char *msg = NULL; + + if( (b = BATdescriptor(*theta)) == NULL ){ + throw(SQL, "alpha", "Cannot access descriptor"); + } + bi = bat_iterator(b); + bn = BATnew(b->htype, TYPE_dbl, BATcount(b)); + if( bn == NULL){ + BBPreleaseref(b->batCacheid); + throw(SQL, "sql.alpha", MAL_MALLOC_FAIL); + } + BATseqbase(bn, b->hseqbase); + BATloop(b,p,q) { + dbl d = *decl; + dbl *theta = (dbl*)BUNtail(bi,p); + + if (d == dbl_nil) + r = dbl_nil; + else if (fabs(d) + *theta > 89.9 ) + r = (dbl) 180.0; + else { + s = sin(radians(*theta)); + c1 = cos(radians(d - *theta)); + c2 = cos(radians(d + *theta)); + r = degrees(fabs(atan(s / sqrt(fabs(c1 * c2))))); + } + BUNins(bn, BUNhead(bi,p), &r, FALSE); + } + BBPkeepref( *res = bn->batCacheid); + BBPunfix(b->batCacheid); + return msg; +} #if SIZEOF_WRD == SIZEOF_INT #define wrdToStr(sptr, lptr, p) intToStr(sptr, lptr, (int*)p) diff --git a/sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out b/sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out --- a/sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out +++ b/sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out @@ -52,7 +52,7 @@ Ready. % sys.lineitem, sys.lineitem, sys.L1, sys.L2, sys.L3, sys.L4, sys.L5, sys.L6, sys.L7, sys.L10 # table_name % l_returnflag, l_linestatus, sum_qty, sum_base_price, sum_disc_price, sum_charge, avg_qty, avg_price, avg_disc, count_order # name % varchar, varchar, bigint, decimal, decimal, decimal, double, double, double, wrd # type -% 1, 1, 6, 17, 21, 21, 24, 24, 24, 5 # length +% 1, 1, 6, 17, 20, 20, 24, 24, 24, 5 # length [ "A", "F", 380456, 532348211.65, 505822441.4861, 526165934.000839, 25.57515461, 35785.70931, 0.05008133907, 14876 ] [ "N", "F", 8971, 12384801.37, 11798257.2080, 12282485.056933, 25.77873563, 35588.50968, 0.04775862069, 348 ] [ "N", "O", 742802, 1041502841.45, 989737518.6346, 1029418531.523350, 25.45498783, 35691.12921, 0.04993111956, 29181 ] @@ -111,7 +111,7 @@ Ready. % sys.lineitem, sys.L1, sys.orders, sys.orders # table_name % l_orderkey, revenue, o_orderdate, o_shippriority # name % int, decimal, date, int # type -% 5, 21, 10, 1 # length +% 5, 20, 10, 1 # length [ 47714, 267010.5894, 1995-03-11, 0 ] [ 22276, 266351.5562, 1995-01-29, 0 ] [ 32965, 263768.3414, 1995-02-25, 0 ] @@ -199,7 +199,7 @@ Ready. % sys.nation, sys.L1 # table_name % n_name, revenue # name % varchar, decimal # type -% 9, 21 # length +% 9, 20 # length [ "VIETNAM", 1000926.6999 ] [ "CHINA", 740210.7570 ] [ "JAPAN", 660651.2425 ] @@ -227,7 +227,7 @@ Ready. % sys.L1 # table_name % revenue # name % decimal # type -% 21 # length +% 20 # length [ 1193053.2253 ] % .stats, .stats # table_name % rewrite, count # name @@ -269,7 +269,7 @@ Ready. % sys.shipping, sys.shipping, sys.shipping, sys.L1 # table_name % supp_nation, cust_nation, l_year, revenue # name % varchar, varchar, int, decimal # type -% 7, 7, 4, 21 # length +% 7, 7, 4, 20 # length [ "FRANCE", "GERMANY", 1995, 268068.5774 ] [ "FRANCE", "GERMANY", 1996, 303862.2980 ] [ "GERMANY", "FRANCE", 1995, 621159.4882 ] @@ -315,7 +315,7 @@ Ready. % sys.all_nations, sys.L3 # table_name % o_year, mkt_share # name % int, decimal # type -% 4, 21 # length +% 4, 20 # length [ 1995, 0.0000 ] [ 1996, 0.0000 ] % .stats, .stats # table_name @@ -357,7 +357,7 @@ Ready. _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list