MonetDB: pushcands - Merged with default

2021-04-09 Thread Pedro Ferreira
Changeset: 1662c778dfc0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1662c778dfc0
Modified Files:
sql/server/rel_updates.c
Branch: pushcands
Log Message:

Merged with default


diffs (truncated from 454 to 300 lines):

diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -177,6 +177,7 @@ gdk_export oid canditer_last(const struc
 gdk_export oid canditer_prev(struct canditer *ci);
 gdk_export oid canditer_peekprev(struct canditer *ci);
 gdk_export oid canditer_idx(const struct canditer *ci, BUN p);
+#define canditer_idx_dense(ci, p) ((p >= (ci)->ncand)?oid_nil:((ci)->seq + p))
 gdk_export void canditer_setidx(struct canditer *ci, BUN p);
 gdk_export void canditer_reset(struct canditer *ci);
 gdk_export BUN canditer_search(const struct canditer *ci, oid o, bool next);
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -20,6 +20,57 @@
  * hseqbase + its batCount.
  */
 
+#define project1_loop(TYPE)\
+static gdk_return  \
+project1_##TYPE(BAT *restrict bn, BAT *restrict l, BAT *restrict r1)   \
+{  \
+   BUN lo, hi; \
+   const TYPE *restrict r1t;   \
+   TYPE *restrict bt;  \
+   oid r1seq, r1end;   \
+   \
+   MT_thread_setalgorithm(__func__);   \
+   r1t = (const TYPE *) Tloc(r1, 0);   \
+   bt = (TYPE *) Tloc(bn, 0);  \
+   r1seq = r1->hseqbase;   \
+   r1end = r1seq + BATcount(r1);   \
+   if (BATtdense(l)) { \
+   if (l->tseqbase < r1seq ||  \
+  (l->tseqbase+BATcount(l)) >= r1end) {\
+   GDKerror("does not match always\n");\
+   return GDK_FAIL;\
+   }   \
+   oid off = l->tseqbase - r1seq;  \
+   r1t += off; \
+   for (lo = 0, hi = BATcount(l); lo < hi; lo++)   \
+   bt[lo] = r1t[lo];   \
+   } else {\
+   const oid *restrict ot = (const oid *) Tloc(l, 0);  \
+   for (lo = 0, hi = BATcount(l); lo < hi; lo++) { \
+   oid o = ot[lo]; \
+   if (o < r1seq || o >= r1end) {  \
+   GDKerror("does not match always\n");\
+   return GDK_FAIL;\
+   }   \
+   bt[lo] = r1t[o - r1seq];\
+   }   \
+   }   \
+   BATsetcount(bn, lo);\
+   return GDK_SUCCEED; \
+}
+
+/* project type switch */
+project1_loop(bte)
+project1_loop(sht)
+project1_loop(int)
+project1_loop(flt)
+project1_loop(dbl)
+project1_loop(lng)
+#ifdef HAVE_HGE
+project1_loop(hge)
+#endif
+project1_loop(uuid)
+
 #define project_loop(TYPE) \
 static gdk_return  \
 project_##TYPE(BAT *restrict bn, BAT *restrict l,  \
@@ -34,6 +85,8 @@ project_##TYPE(BAT *restrict bn, BAT *re
oid r1seq, r1end;   \
oid r2seq, r2end;   \
\
+   if ((!ci || ci->tpe == cand_dense) && l->tnonil && !r2) \
+   return project1_##TYPE(bn, l, r1);  \
MT_thread_setalgorithm(__func__);   \
r1t = (const TYPE *) Tloc(r1, 0);   \
r2t = r2 ? (const TYPE *) Tloc(r2, 0) : NULL;   \
@@ -120,6 +173,12 @@ project_oid(BAT *restrict bn, BAT *restr
const oid *restrict r2t = NULL;
struct canditer r1ci = {0}, r2ci = {0};
 
+   if ((!lci || lci->tpe 

MonetDB: pushcands - Fix input group for distinct aggregates.

2021-04-09 Thread Pedro Ferreira
Changeset: 1e99c02f6eb6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1e99c02f6eb6
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: pushcands
Log Message:

Fix input group for distinct aggregates.

The good news is the pushcands testweb now matches with default, so we can 
start pushing candidate lists further.

The bad news is I found that we don't optimize distinct aggregates with the 
same inputs, so each grouping is computed again for every aggregate with the 
same distinct columns.


diffs (33 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1338,7 +1338,7 @@ exp_bin(backend *be, sql_exp *e, rel_bin
}   break;
case e_aggr: {
list *attr = e->l;
-   stmt *as = NULL;
+   stmt *as = NULL, *input_group = right ? right->grp : NULL;
sql_subfunc *a = e->f;
 
if (attr && attr->h) {
@@ -1380,10 +1380,8 @@ exp_bin(backend *be, sql_exp *e, rel_bin
stmt *as = en->data;
append(nl, stmt_project(be, next, as));
}
-   /*
if (right && right->grp)
-   right->grp = stmt_project(be, next, 
right->grp);
-   */
+   input_group = stmt_project(be, next, 
right->grp);
l = nl;
} else if (need_distinct(e)) {
stmt *a = l->h->data;
@@ -1407,7 +1405,7 @@ exp_bin(backend *be, sql_exp *e, rel_bin
}
}
if (right)
-   s = stmt_aggr(be, as, right->grp, right->ext, a, 1, 
need_no_nil(e) /* ignore nil*/, !zero_if_empty(e));
+   s = stmt_aggr(be, as, input_group, right->ext, a, 1, 
need_no_nil(e) /* ignore nil*/, !zero_if_empty(e));
else
s = stmt_aggr(be, as, NULL, NULL, a, 1, need_no_nil(e) 
/* ignore nil*/, !zero_if_empty(e));
if (find_prop(e->p, PROP_COUNT)) /* propagate count == 0 ipv 
NULL in outer joins */
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Show more information if Mz.py is not able to...

2021-04-09 Thread Panagiotis Koutsourakis
Changeset: 8088c952798c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8088c952798c
Modified Files:
testing/Mz.py.in
Branch: default
Log Message:

Show more information if Mz.py is not able to start the server


diffs (14 lines):

diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -900,8 +900,8 @@ def GetBitsAndModsAndThreads(env) :
 if proc.returncode is None:
 killProc(proc, proc.stderr, cmd)
 proc.wait()
-if procdebug:
-print('GetBitsAndModsAndThreads: process exited "%s" (%s)\n' % 
('" "'.join(cmd), proc.returncode))
+if procdebug or proc.returncode != 0:
+print('GetBitsAndModsAndThreads: process exited "%s" (%s)\n' % 
('" "'.join(cmd), proc.returncode), file=sys.stderr)
 env['TST_MODS'] = []
 env['TST_BITS'] = ""
 env['TST_INT128'] = ""
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: string_imprints - Do not try to generate strimp if it's...

2021-04-09 Thread Panagiotis Koutsourakis
Changeset: 76f731444d7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/76f731444d7c
Modified Files:
gdk/gdk_strimps.c
Branch: string_imprints
Log Message:

Do not try to generate strimp if it's already constructed


diffs (65 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -392,35 +392,37 @@ GDKstrimp_create_strimp(BAT *b)
assert(b->ttype == TYPE_str);
TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
-   if ((head = create_header(b)) == NULL) {
-   return GDK_FAIL;
-   }
+   if (b->tstrimps == NULL) {
+   if ((head = create_header(b)) == NULL) {
+   return GDK_FAIL;
+   }
 
-   if ((h = create_strimp_heap(b, head)) == NULL) {
-   GDKfree(head);
-   return GDK_FAIL;
-   }
-   dh = (uint64_t *)h->base + h->free;
+   if ((h = create_strimp_heap(b, head)) == NULL) {
+   GDKfree(head);
+   return GDK_FAIL;
+   }
+   dh = (uint64_t *)h->base + h->free;
 
-   bi = bat_iterator(b);
-   for (i = 0; i < b->batCount; i++) {
-   s = (str)BUNtvar(bi, i);
-   if (!strNil(s))
-   *dh++ = GDKstrimp_make_bitstring(s, head);
-   else
-   *dh++ = 0; /* no pairs in nil values */
+   bi = bat_iterator(b);
+   for (i = 0; i < b->batCount; i++) {
+   s = (str)BUNtvar(bi, i);
+   if (!strNil(s))
+   *dh++ = GDKstrimp_make_bitstring(s, head);
+   else
+   *dh++ = 0; /* no pairs in nil values */
 
+   }
+
+   /* After we have computed the strimp, attempt to write it back
+* to the BAT.
+*/
+   MT_lock_set(&b->batIdxLock);
+   b->tstrimps = h;
+   b->batDirtydesc = true;
+   /* persistStrimp(b) */
+   MT_lock_unset(&b->batIdxLock);
}
 
-   /* After we have computed the strimp, attempt to write it back
-* to the BAT.
-*/
-   MT_lock_set(&b->batIdxLock);
-   b->tstrimps = h;
-   b->batDirtydesc = true;
-   /* persistStrimp(b) */
-   MT_lock_unset(&b->batIdxLock);
-
TRC_DEBUG(ALGO, "strimp creation took " LLFMT " usec\n", GDKusec()-t0);
return GDK_SUCCEED;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Don't let single joins get propagated

2021-04-09 Thread Pedro Ferreira
Changeset: 46174b653685 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/46174b653685
Modified Files:
sql/server/rel_updates.c
Branch: default
Log Message:

Don't let single joins get propagated


diffs (11 lines):

diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -1072,6 +1072,7 @@ update_generate_assignments(sql_query *q
}
}
r = rel_project(sql->sa, r, list_append(new_exp_list(sql->sa), 
exp_column(sql->sa, rname, TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1)));
+   reset_single(r); /* don't let single joins get propagated */
r = rel_update(sql, bt, r, updates, exps);
return r;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Simplify test

2021-04-09 Thread Pedro Ferreira
Changeset: eca804f5a7b9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eca804f5a7b9
Modified Files:
sql/test/SQLancer/Tests/sqlancer14.test
Branch: default
Log Message:

Simplify test


diffs (51 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer14.test 
b/sql/test/SQLancer/Tests/sqlancer14.test
--- a/sql/test/SQLancer/Tests/sqlancer14.test
+++ b/sql/test/SQLancer/Tests/sqlancer14.test
@@ -584,7 +584,7 @@ statement ok
 TRUNCATE t1
 
 statement ok
-COPY 10 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+COPY 18 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'
 
 8.000  3   "1970-01-06 06:36:14.00"
 -72732622.000  2   "1970-01-01 01:00:00.00"
@@ -596,27 +596,22 @@ NULL  9   NULL
 NULL   2   NULL
 NULL   8   NULL
 NULL   9   NULL
-
-statement ok
-INSERT INTO t0(c0, c1) VALUES(DATE '1970-01-01', INTERVAL '4' SECOND)
-
-statement ok
-INSERT INTO t1(c1, c5, c2) VALUES(INTERVAL '3' SECOND, TIMESTAMP '1970-02-01 
01:00:00', 4), (INTERVAL '6' SECOND, TIMESTAMP '1970-01-01 01:00:00', 2), 
(INTERVAL '-5' SECOND, TIMESTAMP '1970-01-01 01:00:00', 1)
-
-statement ok
-DELETE FROM t0
-
-statement ok
-INSERT INTO t1(c1, c5) VALUES(INTERVAL '7' SECOND, TIMESTAMP '1969-12-17 
07:47:25'), (INTERVAL '0' SECOND, TIMESTAMP '1969-12-17 07:47:25'), (INTERVAL 
'6' SECOND, TIMESTAMP '1969-12-17 07:47:25'),
-(INTERVAL '0' SECOND, TIMESTAMP '1969-12-17 07:47:25'), (INTERVAL '2' SECOND, 
TIMESTAMP '1969-12-12 05:50:27')
-
-statement ok
-INSERT INTO t0(c0) VALUES(DATE '1970-01-01')
+3.000  4   "1970-02-01 01:00:00.00"
+6.000  2   "1970-01-01 01:00:00.00"
+-5.000 1   "1970-01-01 01:00:00.00"
+7.000  NULL"1969-12-17 07:47:25.00"
+0.000  NULL"1969-12-17 07:47:25.00"
+6.000  NULL"1969-12-17 07:47:25.00"
+0.000  NULL"1969-12-17 07:47:25.00"
+2.000  NULL"1969-12-12 05:50:27.00"
 
 statement ok
 INSERT INTO t1(c1) VALUES(INTERVAL '4' SECOND), (INTERVAL '6' SECOND)
 
 statement ok
+INSERT INTO t0(c0, c1) VALUES(DATE '1970-01-01', INTERVAL '4' SECOND), (DATE 
'1970-01-01', INTERVAL '3' SECOND)
+
+statement ok
 UPDATE t1 SET c1 = INTERVAL '3' SECOND FROM t0 WHERE t1.c1 BETWEEN t0.c1 AND 
t0.c1
 
 statement ok
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Crash on BATproject2

2021-04-09 Thread Pedro Ferreira
Changeset: 37a671183baf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/37a671183baf
Modified Files:
sql/test/SQLancer/Tests/sqlancer14.test
Branch: default
Log Message:

Crash on BATproject2


diffs (76 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer14.test 
b/sql/test/SQLancer/Tests/sqlancer14.test
--- a/sql/test/SQLancer/Tests/sqlancer14.test
+++ b/sql/test/SQLancer/Tests/sqlancer14.test
@@ -555,3 +555,72 @@ True
 
 statement ok
 ROLLBACK
+
+statement ok
+CREATE TABLE t0(c0 DATE, c1 INTERVAL SECOND PRIMARY KEY DEFAULT INTERVAL '0' 
SECOND, c2 bigint)
+
+statement ok
+CREATE TABLE t1(c1 INTERVAL SECOND, c2 bigint, c5 TIMESTAMP)
+
+statement ok
+COPY 14 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+
+84369713.000   NULL"1970-01-01 01:00:00.00"
+833671629.000  NULL"1970-01-01 01:00:00.00"
+0.000  1   NULL
+2.000  5   NULL
+3.000  3   NULL
+3.000  3   NULL
+9.000  -10 "1970-01-01 01:00:00.00"
+6.000  -4  "1970-01-01 01:00:00.00"
+0.000  2   "1970-01-01 01:00:00.00"
+2.000  2   "1970-01-01 01:00:00.00"
+9.000  7   "1970-01-01 01:00:00.00"
+4.000  0   "1970-01-01 01:00:00.00"
+1.000  1   "1970-01-01 01:00:00.00"
+2.000  NULL"1970-01-01 01:00:00.00"
+
+statement ok
+TRUNCATE t1
+
+statement ok
+COPY 10 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+
+8.000  3   "1970-01-06 06:36:14.00"
+-72732622.000  2   "1970-01-01 01:00:00.00"
+NULL   -3  "1969-12-15 13:58:34.00"
+NULL   2   NULL
+NULL   9   "1970-01-07 17:53:24.00"
+NULL   7   NULL
+NULL   9   NULL
+NULL   2   NULL
+NULL   8   NULL
+NULL   9   NULL
+
+statement ok
+INSERT INTO t0(c0, c1) VALUES(DATE '1970-01-01', INTERVAL '4' SECOND)
+
+statement ok
+INSERT INTO t1(c1, c5, c2) VALUES(INTERVAL '3' SECOND, TIMESTAMP '1970-02-01 
01:00:00', 4), (INTERVAL '6' SECOND, TIMESTAMP '1970-01-01 01:00:00', 2), 
(INTERVAL '-5' SECOND, TIMESTAMP '1970-01-01 01:00:00', 1)
+
+statement ok
+DELETE FROM t0
+
+statement ok
+INSERT INTO t1(c1, c5) VALUES(INTERVAL '7' SECOND, TIMESTAMP '1969-12-17 
07:47:25'), (INTERVAL '0' SECOND, TIMESTAMP '1969-12-17 07:47:25'), (INTERVAL 
'6' SECOND, TIMESTAMP '1969-12-17 07:47:25'),
+(INTERVAL '0' SECOND, TIMESTAMP '1969-12-17 07:47:25'), (INTERVAL '2' SECOND, 
TIMESTAMP '1969-12-12 05:50:27')
+
+statement ok
+INSERT INTO t0(c0) VALUES(DATE '1970-01-01')
+
+statement ok
+INSERT INTO t1(c1) VALUES(INTERVAL '4' SECOND), (INTERVAL '6' SECOND)
+
+statement ok
+UPDATE t1 SET c1 = INTERVAL '3' SECOND FROM t0 WHERE t1.c1 BETWEEN t0.c1 AND 
t0.c1
+
+statement ok
+DROP TABLE t0
+
+statement ok
+DROP TABLE t1
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Added --language option to interactive use of...

2021-04-09 Thread Sjoerd Mullender
Changeset: dea0e54ebc27 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dea0e54ebc27
Modified Files:
testing/sqllogictest.py
Branch: default
Log Message:

Added --language option to interactive use of sqllogictest.py.


diffs (21 lines):

diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -723,6 +723,8 @@ if __name__ == '__main__':
 help='port the server listens on')
 parser.add_argument('--database', action='store', default='demo',
 help='name of the database')
+parser.add_argument('--language', action='store', default='sql',
+help='language to use for testing')
 parser.add_argument('--nodrop', action='store_true',
 help='do not drop tables at start of test')
 parser.add_argument('--verbose', action='store_true',
@@ -740,7 +742,7 @@ if __name__ == '__main__':
 args = opts.tests
 sql = SQLLogic(report=opts.report)
 sql.res = opts.results
-sql.connect(hostname=opts.host, port=opts.port, database=opts.database)
+sql.connect(hostname=opts.host, port=opts.port, database=opts.database, 
language=opts.language)
 for test in args:
 try:
 if not opts.nodrop:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: pushcands - Here candidates can be pushed

2021-04-09 Thread Pedro Ferreira
Changeset: 40d6d86f7b24 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/40d6d86f7b24
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: pushcands
Log Message:

Here candidates can be pushed


diffs (41 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -541,34 +541,21 @@ value_list(backend *be, list *vals, rel_
 {
sql_subtype *type = exp_subtype(vals->h->data);
list *l = sa_list(be->mvc->sa);
-   stmt *lcand = NULL;
 
if (!type)
return sql_error(be->mvc, 02, SQLSTATE(42000) "Could not infer 
the type of a value list column");
-   if (left) {
-   lcand = left->cand;
-   left->cand = NULL;
-   }
/* create bat append values */
for (node *n = vals->h; n; n = n->next) {
sql_exp *e = n->data;
stmt *i = exp_bin(be, e, left, NULL, 0, 0, 0);
 
-   if (!i) {
-   if (left)
-   left->cand = lcand;
+   if (!i)
return NULL;
-   }
-
-   if (list_length(vals) == 1) {
-   if (left)
-   left->cand = lcand;
+
+   if (list_length(vals) == 1)
return i;
-   }
list_append(l, i);
}
-   if (left)
-   left->cand = lcand;
return stmt_append_bulk(be, stmt_temp(be, type), l);
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Remove currenttime test. It's not timezone aware

2021-04-09 Thread Pedro Ferreira
Changeset: f5efc1d36df2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f5efc1d36df2
Removed Files:
sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py
Modified Files:
sql/test/BugTracker-2012/Tests/All
Branch: default
Log Message:

Remove currenttime test. It's not timezone aware


diffs (27 lines):

diff --git a/sql/test/BugTracker-2012/Tests/All 
b/sql/test/BugTracker-2012/Tests/All
--- a/sql/test/BugTracker-2012/Tests/All
+++ b/sql/test/BugTracker-2012/Tests/All
@@ -65,7 +65,6 @@ incorrect_cast_from_double_to_int.Bug-25
 conditions_when_for_triggers_do_not_work.Bug-2073
 insert_gives_39000_program_error.Bug-3097
 create_function.Bug-3172
-currenttime.Bug-2781
 timestamp_minus_date.Bug-2977
 null_except_null.Bug-3040
 create_index_update.Bug-3098
diff --git a/sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py 
b/sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py
deleted file mode 100644
--- a/sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import time, sys, os, pymonetdb
-
-client1 = pymonetdb.connect(database=os.getenv("TSTDB"), 
port=int(os.getenv("MAPIPORT")))
-cur1 = client1.cursor()
-currenttime = time.strftime('%F %T', time.localtime(time.time() + 
time.timezone)) # I needd to add the current timezone to make it match on 
pymonetdb
-#SQL command for checking the localtime
-cur1.execute("select localtimestamp() between (timestamp '%s' - interval '20' 
second) and (timestamp '%s' + interval '20' second);" % (currenttime, 
currenttime))
-if cur1.fetchall()[0][0] != True:
-sys.stderr.write('Expected True')
-cur1.close()
-client1.close()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Lower python requirement version by using ano...

2021-04-09 Thread Pedro Ferreira
Changeset: 2fec5f54d6fb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2fec5f54d6fb
Modified Files:
sql/jdbc/tests/Tests/JDBC_API_Tester.SQL.py
sql/jdbc/tests/Tests/Test_JdbcClient.SQL.py
sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.py
Branch: default
Log Message:

Lower python requirement version by using another parameter to specify text mode


diffs (62 lines):

diff --git a/sql/jdbc/tests/Tests/JDBC_API_Tester.SQL.py 
b/sql/jdbc/tests/Tests/JDBC_API_Tester.SQL.py
--- a/sql/jdbc/tests/Tests/JDBC_API_Tester.SQL.py
+++ b/sql/jdbc/tests/Tests/JDBC_API_Tester.SQL.py
@@ -15,7 +15,7 @@ URL=f"jdbc:monetdb://{HOST}:{MAPIPORT}/{
 
 cmd = ['java', 'JDBC_API_Tester', URL]
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 raise SystemExit(e.stderr)
 
diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.py 
b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.py
--- a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.py
+++ b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.py
@@ -15,29 +15,29 @@ PASSWORD='monetdb'
 if __name__ == '__main__':
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '--help']
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 raise SystemExit(e.stderr)
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '-f', 
os.path.join(TSTSRCBASE, TSTDIR, 'Tests/JdbcClient_create_tables.sql')]
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 print(e.stderr, file=sys.stderr)
 raise SystemExit('ERROR: failed to create tables!')
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '-f', 
os.path.join(TSTSRCBASE, TSTDIR, 'Tests/JdbcClient_inserts_selects.sql')]
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 print(e.stderr, file=sys.stderr)
 raise SystemExit('ERROR: failed to insert!')
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '-D']
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 raise SystemExit(e.stderr)
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '-f', 
os.path.join(TSTSRCBASE, TSTDIR, 'Tests/JdbcClient_drop_tables.sql')]
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 raise SystemExit(e.stderr)
 
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.py 
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.py
--- a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.py
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.py
@@ -15,7 +15,7 @@ PASSWORD='monetdb'
 if __name__ == '__main__':
 cmd = ['java', CLIENT, '-h', HOST, '-p', MAPIPORT, '-d', TSTDB, '-f', 
os.path.join(TSTSRCBASE, TSTDIR, 'Tests/ValidateSystemCatalogTables.sql')]
 try:
-p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, text=True)
+p = run(cmd, stdout=PIPE, stderr=PIPE, check=True, encoding='utf-8')
 except CalledProcessError as e:
 raise SystemExit(e.stderr)
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list