Changeset: 5a0f3d236cc2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5a0f3d236cc2 Added Files: clients/examples/python/basics.py clients/examples/python/mclient-python2.py clients/examples/python/mclient-python3.py clients/examples/python/perf.py sql/test/mapi/Tests/python2_test_monetdb_sql.SQL.bat sql/test/mapi/Tests/python2_test_monetdb_sql.SQL.sh sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err sql/test/mapi/Tests/python2_test_monetdb_sql.stable.out sql/test/mapi/Tests/python3_test_monetdb_sql.SQL.bat sql/test/mapi/Tests/python3_test_monetdb_sql.SQL.sh sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err sql/test/mapi/Tests/python3_test_monetdb_sql.stable.out Removed Files: clients/python2/examples/basics.py clients/python2/examples/mclient.py clients/python2/examples/perf.py clients/python3/examples/basics.py clients/python3/examples/mclient.py clients/python3/examples/perf.py sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh sql/test/mapi/Tests/python_test_monetdb_sql.stable.err sql/test/mapi/Tests/python_test_monetdb_sql.stable.out Modified Files: clients/examples/python/sqlsample.py.in clients/python2/Makefile.ag clients/python2/test/test_control.py clients/python3/Makefile.ag clients/python3/test/test_control.py monetdb5/modules/mal/language.c monetdb5/modules/mal/language.h monetdb5/modules/mal/language.mal monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.err sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out sql/test/mapi/Tests/All testing/Mtest.py.in Branch: default Log Message:
Merged from Feb2013 diffs (truncated from 1483 to 300 lines): diff --git a/clients/python2/examples/basics.py b/clients/examples/python/basics.py rename from clients/python2/examples/basics.py rename to clients/examples/python/basics.py diff --git a/clients/python2/examples/mclient.py b/clients/examples/python/mclient-python2.py rename from clients/python2/examples/mclient.py rename to clients/examples/python/mclient-python2.py --- a/clients/python2/examples/mclient.py +++ b/clients/examples/python/mclient-python2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # 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 @@ -17,8 +17,6 @@ # Copyright August 2008-2012 MonetDB B.V. # All Rights Reserved. -# - import sys import getopt diff --git a/clients/python3/examples/mclient.py b/clients/examples/python/mclient-python3.py rename from clients/python3/examples/mclient.py rename to clients/examples/python/mclient-python3.py --- a/clients/python3/examples/mclient.py +++ b/clients/examples/python/mclient-python3.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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 diff --git a/clients/python2/examples/perf.py b/clients/examples/python/perf.py rename from clients/python2/examples/perf.py rename to clients/examples/python/perf.py diff --git a/clients/examples/python/sqlsample.py.in b/clients/examples/python/sqlsample.py.in --- a/clients/examples/python/sqlsample.py.in +++ b/clients/examples/python/sqlsample.py.in @@ -24,23 +24,23 @@ dbh = monetdb.sql.Connection(port=int(sy cursor = dbh.cursor(); cursor.execute('select 1;') -print cursor.fetchall() +print(cursor.fetchall()) cursor = dbh.cursor(); cursor.execute('select 2;') -print cursor.fetchone() +print(cursor.fetchone()) # deliberately executing a wrong SQL statement: try: cursor.execute('( xyz 1);') except monetdb.sql.OperationalError, e: - print e + print(e) cursor.execute('create table python_table (i smallint,s string);'); cursor.execute('insert into python_table values ( 3, \'three\');'); cursor.execute('insert into python_table values ( 7, \'seven\');'); cursor.execute('select * from python_table;'); -print cursor.fetchall() +print(cursor.fetchall()) s = ((0, 'row1'), (1, 'row2')) x = cursor.executemany("insert into python_table VALUES (%s, %s);", s) diff --git a/clients/python2/Makefile.ag b/clients/python2/Makefile.ag --- a/clients/python2/Makefile.ag +++ b/clients/python2/Makefile.ag @@ -20,4 +20,4 @@ python2_setup = { } EXTRA_DIST = README.rst setup.py -EXTRA_DIST_DIR = examples monetdb test +EXTRA_DIST_DIR = monetdb test diff --git a/clients/python2/test/test_control.py b/clients/python2/test/test_control.py --- a/clients/python2/test/test_control.py +++ b/clients/python2/test/test_control.py @@ -1,3 +1,20 @@ +# 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 +# +# 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-2012 MonetDB B.V. +# All Rights Reserved. + import unittest import logging diff --git a/clients/python3/Makefile.ag b/clients/python3/Makefile.ag --- a/clients/python3/Makefile.ag +++ b/clients/python3/Makefile.ag @@ -20,4 +20,4 @@ python3_setup = { } EXTRA_DIST = README.rst setup.py -EXTRA_DIST_DIR = examples monetdb test +EXTRA_DIST_DIR = monetdb test diff --git a/clients/python3/examples/basics.py b/clients/python3/examples/basics.py deleted file mode 100644 --- a/clients/python3/examples/basics.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 -# -# 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-2012 MonetDB B.V. -# All Rights Reserved. - -import logging - -#configure the logger, so we can see what is happening -logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger('monetdb') - -try: - import monetdb.sql -except ImportError: - # running examples from development tree - import sys - import os - parent = os.path.join(sys.path[0], os.pardir) - sys.path.append(parent) - import monetdb.sql - - -x = monetdb.sql.connect(username="monetdb", password="monetdb", hostname="localhost", database="demo") -c = x.cursor() - -# some basic query -c.arraysize=100 -c.execute('select * from tables') -results = c.fetchall() -x.commit() -print(results) diff --git a/clients/python3/examples/perf.py b/clients/python3/examples/perf.py deleted file mode 100644 --- a/clients/python3/examples/perf.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 -# -# 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-2012 MonetDB B.V. -# All Rights Reserved. - - -import time - -#configure the logger, so we can see what is happening -#import logging -#logging.basicConfig(level=logging.DEBUG) -#logger = logging.getLogger('monetdb') - - -try: - import monetdb.sql -except ImportError: - # running examples from development tree - import sys - import os - parent = os.path.join(sys.path[0], os.pardir) - sys.path.append(parent) - import monetdb.sql - -t = time.time() -x = monetdb.sql.connect(database="demo") -c = x.cursor() -c.arraysize=10000 -c.execute('select * from tables, tables') -results = c.fetchall() diff --git a/clients/python3/test/test_control.py b/clients/python3/test/test_control.py --- a/clients/python3/test/test_control.py +++ b/clients/python3/test/test_control.py @@ -1,3 +1,20 @@ +# 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 +# +# 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-2012 MonetDB B.V. +# All Rights Reserved. + import unittest from monetdb.control import Control from monetdb.exceptions import OperationalError @@ -116,4 +133,4 @@ class TestManage(unittest.TestCase): neighbours if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/monetdb5/modules/mal/language.c b/monetdb5/modules/mal/language.c --- a/monetdb5/modules/mal/language.c +++ b/monetdb5/modules/mal/language.c @@ -138,6 +138,19 @@ MALstartDataflow( Client cntxt, MalBlkPt return msg; } +/* + * Garbage collection over variables can be postponed by grouping + * all dependent ones in a single sink() instruction. + */ +str +MALgarbagesink( Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +{ + (void) cntxt; + (void) mb; + (void) stk; + (void) pci; + return MAL_SUCCEED; +} str CMDregisterFunction(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) diff --git a/monetdb5/modules/mal/language.h b/monetdb5/modules/mal/language.h --- a/monetdb5/modules/mal/language.h +++ b/monetdb5/modules/mal/language.h @@ -47,6 +47,7 @@ language_export str MALassertSht(int *re language_export str MALassertInt(int *ret, int *val, str *msg); language_export str MALassertLng(int *ret, lng *val, str *msg); language_export str MALstartDataflow( Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +language_export str MALgarbagesink( Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); language_export str CMDregisterFunction(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); language_export str CMDsetMemoryTrace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); language_export str CMDsetThreadTrace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/monetdb5/modules/mal/language.mal b/monetdb5/modules/mal/language.mal --- a/monetdb5/modules/mal/language.mal +++ b/monetdb5/modules/mal/language.mal @@ -34,6 +34,11 @@ pattern dataflow():bit address MALstartDataflow comment "The current guarded block is executed using dataflow control. "; +pattern sink(v:any...):void +address MALgarbagesink +comment "Variables to be considered together when triggering garbage collection. +Used in the dataflow blocks to avoid early release of values."; + pattern register(m:str,f:str,code:str,help:str):void address CMDregisterFunction comment"Compile the code string to MAL and register it as a function."; diff --git a/monetdb5/optimizer/opt_dataflow.c b/monetdb5/optimizer/opt_dataflow.c --- a/monetdb5/optimizer/opt_dataflow.c +++ b/monetdb5/optimizer/opt_dataflow.c @@ -28,7 +28,11 @@ * dataflow processing incurs overhead and is only * relevant if multiple tasks kan be handled at the same time. * Also simple expressions dont had to be done in parallel. -*/ + * + * The garbagesink takes multiple variables whose endoflife is within + * a dataflow block and who are used multiple times. They should be + * garbage collected outside the parallel block. + */ static int simpleFlow(InstrPtr *old, int start, int last) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list