MonetDB: default - Approve non-hge tests.

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: 60b8d7104db5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/60b8d7104db5
Modified Files:
clients/Tests/MAL-signatures.test
sql/test/emptydb/Tests/check.stable.out
Branch: default
Log Message:

Approve non-hge tests.


diffs (99 lines):

diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -33510,6 +33510,16 @@ VLTgenerator_noop;
 (empty)
 generator
 parameters
+pattern generator.parameters(X_0:date, X_1:date, X_2:int):bat[:date]
+VLTgenerator_noop;
+Retain the table definition, but don't materialize (months)
+generator
+parameters
+pattern generator.parameters(X_0:date, X_1:date, X_2:lng):bat[:date]
+VLTgenerator_noop;
+Retain the table definition, but don't materialize (days)
+generator
+parameters
 pattern generator.parameters(X_0:dbl, X_1:dbl):bat[:dbl]
 VLTgenerator_noop;
 (empty)
@@ -33570,6 +33580,11 @@ VLTgenerator_projection;
 (empty)
 generator
 projection
+pattern generator.projection(X_0:bat[:oid], X_1:bat[:date]):bat[:date]
+VLTgenerator_projection;
+(empty)
+generator
+projection
 pattern generator.projection(X_0:bat[:oid], X_1:bat[:dbl]):bat[:dbl]
 VLTgenerator_projection;
 (empty)
@@ -33610,6 +33625,16 @@ VLTgenerator_subselect;
 (empty)
 generator
 select
+pattern generator.select(X_0:bat[:date], X_1:bat[:oid], X_2:date, X_3:date, 
X_4:bit, X_5:bit, X_6:bit):bat[:oid]
+VLTgenerator_subselect;
+(empty)
+generator
+select
+pattern generator.select(X_0:bat[:date], X_1:date, X_2:date, X_3:bit, X_4:bit, 
X_5:bit):bat[:oid]
+VLTgenerator_subselect;
+(empty)
+generator
+select
 pattern generator.select(X_0:bat[:dbl], X_1:bat[:oid], X_2:dbl, X_3:dbl, 
X_4:bit, X_5:bit, X_6:bit):bat[:oid]
 VLTgenerator_subselect;
 (empty)
@@ -33680,6 +33705,16 @@ VLTgenerator_table;
 (empty)
 generator
 series
+pattern generator.series(X_0:date, X_1:date, X_2:int):bat[:date]
+VLTgenerator_table;
+date generator with step size in months
+generator
+series
+pattern generator.series(X_0:date, X_1:date, X_2:lng):bat[:date]
+VLTgenerator_table;
+date generator with step size in days
+generator
+series
 pattern generator.series(X_0:dbl, X_1:dbl):bat[:dbl]
 VLTgenerator_table;
 (empty)
@@ -33740,6 +33775,11 @@ VLTgenerator_thetasubselect;
 (empty)
 generator
 thetaselect
+pattern generator.thetaselect(X_0:bat[:date], X_1:bat[:oid], X_2:date, 
X_3:str):bat[:oid]
+VLTgenerator_thetasubselect;
+Overloaded selection routine
+generator
+thetaselect
 pattern generator.thetaselect(X_0:bat[:dbl], X_1:bat[:oid], X_2:dbl, 
X_3:str):bat[:oid]
 VLTgenerator_thetasubselect;
 (empty)
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1693,7 +1693,7 @@ select 'null in fkeys.delete_action', de
 % .%1, .s, .f, .,  .,  .f, .fl,.,  .f, .f, 
.f, .f, .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  . # table_name
 % %1,  name,   name,   system, query,  mod,language_name,  func_type,  
side_effect,varres, vararg, semantics,  comment,name0,  type0,  
type_digits0,   type_scale0,inout0, name1,  type1,  type_digits1,   
type_scale1,inout1, name2,  type2,  type_digits2,   type_scale2,inout2, 
name3,  type3,  type_digits3,   type_scale3,inout3, name4,  type4,  
type_digits4,   type_scale4,inout4, name5,  type5,  type_digits5,   
type_scale5,inout5, name6,  type6,  type_digits6,   type_scale6,inout6, 
name7,  type7,  type_digits7,   type_scale7,inout7, name8,  type8,  
type_digits8,   type_scale8,inout8, name9,  type9,  type_digits9,   
type_scale9,inout9, name10, type10, type_digits10,  type_scale10,   
inout10,name11, type11, type_digits11,  type_scale11,   inout11,
name12, type12, type_digits12,  type_scale12,   inout12,name13, type13, 
type_digits13,  type_scale13,   inout13,name14, type14, type_digits14,  
type_scale14,   inout14,name15, type15, type_digits15,  type_scale15,   
inout15 # name
 % varchar, varchar,varchar,varchar,varchar,
varchar,varchar,varchar,boolean,boolean,
boolean,boolean,varchar,varchar,varchar, 

MonetDB: default - Fix tiny memory leak.

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: b93871d52277 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b93871d52277
Modified Files:
clients/mapiclient/iconv-stream.h
Branch: default
Log Message:

Fix tiny memory leak.


diffs (18 lines):

diff --git a/clients/mapiclient/iconv-stream.h 
b/clients/mapiclient/iconv-stream.h
--- a/clients/mapiclient/iconv-stream.h
+++ b/clients/mapiclient/iconv-stream.h
@@ -195,12 +195,14 @@ ic_close(void *private)
if (ic->cd != (iconv_t) -1)
iconv_close(ic->cd);
ic->cd = (iconv_t) -1;
+   mnstr_close(ic->s);
 }
 
 static void
 ic_destroy(void *private)
 {
ic_close(private);
+   mnstr_destroy(((struct ic_priv_t *) private)->s);
free(private);
 }
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Keep rotation lock for the duration of printi...

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: 32a1eb24e340 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/32a1eb24e340
Modified Files:
gdk/gdk_logger.c
Branch: Dec2023
Log Message:

Keep rotation lock for the duration of printing log info with SIGUSR1.


diffs (17 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3528,7 +3528,6 @@ log_printinfo(logger *lg)
rotation_lock(lg);
printf("current log file "ULLFMT", last handled log file "ULLFMT"\n",
   lg->id, lg->saved_id);
-   rotation_unlock(lg);
printf("current transaction id %d, saved transaction id %d\n",
   lg->tid, lg->saved_tid);
printf("number of flushers: %d\n", (int) ATOMIC_GET(&lg->nr_flushers));
@@ -3541,4 +3540,5 @@ log_printinfo(logger *lg)
buf[0] = 0;
printf("pending range "ULLFMT": drops %"PRIu64", last_ts 
%"PRIu64", flushed_ts %"PRIu64", refcount %"PRIu64"%s%s\n", p->id, (uint64_t) 
ATOMIC_GET(&p->drops), (uint64_t) ATOMIC_GET(&p->last_ts), (uint64_t) 
ATOMIC_GET(&p->flushed_ts), (uint64_t) ATOMIC_GET(&p->refcount), buf, p == 
lg->current ? " (current)" : "");
}
+   rotation_unlock(lg);
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Use clever UTF-8 decode function and put it i...

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: 48eb20c82ba6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/48eb20c82ba6
Added Files:
common/utils/mutf8.c
common/utils/mutf8.h
Modified Files:
clients/mapiclient/CMakeLists.txt
clients/mapiclient/mclient.c
common/utils/CMakeLists.txt
monetdb5/modules/atoms/CMakeLists.txt
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/CMakeLists.txt
monetdb5/modules/mal/txtsim.c
monetdb5/tools/CMakeLists.txt
Branch: default
Log Message:

Use clever UTF-8 decode function and put it in a central location.


diffs (truncated from 1182 to 300 lines):

diff --git a/clients/mapiclient/CMakeLists.txt 
b/clients/mapiclient/CMakeLists.txt
--- a/clients/mapiclient/CMakeLists.txt
+++ b/clients/mapiclient/CMakeLists.txt
@@ -54,6 +54,7 @@ target_link_libraries(mclient
   mprompt
   moptions
   mutils
+  mutf8
   mapi
   stream
   $<$:Readline::Readline>
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -169,53 +169,7 @@ static char *nullstring = default_nullst
 
 #include 
 #include "mhelp.h"
-
-/* The code starting here, and up to and including the function decode
- * below are copyright Bjoern Hoehrmann per the below notice.
- *
- * The function decode provides a fast way to check for valid UTF-8
- * sequences and returns the value of the codepoint as well.  */
-
-// Copyright (c) 2008-2009 Bjoern Hoehrmann 
-// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
-
-#define UTF8_ACCEPT 0
-#define UTF8_REJECT 12
-
-static const uint8_t utf8d[] = {
-   // The first part of the table maps bytes to character classes that
-   // to reduce the size of the transition table and create bitmasks.
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,  9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-   10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,
-
-   // The second part is a transition table that maps a combination
-   // of a state of the automaton and a character class to a state.
-0,12,24,36,60,96,84,12,12,12,48,72, 
12,12,12,12,12,12,12,12,12,12,12,12,
-   12, 0,12,12,12,12,12, 0,12, 0,12,12, 
12,24,12,12,12,12,12,24,12,24,12,12,
-   12,12,12,12,12,12,12,24,12,12,12,12, 
12,24,12,12,12,12,12,12,12,24,12,12,
-   12,12,12,12,12,12,12,36,12,36,12,12, 
12,36,12,12,12,12,12,36,12,36,12,12,
-   12,36,12,12,12,12,12,12,12,12,12,12,
-};
-
-static inline uint32_t
-decode(uint32_t *state, uint32_t *codep, uint32_t byte)
-{
-   uint32_t type = utf8d[byte];
-
-   *codep = (*state != UTF8_ACCEPT) ?
-   (byte & 0x3fu) | (*codep << 6) :
-   (0xff >> type) & (byte);
-
-   *state = utf8d[256 + *state + type];
-   return *state;
-}
-/* end code copyright by Bjoern Hoehrmann */
+#include "mutf8.h"
 
 static timertype
 gettime(void)
@@ -366,217 +320,6 @@ timerHuman(int64_t sqloptimizer, int64_t
return;
 }
 
-struct interval {
-   uint32_t first;
-   uint32_t last;
-   int width;
-};
-
-static const struct interval intervals[] = {
-   /* sorted list of non-overlapping ranges;
-* ranges with width==0 represent all codepoints with
-* general_category Me, Mn or Cf except U+00AD (SOFT HYPHEN), all
-* codepoints \U+1160 through U+11FF (Hangul Jamo medial vowels and
-* final consonants) -- see
-* https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c from which this is
-* derived;
-* ranges with width==2 represent all codepoints in the East Asian
-* Wide (W) or East Asian Full-width (F) category as defined in the
-* EastAsianWidth.txt file;
-* also see monetdb5/modules/atoms/str.c which has a copy of this */
-   { 0x0300, 0x036F, 0 }, { 0x0483, 0x0489, 0 }, { 0x0591, 0x05BD, 0 },
-   { 0x05BF, 0x05BF, 0 }, { 0x05C1, 0x05C2, 0 }, { 0x05C4, 0x05C5, 0 },
-   { 0x05C7, 0x05C7, 0 }, { 0x0600, 0x0605, 0 }, { 0x0610, 0x061A, 0 },
-   { 0x061C, 0x061C, 0 }, { 0x064B, 0x065F, 0 }, { 0x0670, 0x0670, 0 },
-   { 0x06D6, 0x06DD, 0 }, { 0x06DF, 0x06E4, 0 }, { 0x06E7, 0x06E8, 0 },
-   { 0x06EA, 0x06ED, 0 }, { 0x070F, 0x070F, 0 }, { 0x0711, 0x0711, 0 },
-   { 0x0730, 0x074A, 0 }, { 0x07A6, 0x07B0, 0 }, { 0x07EB, 0x07F3, 0 },
-   { 0x07FD, 0x07FD, 0 }, { 0x0816, 0x0819, 0 }, { 0x081B, 0x0823, 0 },
-   { 0x0825, 0x0827, 0 }, { 0x0829, 0x082D, 0 }, { 0x0859, 0x085B, 0 },
-   { 0x0890, 0x0891, 0 }, { 0x0898, 0x089F, 0 }, 

MonetDB: default - fixed #7481, correct cardinality of wndow fun...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 78961a3f4473 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/78961a3f4473
Modified Files:
sql/server/rel_unnest.c
sql/test/BugTracker-2024/Tests/mvc_row_result_wrap-Bug-7481.test
Branch: default
Log Message:

fixed #7481, correct cardinality of wndow functions on constants


diffs (40 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2239,7 +2239,7 @@ exp_reset_card_and_freevar_set_physical_
switch(e->type) {
case e_aggr:
case e_func: {
-   e->card = list_empty(e->l)?CARD_MULTI:exps_card(e->l);
+   e->card = 
list_empty(e->l)?rel?rel->card:CARD_MULTI:exps_card(e->l);
} break;
case e_column: {
sql_exp *le = NULL, *re = NULL;
@@ -2632,7 +2632,6 @@ rewrite_rank(visitor *v, sql_rel *rel, s
(void)depth;
/* ranks/window functions only exist in the projection */
list *l = e->l, *r = e->r, *gbe = r->h->data, *obe = r->h->next->data;
-   e->card = (rel->card == CARD_AGGR) ? CARD_AGGR : CARD_MULTI; /* After 
the unnesting, the cardinality of the window function becomes larger */
 
int needed = (gbe || obe);
if (l)
@@ -2842,8 +2841,6 @@ rel_union_exps(mvc *sql, sql_exp **l, li
exp_label(sql->sa, ve, ++sql->label); /* an alias is needed */
if (exp_has_rel(ve)) {
sq = exp_rel_get_rel(sql->sa, ve); /* get subquery */
-   if (sq)
-   freevar = rel_has_freevar(sql,sq);
} else {
sq = rel_project(sql->sa, NULL, 
append(sa_list(sql->sa), ve));
if (!exp_is_atom(ve))
diff --git a/sql/test/BugTracker-2024/Tests/mvc_row_result_wrap-Bug-7481.test 
b/sql/test/BugTracker-2024/Tests/mvc_row_result_wrap-Bug-7481.test
--- a/sql/test/BugTracker-2024/Tests/mvc_row_result_wrap-Bug-7481.test
+++ b/sql/test/BugTracker-2024/Tests/mvc_row_result_wrap-Bug-7481.test
@@ -8,7 +8,6 @@ SELECT CASE WHEN COUNT ( ) OVER ( ) THEN
 
 63
 
-skipif knownfail
 query II nosort
 SELECT 50 , CASE WHEN COUNT ( ) OVER ( ) THEN ( 63 ) END
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed issue #7482, with global group by's the...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 20acc7b01f57 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/20acc7b01f57
Modified Files:
sql/backends/monet5/rel_bin.c
sql/test/BugTracker-2024/Tests/bin_find_smallest_column-Bug-7482.test
Branch: default
Log Message:

fixed issue #7482, with global group by's there is an empty sub expression list


diffs (22 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
@@ -1713,7 +1713,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
   and/or an attribute to count */
if (grp) {
as = grp;
-   } else if (left) {
+   } else if (left && !list_empty(left->op4.lval)) {
as = bin_find_smallest_column(be, left);
as = exp_count_no_nil_arg(e, ext, NULL, as);
} else {
diff --git 
a/sql/test/BugTracker-2024/Tests/bin_find_smallest_column-Bug-7482.test 
b/sql/test/BugTracker-2024/Tests/bin_find_smallest_column-Bug-7482.test
--- a/sql/test/BugTracker-2024/Tests/bin_find_smallest_column-Bug-7482.test
+++ b/sql/test/BugTracker-2024/Tests/bin_find_smallest_column-Bug-7482.test
@@ -1,5 +1,5 @@
-skipif knownfail
 query I nosort
 SELECT var_samp ( '12' ) OVER ( ORDER BY CAST ( ( CASE WHEN ( 99 ) THEN COUNT 
( * ) ELSE CASE WHEN 1 THEN ( FALSE ) END END ) AS BIGINT ) )
 
+0
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - missing break in GDKanalyticalntile for the h...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 306d21881f9c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/306d21881f9c
Modified Files:
gdk/gdk_analytic_func.c
Branch: default
Log Message:

missing break in GDKanalyticalntile for the hge implementation


diffs (20 lines):

diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -157,6 +157,7 @@ GDKanalyticalntile(BAT *r, BAT *b, BAT *
 #else
ANALYTICAL_NTILE_SINGLE_IMP(hge, (val > (hge) 
GDK_lng_max) ? GDK_lng_max : (lng) val, BUN);
 #endif
+   break;
 #endif
default:
goto nosupport;
@@ -186,7 +187,7 @@ GDKanalyticalntile(BAT *r, BAT *b, BAT *
 #else
ANALYTICAL_NTILE_MULTI_IMP(hge, val > (hge) GDK_lng_max 
? GDK_lng_max : (lng) val, BUN);
 #endif
-   break;
+   break;
 #endif
default:
goto nosupport;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed issue #7483, introduce project in order...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 852e065654bd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/852e065654bd
Modified Files:
sql/backends/monet5/sql_rank.c
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/rel_setop_get_statistics-Bug-7483.test
Branch: default
Log Message:

fixed issue #7483, introduce project in order by if relation isn't a simple 
project yet.
fixed returns of error messages in rel_rankop.c


diffs (48 lines):

diff --git a/sql/backends/monet5/sql_rank.c b/sql/backends/monet5/sql_rank.c
--- a/sql/backends/monet5/sql_rank.c
+++ b/sql/backends/monet5/sql_rank.c
@@ -832,7 +832,7 @@ SQLntile(Client cntxt, MalBlkPtr mb, Mal
 bailout:
unfix_inputs(3, b, p, n);
finalize_output(res, r, msg);
-   return MAL_SUCCEED;
+   return msg;
 }
 
 static str
@@ -954,7 +954,7 @@ do_limit_value(Client cntxt, MalBlkPtr m
 bailout:
unfix_inputs(3, b, s, e);
finalize_output(res, r, msg);
-   return MAL_SUCCEED;
+   return msg;
 }
 
 str
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4374,6 +4374,8 @@ rel_order_by_column_exp(sql_query *query
if (!found) {
if (needs_distinct)
return sql_error(sql, 02, SQLSTATE(42000) 
"SELECT: with DISTINCT ORDER BY expressions must appear in select list");
+   if (!is_simple_project(r->op))
+   *R = r = rel_project(sql->sa, r, 
rel_projections(sql, r, NULL, 1, 0));
append(r->exps, e);
} else {
e = found;
diff --git 
a/sql/test/BugTracker-2024/Tests/rel_setop_get_statistics-Bug-7483.test 
b/sql/test/BugTracker-2024/Tests/rel_setop_get_statistics-Bug-7483.test
--- a/sql/test/BugTracker-2024/Tests/rel_setop_get_statistics-Bug-7483.test
+++ b/sql/test/BugTracker-2024/Tests/rel_setop_get_statistics-Bug-7483.test
@@ -4,8 +4,9 @@ SELECT 'x' x UNION SELECT 10 x
 x
 10
 
-skipif knownfail
-query T nosort
+query I nosort
 SELECT NTILE ( 1.00 ) OVER ( ORDER BY x LIKE x ) FROM ( SELECT 'x' x UNION 
SELECT 10 x ) v
 
+1
+1
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed bug #7486, topn's over referenced relat...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 150ba22209cb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/150ba22209cb
Modified Files:
sql/backends/monet5/rel_bin.c
sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test
Branch: default
Log Message:

fixed bug #7486, topn's over referenced relations need to lookup the allready 
constructed relation


diffs (36 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
@@ -4560,7 +4560,10 @@ rel2bin_topn(backend *be, sql_rel *rel, 
sql_rel *rl = rel->l;
 
if (rl->op == op_project) {
-   sub = rel2bin_project(be, rl, refs, rel);
+   if (rel_is_ref(rl))
+   sub = refs_find_rel(refs, rl);
+   else
+   sub = rel2bin_project(be, rl, refs, rel);
} else {
sub = subrel_bin(be, rl, refs);
}
diff --git a/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test 
b/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test
--- a/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test
+++ b/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test
@@ -5,7 +5,6 @@ NULL
 NULL
 NULL
 
-skipif knownfail
 query I nosort
 WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT SELECT * 
FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 , MAX ( CASE 
WHEN 97 THEN 66 END ) OVER ( ) + ( SELECT COUNT ( * ) ) ) THEN 41 END FROM x 
LIMIT 3
 
@@ -13,8 +12,7 @@ NULL
 NULL
 NULL
 
-skipif knownfail
-query I nosort
+statement error GDK reported error: BATsubcross: more than one match
 SELECT ( WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT 
SELECT * FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 , MAX 
( CASE WHEN 97 THEN 66 END ) OVER ( ) + ( SELECT COUNT ( * ) ) ) THEN 41 END 
FROM x )
 
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - When persiste_unlogged finds table is not yet...

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: d3f43b823539 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d3f43b823539
Modified Files:
gdk/gdk_logger.c
sql/ChangeLog.Dec2023
sql/backends/monet5/sql.c
sql/storage/store.c
Branch: Dec2023
Log Message:

When persiste_unlogged finds table is not yet persistent, it requests log 
rotation.


diffs (67 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3474,6 +3474,12 @@ log_tstart(logger *lg, bool flushnow, ul
 {
rotation_lock(lg);
if (flushnow) {
+   if (file_id == NULL) {
+   /* special case: ask store_manager to rotate log file */
+   lg->file_age = 0;
+   rotation_unlock(lg);
+   return GDK_SUCCEED;
+   }
/* I am now the exclusive flusher */
if (ATOMIC_GET(&lg->nr_flushers)) {
/* I am waiting until all existing flushers are done */
diff --git a/sql/ChangeLog.Dec2023 b/sql/ChangeLog.Dec2023
--- a/sql/ChangeLog.Dec2023
+++ b/sql/ChangeLog.Dec2023
@@ -1,3 +1,12 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed May 15 2024 Sjoerd Mullender 
+- When sys.persist_unlogged is called for a table, it may return that
+  zero rows were persisted.  If this is because the call was done too
+  early, i.e. the table was recently created and the write-ahead log
+  where this was logged has not been processed yet, the call will
+  request an immediate write-ahead log rotation.  This means that the
+  WAL will be processed as soon as possible and a new call to
+  sys.persist_unlogged soon after will likely return a positive result.
+
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4436,6 +4436,16 @@ SQLpersist_unlogged(Client cntxt, MalBlk
GDKfree(sizes);
}
count = d_bi.count;
+   } else {
+   /* special case of log_tstart: third arg == NULL with second arg
+* true is request to rotate log file ASAP */
+   store->logger_api.log_tstart(store, true, NULL);
+   /* special case for sql->debug: if 1024 bit is set,
+* store_manager doesn't wait for 30 seconds of idle time before
+* attempting to rotate */
+   MT_lock_set(&store->flush);
+   store->debug |= 1024;
+   MT_lock_unset(&store->flush);
}
 
bat_iterator_end(&d_bi);
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2420,7 +2420,10 @@ store_manager(sqlstore *store)
 
for (;;) {
const int idle = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 5000 : 
IDLE_TIME * 100;
-   if (store->debug&128 || ATOMIC_GET(&store->lastactive) + idle < 
(ATOMIC_BASE_TYPE) GDKusec()) {
+   /* if debug bit 1024 is set, attempt immediate log activation
+* and clear the bit */
+   if (store->debug&(128|1024) || ATOMIC_GET(&store->lastactive) + 
idle < (ATOMIC_BASE_TYPE) GDKusec()) {
+   store->debug &= ~1024;
MT_lock_unset(&store->flush);
store_lock(store);
if (ATOMIC_GET(&store->nr_active) == 0) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - improved fix for #7486, is if reference isn't...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 0fdcd4435c62 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0fdcd4435c62
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: default
Log Message:

improved fix for #7486, is if reference isn't yet handled, do that first.


diffs (17 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
@@ -4560,9 +4560,11 @@ rel2bin_topn(backend *be, sql_rel *rel, 
sql_rel *rl = rel->l;
 
if (rl->op == op_project) {
-   if (rel_is_ref(rl))
+   if (rel_is_ref(rl)) {
sub = refs_find_rel(refs, rl);
-   else
+   if (!sub)
+   sub = rel2bin_project(be, rl, refs, 
rel);
+   } else
sub = rel2bin_project(be, rl, refs, rel);
} else {
sub = subrel_bin(be, rl, refs);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - improved fix for bug #7483, only set operatio...

2024-05-15 Thread Niels Nes via checkin-list
Changeset: 342491c20478 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/342491c20478
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

improved fix for bug #7483, only set operations need an extra project


diffs (12 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4374,7 +4374,7 @@ rel_order_by_column_exp(sql_query *query
if (!found) {
if (needs_distinct)
return sql_error(sql, 02, SQLSTATE(42000) 
"SELECT: with DISTINCT ORDER BY expressions must appear in select list");
-   if (!is_simple_project(r->op))
+   if (!is_simple_project(r->op) && !is_groupby(r->op))
*R = r = rel_project(sql->sa, r, 
rel_projections(sql, r, NULL, 1, 0));
append(r->exps, e);
} else {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Compilation issue when compiling without XML ...

2024-05-15 Thread Sjoerd Mullender via checkin-list
Changeset: d0d83af809d1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d0d83af809d1
Modified Files:
monetdb5/modules/atoms/xml.c
Branch: Dec2023
Log Message:

Compilation issue when compiling without XML support.


diffs (15 lines):

diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c
--- a/monetdb5/modules/atoms/xml.c
+++ b/monetdb5/modules/atoms/xml.c
@@ -735,9 +735,9 @@ XMLxml2str(str *s, const xml *x)
 }
 
 str
-XMLstr2xml(xml *x, const char **s)
+XMLstr2xml(xml *x, const char *const*val)
 {
-   (void) s;
+   (void) val;
(void) x;
return createException(MAL, "xml.xml2str", SQLSTATE(HY005) 
NO_LIBXML_FATAL);
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: odbc-tls - Extend ODBC Data Source config dialog with n...

2024-05-15 Thread Martin van Dinther via checkin-list
Changeset: 1574d2b620c1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1574d2b620c1
Modified Files:
clients/odbc/winsetup/resource.h
clients/odbc/winsetup/setup.c
clients/odbc/winsetup/setup.rc
Branch: odbc-tls
Log Message:

Extend ODBC Data Source config dialog with new connection options. WIP


diffs (117 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -23,6 +23,18 @@
 #define IDC_EDIT_PORT   2005
 #define IDC_EDIT_DATABASE   2006
 #define IDC_EDIT_LOGFILE2007
+// new from Jun2024
+#define IDC_EDIT_AUTOCOMMIT 2011
+#define IDC_EDIT_REPLYSIZE  2012
+#define IDC_EDIT_SCHEMA 2013
+#define IDC_EDIT_TIMEZONE   2014
+// Secure connections using TLS
+#define IDC_EDIT_TLS2021
+#define IDC_EDIT_SERVERCERT 2022
+#define IDC_EDIT_SERVERCERTHASH 2023
+#define IDC_EDIT_CLIENTKEY  2024
+#define IDC_EDIT_CLIENTCERT 2025
+
 #define IDC_BUTTON_CANCEL   2008
 
 // Next default values for new objects
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -96,7 +96,17 @@ struct data {
char *host;
char *port;
char *database;
+   char *schema;
+   bool autocommit = true;
+   long replysize;
+   long timezone;
char *logfile;
+   // TLS settings
+   bool use_tls = false;
+   char *servercert;
+   char *servercerthash;
+   char *clientkey;
+   char *clientcert;
HWND parent;
WORD request;
 };
@@ -235,6 +245,18 @@ ConfigDSN(HWND parent, WORD request, LPC
data.port = NULL;
data.database = NULL;
data.logfile = NULL;
+   data.schema = NULL;
+   data.autocommit = true;
+// data.replysize = 1000;
+// data.timezone;
+   data.logfile = NULL;
+   // TLS settings
+   data.use_tls = false;
+   data.servercert = NULL;
+   data.servercerthash = NULL;
+   data.clientkey = NULL;
+   data.clientcert = NULL;
+
data.parent = parent;
data.request = request;
 
diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc
--- a/clients/odbc/winsetup/setup.rc
+++ b/clients/odbc/winsetup/setup.rc
@@ -103,27 +103,45 @@ END
 // Dialog
 //
 
-IDD_SETUP_DIALOG DIALOGEX 0, 0, 210, 179
+IDD_SETUP_DIALOG DIALOGEX 0, 0, 210, 323
 STYLE DS_MODALFRAME | WS_CAPTION
 CAPTION "MonetDB Data Source Configuration"
 FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
 EDITTEXTIDC_EDIT_DSN,75,40,128,14,ES_AUTOHSCROLL
 EDITTEXTIDC_EDIT_UID,75,56,128,14,ES_AUTOHSCROLL
-EDITTEXTIDC_EDIT_PWD,75,72,128,14,ES_PASSWORD | ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_PWD,75,72,128,14,ES_AUTOHSCROLL | ES_PASSWORD
 EDITTEXTIDC_EDIT_HOST,75,88,128,14,ES_AUTOHSCROLL
 EDITTEXTIDC_EDIT_PORT,75,104,128,14,ES_AUTOHSCROLL | ES_NUMBER
 EDITTEXTIDC_EDIT_DATABASE,75,120,128,14,ES_AUTOHSCROLL
-EDITTEXTIDC_EDIT_LOGFILE,75,136,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_SCHEMA,75,136,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_AUTOCOMMIT,75,152,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_REPLYSIZE,75,168,128,14,ES_AUTOHSCROLL | ES_NUMBER
+EDITTEXTIDC_EDIT_TIMEZONE,75,184,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_LOGFILE,75,200,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_TLS,75,216,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_SERVERCERT,75,232,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_SERVERCERTHASH,75,248,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_CLIENTKEY,75,264,128,14,ES_AUTOHSCROLL
+EDITTEXTIDC_EDIT_CLIENTCERT,75,280,128,14,ES_AUTOHSCROLL
 LTEXT   "Data Source Name",IDC_STATIC,7,42,63,8
 LTEXT   "User Name",IDC_STATIC,7,58,36,8
 LTEXT   "Password",IDC_STATIC,7,74,32,8
 LTEXT   "Host",IDC_STATIC,7,90,16,8
 LTEXT   "Port",IDC_STATIC,7,106,14,8
 LTEXT   "Database",IDC_STATIC,7,122,32,8
-LTEXT   "Logfile",IDC_STATIC,7,138,32,8
-DEFPUSHBUTTON   "OK",IDOK,7,157,50,14
-PUSHBUTTON  "Cancel",IDCANCEL,153,157,50,14
+LTEXT   "Schema",IDC_STATIC,7,138,32,8
+LTEXT   "Autocommit On/Off",IDC_STATIC,7,154,63,8
+LTEXT   "Reply Size",IDC_STATIC,7,170,32,8
+LTEXT   "Timezone",IDC_STATIC,7,186,32,8
+LTEXT   "Logfile",IDC_STATIC,7,202,32,8
+LTEXT   "TLS Encrypt On/Off",IDC_STATIC,7,218,66,8
+LTEXT   "Server Certificate",IDC_STATIC,7,234,66,8
+LTEXT   "Server Certificate Hash",IDC_STATIC,7,250,70,8
+LTEXT   "Client Key",IDC_STATIC,7,266,36,8
+LTEX

MonetDB: odbc-tls - Remove spaces from key names (they are used ...

2024-05-15 Thread Martin van Dinther via checkin-list
Changeset: d289163674ef for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d289163674ef
Modified Files:
clients/odbc/driver/SQLConnect.c
Branch: odbc-tls
Log Message:

Remove spaces from key names (they are used in ODBC.INI file and registry keys).


diffs (47 lines):

diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -186,9 +186,9 @@ MNDBConnect(ODBCDbc *dbc,
char *dsn = NULL;
char *uid = NULL;
char *pwd = NULL;
-   char *db = NULL;
char *hostdup = NULL;
char *portdup = NULL;
+   char *db = NULL;
char *logbuf = NULL;
Mapi mid = NULL;
msettings *settings = NULL;
@@ -315,16 +315,16 @@ MNDBConnect(ODBCDbc *dbc,
// The other parameters can only be set from the data source.
// We have made a helper function for that.
if (false
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_SOCK, "Unix Socket")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_SOCK, "UnixSocket")
|| !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_TLS, "Encrypt")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CERT, "Server Certificate")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CERTHASH, "Server Certificate Hash")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CLIENTKEY, "Client Key")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CLIENTCERT, "Client Certificate")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CERT, "ServerCertificate")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CERTHASH, "ServerCertificateHash")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CLIENTKEY, "ClientKey")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_CLIENTCERT, "ClientCertificate")
|| !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_AUTOCOMMIT, "Autocommit")
|| !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_SCHEMA, "Schema")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_TIMEZONE, "Time Zone")
-   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_REPLYSIZE, "Reply Size")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_TIMEZONE, "TimeZone")
+   || !ds_setting(settings, dsn, &error_state, &error_explanation, 
MP_REPLYSIZE, "ReplySize")
 
) {
goto failure;
@@ -394,7 +394,7 @@ MNDBConnect(ODBCDbc *dbc,
 
 failure:
if (error_state == NULL)
-   error_state = "HY001";
+   error_state = "HY001";  /* Memory allocation error */
addDbcError(dbc, error_state, error_explanation, 0);
// fallthrough
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: odbc-tls - When disconnect also free the used connectio...

2024-05-15 Thread Martin van Dinther via checkin-list
Changeset: 0307a2a25eb2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0307a2a25eb2
Modified Files:
clients/odbc/driver/SQLDisconnect.c
Branch: odbc-tls
Log Message:

When disconnect also free the used connection property strings, so they are not 
visible for a next connection using the same HDBC, which is allowed.


diffs (36 lines):

diff --git a/clients/odbc/driver/SQLDisconnect.c 
b/clients/odbc/driver/SQLDisconnect.c
--- a/clients/odbc/driver/SQLDisconnect.c
+++ b/clients/odbc/driver/SQLDisconnect.c
@@ -63,11 +63,31 @@ SQLDisconnect(SQLHDBC ConnectionHandle)
mapi_destroy(dbc->mid);
 
dbc->mid = NULL;
+   dbc->Connected = false;
dbc->cachelimit = 0;
dbc->Mdebug = 0;
-   dbc->Connected = false;
dbc->has_comment = false;
dbc->raw_strings = false;
+   if (dbc->dsn) {
+   free(dbc->dsn);
+   dbc->dsn = NULL;
+   }
+   if (dbc->uid) {
+   free(dbc->uid);
+   dbc->uid = NULL;
+   }
+   if (dbc->pwd) {
+   free(dbc->pwd);
+   dbc->pwd = NULL;
+   }
+   if (dbc->host) {
+   free(dbc->host);
+   dbc->host = NULL;
+   }
+   if (dbc->dbname) {
+   free(dbc->dbname);
+   dbc->dbname = NULL;
+   }
 
return SQL_SUCCESS;
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org