Changeset: 7d0954476c7a for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7d0954476c7a Modified Files: clients/Tests/SQL-dump.stable.out clients/Tests/SQL-dump.stable.out.int128 common/utils/msabaoth.c monetdb5/extras/rapi/rapi.c sql/scripts/27_rejects.sql sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions.stable.out.int128 Branch: default Log Message:
Merge with Jul2015 branch. diffs (truncated from 375 to 300 lines): diff --git a/clients/Tests/SQL-dump.stable.out b/clients/Tests/SQL-dump.stable.out --- a/clients/Tests/SQL-dump.stable.out +++ b/clients/Tests/SQL-dump.stable.out @@ -7047,7 +7047,7 @@ 5813 "stop" "create procedure sys.stop(t 5816 "pause" "create procedure sys.pause(tag bigint)\nexternal name sql.sysmon_pause;" "sql" 1 2 true false false 2000 5819 "resume" "create procedure sys.resume(tag bigint)\nexternal name sql.sysmon_resume;" "sql" 1 2 true false false 2000 5822 "stop" "create procedure sys.stop(tag bigint)\nexternal name sql.sysmon_stop;" "sql" 1 2 true false false 2000 -5825 "rejects" "-- The contents of this file are subject to the MonetDB Public License\n-- Version 1.1 (the ""License""); you may not use this file except in\n-- compliance with the License. You may obtain a copy of the License at\n-- http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under the License is distributed on an ""AS IS""\n-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the\n-- License for the specific language governing rights and limitations\n-- under the License.\n--\n-- The Original Code is the MonetDB Database System.\n--\n-- The Initial Developer of the Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 2008 CWI.\n-- Copyright August 2008-2014 MonetDB B.V.\n-- All Rights Reserved.\n\n-- COPY into reject management\n\ncreate function sys.rejects()\nreturns table(\n\trowid bigint,\n\tfldid int,\n\t""message"" string,\n\t""input"" string\n)\nexternal name sql.copy_rejects;" "sql" 1 5 false false fa lse 2000 +5825 "rejects" "-- This Source Code Form is subject to the terms of the Mozilla Public\n-- License, v. 2.0. If a copy of the MPL was not distributed with this\n-- file, You can obtain one at http://mozilla.org/MPL/2.0/.\n--\n-- Copyright 2008-2015 MonetDB B.V.\n\n-- COPY into reject management\n\ncreate function sys.rejects()\nreturns table(\n\trowid bigint,\n\tfldid int,\n\t""message"" string,\n\t""input"" string\n)\nexternal name sql.copy_rejects;" "sql" 1 5 false false false 2000 5837 "clearrejects" "create procedure sys.clearrejects()\nexternal name sql.copy_rejects_clear;" "sql" 1 2 true false false 2000 5839 "stddev_samp" "-- This Source Code Form is subject to the terms of the Mozilla Public\n-- License, v. 2.0. If a copy of the MPL was not distributed with this\n-- file, You can obtain one at http://mozilla.org/MPL/2.0/.\n--\n-- Copyright 2008-2015 MonetDB B.V.\n\ncreate aggregate stddev_samp(val tinyint) returns double\n\texternal name ""aggr"".""stdev"";" "aggr" 1 3 false false false 2000 5843 "stddev_samp" "create aggregate stddev_samp(val smallint) returns double\n\texternal name ""aggr"".""stdev"";" "aggr" 1 3 false false false 2000 diff --git a/clients/Tests/SQL-dump.stable.out.int128 b/clients/Tests/SQL-dump.stable.out.int128 --- a/clients/Tests/SQL-dump.stable.out.int128 +++ b/clients/Tests/SQL-dump.stable.out.int128 @@ -7727,7 +7727,7 @@ 6266 "stop" "create procedure sys.stop(t 6269 "pause" "create procedure sys.pause(tag bigint)\nexternal name sql.sysmon_pause;" "sql" 1 2 true false false 2000 6272 "resume" "create procedure sys.resume(tag bigint)\nexternal name sql.sysmon_resume;" "sql" 1 2 true false false 2000 6275 "stop" "create procedure sys.stop(tag bigint)\nexternal name sql.sysmon_stop;" "sql" 1 2 true false false 2000 -6278 "rejects" "-- The contents of this file are subject to the MonetDB Public License\n-- Version 1.1 (the ""License""); you may not use this file except in\n-- compliance with the License. You may obtain a copy of the License at\n-- http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under the License is distributed on an ""AS IS""\n-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the\n-- License for the specific language governing rights and limitations\n-- under the License.\n--\n-- The Original Code is the MonetDB Database System.\n--\n-- The Initial Developer of the Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 2008 CWI.\n-- Copyright August 2008-2014 MonetDB B.V.\n-- All Rights Reserved.\n\n-- COPY into reject management\n\ncreate function sys.rejects()\nreturns table(\n\trowid bigint,\n\tfldid int,\n\t""message"" string,\n\t""input"" string\n)\nexternal name sql.copy_rejects;" "sql" 1 5 false false fa lse 2000 +6278 "rejects" "-- This Source Code Form is subject to the terms of the Mozilla Public\n-- License, v. 2.0. If a copy of the MPL was not distributed with this\n-- file, You can obtain one at http://mozilla.org/MPL/2.0/.\n--\n-- Copyright 2008-2015 MonetDB B.V.\n\n-- COPY into reject management\n\ncreate function sys.rejects()\nreturns table(\n\trowid bigint,\n\tfldid int,\n\t""message"" string,\n\t""input"" string\n)\nexternal name sql.copy_rejects;" "sql" 1 5 false false false 2000 6290 "clearrejects" "create procedure sys.clearrejects()\nexternal name sql.copy_rejects_clear;" "sql" 1 2 true false false 2000 6292 "stddev_samp" "-- This Source Code Form is subject to the terms of the Mozilla Public\n-- License, v. 2.0. If a copy of the MPL was not distributed with this\n-- file, You can obtain one at http://mozilla.org/MPL/2.0/.\n--\n-- Copyright 2008-2015 MonetDB B.V.\n\ncreate aggregate stddev_samp(val tinyint) returns double\n\texternal name ""aggr"".""stdev"";" "aggr" 1 3 false false false 2000 6296 "stddev_samp" "create aggregate stddev_samp(val smallint) returns double\n\texternal name ""aggr"".""stdev"";" "aggr" 1 3 false false false 2000 diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c --- a/common/utils/msabaoth.c +++ b/common/utils/msabaoth.c @@ -678,8 +678,8 @@ msab_getStatus(sabdb** ret, char *dbname * sufficient to see if reparsing is necessary. The gdk_lock always has * to be checked to detect crashes. */ - sabdb *sdb, *top; - sdb = top = *ret = NULL; + sabdb *sdb; + sdb = *ret = NULL; /* scan the parent for directories */ if ((p = getFarmPath(pathbuf, sizeof(pathbuf), NULL)) != NULL) @@ -700,12 +700,10 @@ msab_getStatus(sabdb** ret, char *dbname continue; sdb = msab_getSingleStatus(pathbuf, e->d_name, sdb); - if (top == NULL) - top = sdb; } (void)closedir(d); - *ret = top; + *ret = sdb; return(NULL); } diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c --- a/monetdb5/extras/rapi/rapi.c +++ b/monetdb5/extras/rapi/rapi.c @@ -153,7 +153,7 @@ void clearRErrConsole(void) { // Do nothing? } -int RAPIinstalladdons(void); +static char *RAPIinstalladdons(void); /* UNIX-like initialization */ #ifndef WIN32 @@ -162,8 +162,10 @@ int RAPIinstalladdons(void); #define CSTACK_DEFNS 1 #include <Rinterface.h> -static int RAPIinitialize(void) { +static char *RAPIinitialize(void) { // TODO: check for header/library version mismatch? + char *e; + // set R_HOME for packages etc. We know this from our configure script setenv("R_HOME", RHOME, TRUE); @@ -186,7 +188,7 @@ static int RAPIinitialize(void) { Rp->NoRenviron = TRUE; stat = Rf_initialize_R(2, rargv); if (stat < 0) { - return 2; + return "Rf_initialize failed"; } R_SetParams(Rp); } @@ -207,8 +209,8 @@ static int RAPIinitialize(void) { // big boy here setup_Rmainloop(); - if (RAPIinstalladdons() != 0) { - return 3; + if ((e = RAPIinstalladdons()) != 0) { + return e; } // patch R internals to disallow quit and system. Setting them to NULL produces an error. SET_INTERNAL(install("quit"), R_NilValue); @@ -216,7 +218,7 @@ static int RAPIinitialize(void) { //SET_INTERNAL(install("system"), R_NilValue); rapiInitialized++; - return 0; + return NULL; } #else /* Completely different Windows initialization */ @@ -280,23 +282,20 @@ static void my_onintr(int sig) //extern Rboolean R_LoadRconsole; -int RAPIinitialize(void) { +static char *RAPIinitialize(void) { structRstart rp; Rstart Rp = &rp; char Rversion[25], *RHome; snprintf(Rversion, 25, "%s.%s", R_MAJOR, R_MINOR); if(strncmp(getDLLVersion(), Rversion, 25) != 0) { - fprintf(stderr, "Error: R.DLL version does not match\n"); - exit(1); + return "Error: R.DLL version does not match"; } R_setStartTime(); R_DefParams(Rp); if((RHome = get_R_HOME()) == NULL) { - fprintf(stderr, - "R_HOME must be set in the environment or Registry\n"); - exit(2); + return "R_HOME must be set in the environment or Registry"; } Rp->rhome = RHome; Rp->home = getRUser(); @@ -333,7 +332,7 @@ void initRinside() { #endif -int RAPIinstalladdons(void) { +static char *RAPIinstalladdons(void) { int evalErr; ParseStatus status; char rlibs[BUFSIZ]; @@ -345,7 +344,7 @@ int RAPIinstalladdons(void) { "rapi_packages"); if (mkdir(rlibs, S_IRWXU) != 0 && errno != EEXIST) { - return 4; + return "cannot create rapi_packages directory"; } #ifdef _RAPI_DEBUG_ printf("# R libraries installed in %s\n",rlibs); @@ -359,6 +358,14 @@ int RAPIinstalladdons(void) { // run rapi.R environment setup script snprintf(rapiinclude, sizeof(rapiinclude), "source(\"%s\")", locate_file("rapi", ".R", 0)); +#if DIR_SEP != '/' + { + char *p; + for (p = rapiinclude; *p; p++) + if (*p == DIR_SEP) + *p = '/'; + } +#endif R_tryEvalSilent( VECTOR_ELT( R_ParseVector(mkString(rapiinclude), 1, &status, @@ -366,9 +373,9 @@ int RAPIinstalladdons(void) { // of course the script may contain errors as well if (evalErr != FALSE) { - return 5; + return "failure running R setup script"; } - return 0; + return NULL; } rapi_export str RAPIevalStd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, @@ -749,15 +756,15 @@ str RAPIprelude(void *ret) { MT_lock_set(&rapiLock, "rapi.evaluate"); /* startup internal R environment */ if (!rapiInitialized) { - int initstatus; + char *initstatus; initstatus = RAPIinitialize(); if (initstatus != 0) { throw(MAL, "rapi.eval", - "failed to initialise R environment (%i)", initstatus); + "failed to initialise R environment (%s)", initstatus); } } MT_lock_unset(&rapiLock, "rapi.evaluate"); - fprintf(stdout, "# MonetDB/R module loaded\n"); + printf("# MonetDB/R module loaded\n"); } return MAL_SUCCEED; } diff --git a/sql/scripts/27_rejects.sql b/sql/scripts/27_rejects.sql --- a/sql/scripts/27_rejects.sql +++ b/sql/scripts/27_rejects.sql @@ -1,19 +1,8 @@ --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://www.monetdb.org/Legal/MonetDBLicense +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this +-- file, You can obtain one at http://mozilla.org/MPL/2.0/. -- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Portions created by CWI are Copyright (C) 1997-July 2008 CWI. --- Copyright August 2008-2014 MonetDB B.V. --- All Rights Reserved. +-- Copyright 2008-2015 MonetDB B.V. -- COPY into reject management diff --git a/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql b/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql --- a/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql +++ b/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql @@ -1,5 +1,67 @@ +CREATE TABLE "sys"."tbls" ( + "id" INTEGER, + "name" VARCHAR(1024), + "schema_id" INTEGER, + "query" VARCHAR(2048), + "type" SMALLINT, + "system" BOOLEAN, + "commit_action" SMALLINT, + "access" SMALLINT +); +COPY 49 RECORDS INTO "sys"."tbls" FROM stdin USING DELIMITERS '\t','\n','"'; +2001 schemas 2000 0 true 0 0 +2007 types 2000 0 true 0 0 +2016 functions 2000 0 true 0 0 +2027 args 2000 0 true 0 0 +2036 sequences 2000 0 true 0 0 +2046 dependencies 2000 0 true 0 0 +2050 connections 2000 0 true 0 0 +2059 _tables 2000 0 true 0 0 +2068 _columns 2000 0 true 0 0 +2079 keys 2000 0 true 0 0 +2086 idxs 2000 0 true 0 0 +2091 triggers 2000 0 true 0 0 +2102 objects 2000 0 true 0 0 +2107 _tables 2106 0 true 2 0 +2116 _columns 2106 0 true 2 0 +2127 keys 2106 0 true 2 0 +2134 idxs 2106 0 true 2 0 +2139 triggers 2106 0 true 2 0 +2150 objects 2106 0 true 2 0 +5659 tables 2000 "SELECT * FROM (SELECT p.*, 0 AS ""temporary"", CAST(CASE WHEN system THEN type + 10 /* system table/view */ ELSE (CASE WHEN commit_action = 0 THEN type /* table/view */ ELSE type + 20 /* global temp table */ END) END AS SMALLINT) AS table_type FROM ""sys"".""_tables"" AS p UNION ALL SELECT t.*, 1 AS ""temporary"", CAST(type + 30 /* local temp table */ AS SMALLINT) AS table_type FROM ""tmp"".""_tables"" AS t) AS tables where tables.type <> 2;" 1 true 0 0 +5670 columns 2000 "SELECT * FROM (SELECT p.* FROM ""sys"".""_columns"" AS p UNION ALL SELECT t.* FROM ""tmp"".""_columns"" AS t) AS columns;" 1 true 0 0 +5686 db_user_info 2000 0 true 0 0 +5692 users 2000 "SELECT u.""name"" AS ""name"", ui.""fullname"", ui.""default_schema"" FROM db_users() AS u LEFT JOIN ""sys"".""db_user_info"" AS ui ON u.""name"" = ui.""name"" ;" 1 true 0 0 +5696 user_role 2000 0 true 0 0 +5699 auths 2000 0 true 0 0 +5703 privileges 2000 0 true 0 0 +5925 querylog_catalog 2000 "-- create table views for convenience\ncreate view sys.querylog_catalog as select * from sys.querylog_catalog();" 1 true 0 0 +5936 querylog_calls 2000 "create view sys.querylog_calls as select * from sys.querylog_calls();" 1 true 0 0 +5954 querylog_history 2000 "create view sys.querylog_history as\nselect qd.*, ql.""start"",ql.""stop"", ql.arguments, ql.tuples, ql.run, ql.ship, ql.cpu, ql.io\nfrom sys.querylog_catalog() qd, sys.querylog_calls() ql\nwhere qd.id = ql.id and qd.owner = user;" 1 true 0 0 +5993 tracelog 2000 "create view sys.tracelog as select * from sys.tracelog();" 1 true 0 0 +6133 sessions 2000 "create view sys.sessions as select * from sys.sessions();" 1 true 0 0 +6213 optimizers 2000 "create view sys.optimizers as select * from sys.optimizers();" 1 true 0 0 +6221 environment 2000 "create view sys.environment as select * from sys.environment();" 1 true 0 0 +6259 queue 2000 "create view sys.queue as select * from sys.queue();" 1 true 0 0 +6289 rejects 2000 "create view sys.rejects as select * from sys.rejects();" 1 true 0 0 +6947 keywords 2000 0 true 0 0 +6955 table_types 2000 0 true 0 0 +6963 dependency_types 2000 0 true 0 0 +6967 netcdf_files 2000 0 true 0 0 +6973 netcdf_dims 2000 0 true 0 0 +6981 netcdf_vars 2000 0 true 0 0 +6987 netcdf_vardim 2000 0 true 0 0 +6995 netcdf_attrs 2000 0 true 0 0 +7034 storage 2000 "create view sys.""storage"" as select * from sys.""storage""();" 1 true 0 0 +7046 storagemodelinput 2000 0 true 0 0 +7094 storagemodel 2000 "create view sys.storagemodel as select * from sys.storagemodel();" 1 true 0 0 +7104 tablestoragemodel 2000 "-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum(imprints) as imprints,\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true 0 0 +7117 statistics 2000 0 true 0 0 +7245 systemfunctions 2000 0 true 0 0 create table x (s string); insert into x values('%able%'); -select name, schema_id, query, type, system, commit_action, access, s from sys._tables, x where name like s; +select name, schema_id, query, type, system, commit_action, access, s from tbls, x where name like s; drop table x; + +drop table tbls; diff --git a/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out b/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out --- a/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out +++ b/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out @@ -25,18 +25,45 @@ Ready. # 10:06:32 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-22741" "--port=34205" _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
