MonetDB: resource_management - syntax
Changeset: 0e026bf68f44 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0e026bf68f44 Modified Files: gdk/gdk.h Branch: resource_management Log Message: syntax diffs (20 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2473,13 +2473,13 @@ gdk_export gdk_return BATfirstn(BAT **to #include "gdk_calc.h" -gdk_export gdk_return GDKtoupper(char **restrict buf, size_t *restrict buflen, const char *restrict s); +gdk_export gdk_return GDKtoupper(char **restrict buf, size_t *restrict buflen, const char *restrict s) __attribute__((__access__(read_write, 1))) __attribute__((__access__(read_write, 2))); -gdk_export gdk_return GDKtolower(char **restrict buf, size_t *restrict buflen, const char *restrict s); +gdk_export gdk_return GDKtolower(char **restrict buf, size_t *restrict buflen, const char *restrict s) __attribute__((__access__(read_write, 1))) __attribute__((__access__(read_write, 2))); -gdk_export gdk_return GDKcasefold(char **restrict buf, size_t *restrict buflen, const char *restrict s); +gdk_export gdk_return GDKcasefold(char **restrict buf, size_t *restrict buflen, const char *restrict s) __attribute__((__access__(read_write, 1))) __attribute__((__access__(read_write, 2))); gdk_export int GDKstrncasecmp(const char *str1, const char *str2, size_t l1, size_t l2); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - Merge with Aug2024 branch.
Changeset: f69ea2e3922b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f69ea2e3922b Modified Files: gdk/gdk_firstn.c sql/server/rel_updates.c Branch: default Log Message: Merge with Aug2024 branch. diffs (truncated from 2035 to 300 lines): diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -187,8 +187,7 @@ do {\ const TYPE *restrict vals = (const TYPE *) bi->base;\ heapify(OP##fix, SWAP1);\ - while (cnt > 0) { \ - cnt--; \ + TIMEOUT_LOOP(ci.ncand - n, qry_ctx) { \ i = canditer_next(&ci); \ if (OP(vals[i - hseq], \ vals[oids[0] - hseq])) { \ @@ -214,7 +213,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU BAT *bn; oid *restrict oids; oid hseq = bi->b->hseqbase; - BUN i, cnt; + BUN i; struct canditer ci; int tpe = bi->type; int (*cmp)(const void *, const void *); @@ -225,9 +224,8 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU MT_thread_setalgorithm(__func__); canditer_init(&ci, bi->b, s); - cnt = ci.ncand; - if (n >= cnt) { + if (n >= ci.ncand) { /* trivial: return all candidates */ bn = canditer_slice(&ci, 0, ci.ncand); if (bn && lastp) @@ -258,7 +256,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } /* return the last part of the candidate list or of * the BAT itself */ - bn = canditer_slice(&ci, cnt - n, cnt); + bn = canditer_slice(&ci, ci.ncand - n, ci.ncand); if (bn && lastp) *lastp = BUNtoid(bn, 0); TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",s=" ALGOOPTBATFMT @@ -281,18 +279,18 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU if (nilslast == asc && !bi->nonil) { pos = SORTfndlast(bi->b, ATOMnilptr(tpe)); pos = canditer_search(&ci, hseq + pos, true); - /* 0 <= pos <= cnt -* 0 < n < cnt + /* 0 <= pos <= ci.ncand +* 0 < n < ci.ncand */ if (bi->sorted) { /* [0..pos) -- nil -* [pos..cnt) -- non-nil <<< +* [pos..ci.ncand) -- non-nil <<< */ if (asc) { /* i.e. nilslast */ /* prefer non-nil and * smallest */ - if (cnt - pos < n) { - bn = canditer_slice(&ci, cnt - n, cnt); + if (ci.ncand - pos < n) { + bn = canditer_slice(&ci, ci.ncand - n, ci.ncand); pos = 0; } else { bn = canditer_slice(&ci, pos, pos + n); @@ -301,7 +299,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } else { /* i.e. !asc, !nilslast */ /* prefer nil and largest */ if (pos < n) { - bn = canditer_slice2(&ci, 0, pos, cnt - (n - pos), cnt); + bn = canditer_slice2(&ci, 0, pos, ci.ncand - (n - pos), ci.ncand); /* pos = pos; */ } else { bn = canditer_slice(&ci, 0, n); @@ -310,7 +308,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } } else { /* i.e. trevsorted */ /* [0..pos) -- non-nil >>> -* [pos..cnt) -- nil +* [pos..ci.ncand) -- nil */ if (asc) { /* i.e. nilslast */ /* prefer non-nil and @@ -324,9 +322,9 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } } else { /* i.e. !asc, !nilslast */ /* prefer nil and largest */ - if (cnt - pos < n)
MonetDB: Aug2024 - Implemented timeout support in BATfirstn impl...
Changeset: f8d2a71d48c5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f8d2a71d48c5 Modified Files: gdk/gdk_firstn.c Branch: Aug2024 Log Message: Implemented timeout support in BATfirstn implementation. diffs (truncated from 305 to 300 lines): diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -187,8 +187,7 @@ do {\ const TYPE *restrict vals = (const TYPE *) bi->base;\ heapify(OP##fix, SWAP1);\ - while (cnt > 0) { \ - cnt--; \ + TIMEOUT_LOOP(ci.ncand - n, qry_ctx) { \ i = canditer_next(&ci); \ if (OP(vals[i - hseq], \ vals[oids[0] - hseq])) { \ @@ -214,7 +213,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU BAT *bn; oid *restrict oids; oid hseq = bi->b->hseqbase; - BUN i, cnt; + BUN i; struct canditer ci; int tpe = bi->type; int (*cmp)(const void *, const void *); @@ -225,9 +224,8 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU MT_thread_setalgorithm(__func__); canditer_init(&ci, bi->b, s); - cnt = ci.ncand; - if (n >= cnt) { + if (n >= ci.ncand) { /* trivial: return all candidates */ bn = canditer_slice(&ci, 0, ci.ncand); if (bn && lastp) @@ -258,7 +256,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } /* return the last part of the candidate list or of * the BAT itself */ - bn = canditer_slice(&ci, cnt - n, cnt); + bn = canditer_slice(&ci, ci.ncand - n, ci.ncand); if (bn && lastp) *lastp = BUNtoid(bn, 0); TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",s=" ALGOOPTBATFMT @@ -281,18 +279,18 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU if (nilslast == asc && !bi->nonil) { pos = SORTfndlast(bi->b, ATOMnilptr(tpe)); pos = canditer_search(&ci, hseq + pos, true); - /* 0 <= pos <= cnt -* 0 < n < cnt + /* 0 <= pos <= ci.ncand +* 0 < n < ci.ncand */ if (bi->sorted) { /* [0..pos) -- nil -* [pos..cnt) -- non-nil <<< +* [pos..ci.ncand) -- non-nil <<< */ if (asc) { /* i.e. nilslast */ /* prefer non-nil and * smallest */ - if (cnt - pos < n) { - bn = canditer_slice(&ci, cnt - n, cnt); + if (ci.ncand - pos < n) { + bn = canditer_slice(&ci, ci.ncand - n, ci.ncand); pos = 0; } else { bn = canditer_slice(&ci, pos, pos + n); @@ -301,7 +299,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } else { /* i.e. !asc, !nilslast */ /* prefer nil and largest */ if (pos < n) { - bn = canditer_slice2(&ci, 0, pos, cnt - (n - pos), cnt); + bn = canditer_slice2(&ci, 0, pos, ci.ncand - (n - pos), ci.ncand); /* pos = pos; */ } else { bn = canditer_slice(&ci, 0, n); @@ -310,7 +308,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } } else { /* i.e. trevsorted */ /* [0..pos) -- non-nil >>> -* [pos..cnt) -- nil +* [pos..ci.ncand) -- nil */ if (asc) { /* i.e. nilslast */ /* prefer non-nil and @@ -324,9 +322,9 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU } } else { /* i.e. !asc, !nilslast */ /* prefer nil and largest */ - if (cnt - pos < n) { -
MonetDB: default - Implemented algebra.groupedfirstn/BATgroupedf...
Changeset: e5c5d2f2a779 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e5c5d2f2a779 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_firstn.c monetdb5/modules/kernel/algebra.c Branch: default Log Message: Implemented algebra.groupedfirstn/BATgroupedfirstn to do grouped top-N. diffs (truncated from 338 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -3444,6 +3444,11 @@ command algebra.groupby(X_0:bat[:oid], X ALGgroupby; Produces a new BAT with groups identified by the head column. The result contains tail times the head value, ie the tail contains the result group sizes. algebra +groupedfirstn +pattern algebra.groupedfirstn(X_0:lng, X_1:bat[:oid], X_2:bat[:oid], X_3:any...):bat[:oid] +ALGgroupedfirstn; +Grouped firstn +algebra intersect command algebra.intersect(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:bit, X_6:lng):bat[:oid] ALGintersect; 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 @@ -2879,6 +2879,11 @@ command algebra.groupby(X_0:bat[:oid], X ALGgroupby; Produces a new BAT with groups identified by the head column. The result contains tail times the head value, ie the tail contains the result group sizes. algebra +groupedfirstn +pattern algebra.groupedfirstn(X_0:lng, X_1:bat[:oid], X_2:bat[:oid], X_3:any...):bat[:oid] +ALGgroupedfirstn; +Grouped firstn +algebra intersect command algebra.intersect(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:bit, X_6:lng):bat[:oid] ALGintersect; 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 @@ -135,6 +135,7 @@ BAT *BATgroupcorrelation(BAT *b1, BAT *b BAT *BATgroupcount(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); BAT *BATgroupcovariance_population(BAT *b1, BAT *b2, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); BAT *BATgroupcovariance_sample(BAT *b1, BAT *b2, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); +BAT *BATgroupedfirstn(BUN n, BAT *s, BAT *g, int nbats, BAT **bats, bool *asc, bool *nilslast) __attribute__((__warn_unused_result__)); BAT *BATgroupmax(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); BAT *BATgroupmedian(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); BAT *BATgroupmedian_avg(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2340,6 +2340,8 @@ gdk_export gdk_return BATfirstn(BAT **to __attribute__((__access__(write_only, 1))) __attribute__((__access__(write_only, 2))) __attribute__((__warn_unused_result__)); +gdk_export BAT *BATgroupedfirstn(BUN n, BAT *s, BAT *g, int nbats, BAT **bats, bool *asc, bool *nilslast) + __attribute__((__warn_unused_result__)); #include "gdk_calc.h" diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -1328,3 +1328,189 @@ BATfirstn(BAT **topn, BAT **gids, BAT *b bat_iterator_end(&bi); return rc; } + +/* Calculate the first N values for each group given in G of the bats in + * BATS (of which there are NBATS), but only considering the candidates + * in S. + * + * Conceptually, the bats in BATS are sorted per group, taking the + * candidate list S and the values in ASC and NILSLAST into account. + * For each group, the first N rows are then returned. + * + * For each bat, the sort order that is to be used is specified in the + * array ASC. The first N values means the smallest N values if asc is + * set, the largest if not set. If NILSLAST for a bat is set, nils are + * only returned if there are not enough non-nil values; if nilslast is + * not set, nils are returned preferentially. + * + * The return value is a bat with N consecutive values for each group in + * G. Values are nil if there are not enough values in the group, else + * they are row ids of the first rows. + */ +BAT * +BATgroupedfirstn(BUN n, BAT *s, BAT *g, int nbats, BAT **bats, bool *asc, bool *nilslast) +{ + const char *err; + oid min, max; + BUN ngrp; + struct canditer ci; + QryCtx *qry_ctx = MT_thread_get_qry_ctx(); + struct batinfo { + BATiter bi1; + BATiter bi2; + oid hseq; + bool asc; + bool nilslast; + const void *nil; + int (*cmp)(const void *, const void *); + } *batinfo; + + assert(nbats > 0); + + if (n == 0 || BATcount(bats[0]) == 0) { + return BATdense(0, 0, 0)
MonetDB: Aug2024 - Fiexed Windows output after copy into from ma...
Changeset: bd3d9c21e8d3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bd3d9c21e8d3 Modified Files: sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test Branch: Aug2024 Log Message: Fiexed Windows output after copy into from many files fix. diffs (21 lines): diff --git a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test --- a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test +++ b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test @@ -18,7 +18,7 @@ insert( | | | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", varchar NULL, varchar "null", varchar "\\file2", bigint(1) "-1", bigint(1) "0", int(1) "0", varchar NULL, int(1) "0", int(1) "1", varchar ".", varchar NULL), | | | ) [ "cm_tmp"."i" ] | | ) [ "cm_tmp"."i" ] -| ) [ int(31) NULL ] +| ) [ "cm_tmp"."i" ] ) query T nosort @@ -35,7 +35,7 @@ insert( | | | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", varchar NULL, varchar "null", varchar "Z:/file2", bigint(1) "-1", bigint(1) "0", int(1) "0", varchar NULL, int(1) "0", int(1) "1", varchar ".", varchar NULL), | | | ) [ "cm_tmp"."i" ] | | ) [ "cm_tmp"."i" ] -| ) [ int(31) NULL ] +| ) [ "cm_tmp"."i" ] ) statement ok ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: ordered-set-aggregates - merged with default
Changeset: 7ced4c4c0153 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7ced4c4c0153 Modified Files: sql/common/sql_types.c sql/server/sql_parser.y sql/storage/bat/bat_logger.c sql/storage/store.c sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 Branch: ordered-set-aggregates Log Message: merged with default diffs (truncated from 28025 to 300 lines): diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -56,3 +56,4 @@ MacOSX/usr # Don't keep the result of the documentation compilation documentation/build +.cache/clangd diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -3444,6 +3444,11 @@ command algebra.groupby(X_0:bat[:oid], X ALGgroupby; Produces a new BAT with groups identified by the head column. The result contains tail times the head value, ie the tail contains the result group sizes. algebra +groupedfirstn +pattern algebra.groupedfirstn(X_0:lng, X_1:bat[:oid], X_2:bat[:oid], X_3:any...):bat[:oid] +ALGgroupedfirstn; +Grouped firstn +algebra intersect command algebra.intersect(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:bit, X_6:lng):bat[:oid] ALGintersect; @@ -30528,91 +30533,6 @@ eval pattern batcapi.eval(X_0:ptr, X_1:bit, X_2:str, X_3:any...):any... CUDFevalStd; Execute a simple CUDF script value -batcolor -blue -command batcolor.blue(X_0:bat[:color]):bat[:int] -CLRbatBlue; -Extracts blue component from a color atom -batcolor -cb -command batcolor.cb(X_0:bat[:color]):bat[:int] -CLRbatCb; -Extracts Cb(blue color) component from a color atom -batcolor -color -command batcolor.color(X_0:bat[:str]):bat[:color] -CLRbatColor; -Converts string to color -batcolor -cr -command batcolor.cr(X_0:bat[:color]):bat[:int] -CLRbatCr; -Extracts Cr(red color) component from a color atom -batcolor -green -command batcolor.green(X_0:bat[:color]):bat[:int] -CLRbatGreen; -Extracts green component from a color atom -batcolor -hsv -command batcolor.hsv(X_0:bat[:flt], X_1:bat[:flt], X_2:bat[:flt]):bat[:color] -CLRbatHsv; -Converts an HSV triplets to a color atom -batcolor -hue -command batcolor.hue(X_0:bat[:color]):bat[:flt] -CLRbatHue; -Extracts hue component from a color atom -batcolor -hue -command batcolor.hue(X_0:bat[:color]):bat[:int] -CLRbatHueInt; -Extracts hue component from a color atom -batcolor -luminance -command batcolor.luminance(X_0:bat[:color]):bat[:int] -CLRbatLuminance; -Extracts Y(luminance) component from a color atom -batcolor -red -command batcolor.red(X_0:bat[:color]):bat[:int] -CLRbatRed; -Extracts red component from a color atom -batcolor -rgb -command batcolor.rgb(X_0:bat[:int], X_1:bat[:int], X_2:bat[:int]):bat[:color] -CLRbatRgb; -Converts an RGB triplets to a color atom -batcolor -saturation -command batcolor.saturation(X_0:bat[:color]):bat[:flt] -CLRbatSaturation; -Extracts saturation component from a color atom -batcolor -saturation -command batcolor.saturation(X_0:bat[:color]):bat[:int] -CLRbatSaturationInt; -Extracts saturation component from a color atom -batcolor -str -command batcolor.str(X_0:bat[:color]):bat[:str] -CLRbatStr; -Identity mapping for string bats -batcolor -value -command batcolor.value(X_0:bat[:color]):bat[:flt] -CLRbatValue; -Extracts value component from a color atom -batcolor -value -command batcolor.value(X_0:bat[:color]):bat[:int] -CLRbatValueInt; -Extracts value component from a color atom -batcolor -ycc -command batcolor.ycc(X_0:bat[:flt], X_1:bat[:flt], X_2:bat[:flt]):bat[:color] -CLRbatycc; -Converts an YCC triplets to a color atom batgeom AsEWKT command batgeom.AsEWKT(X_0:bat[:wkb]):bat[:str] @@ -32300,22 +32220,22 @@ MTIMEstr_to_date_bulk; (empty) batmtime str_to_date -pattern batmtime.str_to_date(X_0:str, X_1:bat[:str], X_2:bat[:oid], X_3:lng):bat[:date] -MTIMEstr_to_date_bulk_p1; -(empty) -batmtime -str_to_date pattern batmtime.str_to_date(X_0:str, X_1:bat[:str], X_2:lng):bat[:date] MTIMEstr_to_date_bulk_p1; (empty) batmtime str_to_date -pattern batmtime.str_to_date(X_0:bat[:str], X_1:str, X_2:bat[:oid], X_3:lng):bat[:date] +pattern batmtime.str_to_date(X_0:str, X_1:bat[:str], X_2:lng, X_3:bat[:oid]):bat[:date] +MTIMEstr_to_date_bulk_p1; +(empty) +batmtime +str_to_date +pattern batmtime.str_to_date(X_0:bat[:str], X_1:str, X_2:lng):bat[:date] MTIMEstr_to_date_bulk_p2; (empty) batmtime str_to_date -pattern batmtime.str_to_date(X_0:bat[:str], X_1:str, X_2:lng):bat[:date] +pattern batmtime.str_to_date(X_0:bat[:str], X_1:str, X_2:lng, X_3:bat[:oid]):bat[:date] MTIMEstr_to_date_bulk_p2; (empty) batmtime @@ -32330,22 +32250,22 @@ MTIMEstr_to_time_bulk; (empty) batmtime str_to_time -pattern batmtime.str_to_time(X_0:str, X_1:bat[:str], X_2:bat[:oid], X_3:lng):bat[:daytime] -MTIMEstr_to_time_bulk_p1; -(empty) -batmtime -str_to_time pattern batmtime.str_