Changeset: 8cc435b6e522 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8cc435b6e522
Added Files:
        clients/python2/test/test_pythonize.py
        clients/python3/test/test_pythonize.py
Modified Files:
        clients/Tests/exports.stable.out
        clients/python2/monetdb/mapi.py
        clients/python2/monetdb/sql/cursors.py
        clients/python2/monetdb/sql/pythonize.py
        clients/python2/test/runtests.py
        clients/python3/monetdb/mapi.py
        clients/python3/monetdb/sql/connections.py
        clients/python3/monetdb/sql/cursors.py
        clients/python3/monetdb/sql/pythonize.py
        clients/python3/test/runtests.py
        gdk/gdk_system.c
        sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err
        sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err
Branch: rdf
Log Message:

Merge with default branch


diffs (207 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -194,10 +194,11 @@ BAT *BATsort(BAT *b);
 BAT *BATsort_rev(BAT *b);
 BAT *BATssort(BAT *b);
 BAT *BATssort_rev(BAT *b);
-gdk_return BATsubhashjoin(BAT **r1, BAT **r2, BAT *l, BAT *r, BAT *sl, BAT 
*sr);
-gdk_return BATsubmergejoin(BAT **r1, BAT **r2, BAT *l, BAT *r, BAT *sl, BAT 
*sr);
+gdk_return BATsubleftjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT 
*sr, BUN estimate);
+gdk_return BATsubouterjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT 
*sr, BUN estimate);
 BAT *BATsubselect(BAT *b, BAT *s, const void *tl, const void *th, int li, int 
hi, int anti);
 gdk_return BATsubsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, 
BAT *g, int reverse, int stable);
+gdk_return BATsubthetajoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT 
*sr, const char *op, BUN estimate);
 gdk_return BATsum(void *res, int tp, BAT *b, BAT *s, int skip_nils, int 
abort_on_error, int nil_if_empty);
 BAT *BATsunion(BAT *b, BAT *c);
 BAT *BATsunique(BAT *b);
@@ -823,10 +824,10 @@ str ALGssort(int *result, int *bid);
 str ALGssort_rev(int *result, int *bid);
 str ALGstdev(dbl *res, int *bid);
 str ALGstdevp(dbl *res, int *bid);
-str ALGsubhashjoin(bat *r1, bat *r2, bat *l, bat *r);
-str ALGsubhashjoin4(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr);
-str ALGsubmergejoin(bat *r1, bat *r2, bat *l, bat *r);
-str ALGsubmergejoin4(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr);
+str ALGsubleftjoin(bat *r1, bat *r2, bat *l, bat *r);
+str ALGsubleftjoin4(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr);
+str ALGsubouterjoin(bat *r1, bat *r2, bat *l, bat *r);
+str ALGsubouterjoin4(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr);
 str ALGsubsample(int *result, int *bid, int *param);
 str ALGsubselect1(bat *result, bat *bid, const void *low, const void *high, 
const bit *li, const bit *hi, const bit *anti);
 str ALGsubselect2(bat *result, bat *bid, bat *sid, const void *low, const void 
*high, const bit *li, const bit *hi, const bit *anti);
@@ -840,6 +841,8 @@ str ALGsubsort23(bat *result, bat *norde
 str ALGsubsort31(bat *result, bat *bid, bat *order, bat *group, bit *reverse, 
bit *stable);
 str ALGsubsort32(bat *result, bat *norder, bat *bid, bat *order, bat *group, 
bit *reverse, bit *stable);
 str ALGsubsort33(bat *result, bat *norder, bat *ngroup, bat *bid, bat *order, 
bat *group, bit *reverse, bit *stable);
+str ALGsubthetajoin(bat *r1, bat *r2, bat *l, bat *r, str *op);
+str ALGsubthetajoin4(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, str 
*op);
 str ALGsunion(int *result, int *lid, int *rid);
 str ALGsunique(int *result, int *bid);
 str ALGtdiff(int *result, int *lid, int *rid);
diff --git a/clients/python2/monetdb/sql/pythonize.py 
b/clients/python2/monetdb/sql/pythonize.py
--- a/clients/python2/monetdb/sql/pythonize.py
+++ b/clients/python2/monetdb/sql/pythonize.py
@@ -119,7 +119,7 @@ def convert(data, type_code):
 
 def Binary(data):
     """returns binary encoding of data"""
-    return ''.join([hex(ord(i))[2:] for i in data]).upper()
+    return ''.join(["%02X" % ord(i) for i in data])
 
 def DateFromTicks(ticks):
     """Convert ticks to python Date"""
diff --git a/clients/python2/test/runtests.py b/clients/python2/test/runtests.py
--- a/clients/python2/test/runtests.py
+++ b/clients/python2/test/runtests.py
@@ -36,6 +36,7 @@ except ImportError:
 
 import capabilities
 import dbapi20
+import test_pythonize
 
 warnings.filterwarnings('error')
 
@@ -93,6 +94,7 @@ if __name__ == '__main__':
     suites = [
         Test_Capabilities,
         Test_DBAPI20,
+        test_pythonize.TestPythonize,
     ]
 
     for suite in suites:
diff --git a/clients/python2/test/test_pythonize.py 
b/clients/python2/test/test_pythonize.py
new file mode 100644
--- /dev/null
+++ b/clients/python2/test/test_pythonize.py
@@ -0,0 +1,15 @@
+import unittest
+import monetdb.sql.pythonize
+
+class TestPythonize(unittest.TestCase):
+    def test_Binary(self):
+        input1 = ''.join([chr(i) for i in range(256)])
+        output1 = ''.join(["%02X" % i for i in range(256)])
+        result1 = monetdb.sql.pythonize.Binary(input1)
+        self.assertEqual(output1, result1)
+
+        input2 = '\tdharma'
+        output2 = '09646861726D61'
+        result2 = monetdb.sql.pythonize.Binary(input2)
+        self.assertEqual(output2, result2)
+
diff --git a/clients/python3/monetdb/sql/pythonize.py 
b/clients/python3/monetdb/sql/pythonize.py
--- a/clients/python3/monetdb/sql/pythonize.py
+++ b/clients/python3/monetdb/sql/pythonize.py
@@ -27,8 +27,8 @@ from monetdb.exceptions import Programmi
 import re
 
 def strip(data):
-    """ returns a python string, chops off quotes,
-    replaces escape characters"""
+    """ returns a python string, with chopped off quotes,
+    and replaced escape characters"""
     return ''.join([w.encode('utf-8').decode('unicode_escape') if '\\' in w 
else w for w in re.split('([\000-\200]+)', data[1:-1])])
 
 def py_bool(data):
@@ -120,7 +120,7 @@ def convert(data, type_code):
 
 def Binary(data):
     """returns binary encoding of data"""
-    return ''.join([hex(ord(i))[2:] for i in data]).upper()
+    return ''.join(["%02X" % ord(i) for i in data])
 
 def DateFromTicks(ticks):
     """Convert ticks to python Date"""
diff --git a/clients/python3/test/runtests.py b/clients/python3/test/runtests.py
--- a/clients/python3/test/runtests.py
+++ b/clients/python3/test/runtests.py
@@ -36,6 +36,7 @@ except ImportError:
 
 import capabilities
 import dbapi20
+import test_pythonize
 
 warnings.filterwarnings('error')
 
@@ -100,6 +101,16 @@ if __name__ == '__main__':
         TextTestRunnerNoTime(verbosity=3).run(tests)
 
 
+if __name__ == '__main__':
+    suites = [
+        Test_Capabilities,
+        Test_DBAPI20,
+        test_pythonize.TestPythonize,
+        ]
 
+    for suite in suites:
+        tests = unittest.TestLoader().loadTestsFromTestCase(suite)
+        TextTestRunnerNoTime(verbosity=3).run(tests)
 
 
+
diff --git a/clients/python3/test/test_pythonize.py 
b/clients/python3/test/test_pythonize.py
new file mode 100644
--- /dev/null
+++ b/clients/python3/test/test_pythonize.py
@@ -0,0 +1,15 @@
+import unittest
+import monetdb.sql.pythonize
+
+class TestPythonize(unittest.TestCase):
+    def test_Binary(self):
+        input1 = ''.join([chr(i) for i in range(256)])
+        output1 = ''.join(["%02X" % i for i in range(256)])
+        result1 = monetdb.sql.pythonize.Binary(input1)
+        self.assertEqual(output1, result1)
+
+        input2 = '\tdharma'
+        output2 = '09646861726D61'
+        result2 = monetdb.sql.pythonize.Binary(input2)
+        self.assertEqual(output2, result2)
+
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -510,7 +510,7 @@ MT_kill_thread(MT_Id t)
 #endif
 }
 
-#if defined(ATOMIC_LOCK) && (defined(_AIX) || defined(__MACH__))
+#if defined(_AIX) || defined(__MACH__)
 void
 pthread_sema_init(pthread_sema_t *s, int flag, int nresources)
 {
diff --git a/sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err 
b/sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err
--- a/sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err
+++ b/sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err
@@ -149,6 +149,12 @@ test_utf8 (__main__.Test_DBAPI20) ... ok
 Ran 38 tests
 
 OK
+test_Binary (test_pythonize.TestPythonize) ... ok
+
+----------------------------------------------------------------------
+Ran 1 test
+
+OK
 
 # 11:54:48 >  
 # 11:54:48 >  Done.
diff --git a/sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err 
b/sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err
--- a/sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err
+++ b/sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err
@@ -149,6 +149,12 @@ test_utf8 (__main__.Test_DBAPI20) ... ok
 Ran 38 tests
 
 OK
+test_Binary (test_pythonize.TestPythonize) ... ok
+
+----------------------------------------------------------------------
+Ran 1 test
+
+OK
 
 # 11:54:48 >  
 # 11:54:48 >  Done.
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to