Changeset: 5298a90796b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5298a90796b2
Added Files:
sql/test/BugTracker-2026/Tests/8048-group-filter-function-match.test
Modified Files:
sql/server/rel_psm.c
sql/server/sql_semantic.c
sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:
fixed create or replace and droping of group filter functions
diffs (166 lines):
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -1141,14 +1141,15 @@ resolve_func(mvc *sql, const char *sname
sql_subfunc *sub_func;
type_list = create_type_list(sql, typelist, 0);
- sub_func = sql_bind_func_(sql, sname, name, type_list, type,
false, true);
+ sql_ftype ftype = type == F_GROUPFILT ? F_FILT : type;
+ sub_func = sql_bind_func_(sql, sname, name, type_list, ftype,
false, true);
if (!sub_func && type == F_FUNC) {
sql->session->status = 0; /* if the function was not
found clean the error */
sql->errstr[0] = '\0';
sub_func = sql_bind_func_(sql, sname, name, type_list,
F_UNION, false, true);
- type = sub_func?F_UNION:F_FUNC;
+ ftype = type = sub_func?F_UNION:F_FUNC;
}
- if ( sub_func && sub_func->func->type == type)
+ if ( sub_func && sub_func->func->type == ftype && (ftype !=
F_FILT || (type != F_GROUPFILT || sub_func->func->group)))
func = sub_func->func;
} else {
list_func = sql_find_funcs_by_name(sql, sname, name, type,
false);
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -402,7 +402,7 @@ sql_find_func_internal(mvc *sql, list *f
int key = hash_key(fname);
sql_subfunc *res = NULL;
int found = 0;
- sql_ftype filt = (type == F_FUNC)?F_FILT:type;
+ sql_ftype filt = (type == F_FUNC || type == F_GROUPFILT)?F_FILT:type;
if (ff) {
if (ff->ht) {
@@ -444,7 +444,7 @@ static sql_subfunc *
os_find_func_internal(mvc *sql, struct objectset *ff, const char *fname, int
nrargs, sql_ftype type, bool private, sql_subfunc *prev)
{
sql_subfunc *res = NULL;
- sql_ftype filt = (type == F_FUNC)?F_FILT:type;
+ sql_ftype filt = (type == F_FUNC || type == F_GROUPFILT)?F_FILT:type;
if (ff) {
struct os_iter oi;
@@ -655,7 +655,7 @@ score_func( sql_func *f, list *tl, bool
static sql_subfunc *
sql_bind_func__(mvc *sql, list *ff, const char *fname, list *ops, sql_ftype
type, bool private, bool exact)
{
- sql_ftype filt = (type == F_FUNC)?F_FILT:type;
+ sql_ftype filt = (type == F_FUNC || type == F_GROUPFILT)?F_FILT:type;
sql_subtype *input_type = NULL;
sql_func *cand = NULL, *dcand = NULL;
int points = 0, dpoints = 0;
@@ -735,7 +735,7 @@ sql_bind_func__(mvc *sql, list *ff, cons
static sql_subfunc *
os_bind_func__(mvc *sql, struct objectset *ff, const char *fname, list *ops,
sql_ftype type, bool private, bool exact)
{
- sql_ftype filt = (type == F_FUNC)?F_FILT:type;
+ sql_ftype filt = (type == F_FUNC || type == F_GROUPFILT)?F_FILT:type;
sql_subtype *input_type = NULL;
sql_func *cand = NULL, *dcand = NULL;
int points = 0, dpoints = 0;
@@ -920,14 +920,15 @@ sql_find_funcs_by_name_internal(mvc *sql
int key = hash_key(fname);
list *res = NULL;
+ sql_ftype ftype = type == F_GROUPFILT ? F_FILT : type;
if (ff) {
if (ff->ht) {
for (sql_hash_e *he =
ff->ht->buckets[key&(ff->ht->size-1)]; he; he = he->chain) {
sql_func *f = he->value;
- if (f->type != type || (f->private && !private))
+ if (f->type != ftype || (f->private &&
!private))
continue;
- if (strcmp(f->base.name, fname) == 0) {
+ if (strcmp(f->base.name, fname) == 0 && (type
!= F_GROUPFILT || f->group)) {
if (!res)
res = sa_list(sql->sa);
list_append(res, f);
@@ -938,9 +939,9 @@ sql_find_funcs_by_name_internal(mvc *sql
sql_base_loop( ff, n) {
sql_func *f = n->data;
- if (f->type != type || (f->private && !private))
+ if (f->type != ftype || (f->private &&
!private))
continue;
- if (strcmp(f->base.name, fname) == 0) {
+ if (strcmp(f->base.name, fname) == 0 && (type
!= F_GROUPFILT || f->group)) {
if (!res)
res = sa_list(sql->sa);
list_append(res, f);
@@ -956,15 +957,16 @@ os_find_funcs_by_name_internal(mvc *sql,
{
list *res = NULL;
+ sql_ftype ftype = type == F_GROUPFILT ? F_FILT : type;
if (ff) {
struct os_iter oi;
os_iterator(&oi, ff, sql->session->tr, fname);
for (sql_base *b = oi_next(&oi); b; b=oi_next(&oi)) {
sql_func *f = (sql_func*)b;
- if (f->type != type || (f->private && !private))
+ if (f->type != ftype || (f->private && !private))
continue;
- if (strcmp(f->base.name, fname) == 0) {
+ if (strcmp(f->base.name, fname) == 0 && (type !=
F_GROUPFILT || f->group)) {
if (!res)
res = sa_list(sql->sa);
list_append(res, f);
diff --git
a/sql/test/BugTracker-2026/Tests/8048-group-filter-function-match.test
b/sql/test/BugTracker-2026/Tests/8048-group-filter-function-match.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8048-group-filter-function-match.test
@@ -0,0 +1,31 @@
+
+statement ok
+CREATE OR REPLACE GROUP FILTER FUNCTION gf8048(a1 INTEGER, a2 INTEGER, a3
INTEGER, a4 INTEGER, a5 DOUBLE) EXTERNAL NAME txtsim.maxlevenshtein
+
+statement ok
+CREATE OR REPLACE GROUP FILTER FUNCTION gf8048(a1 INTEGER, a2 INTEGER, a3
INTEGER, a4 INTEGER, a5 DOUBLE) EXTERNAL NAME txtsim.maxlevenshtein
+
+query I nosort
+SELECT COUNT(*) FROM sys.functions WHERE name = 'gf8048' AND type = 8
+----
+1
+
+statement ok
+DROP GROUP FILTER FUNCTION gf8048(INTEGER, INTEGER, INTEGER, INTEGER, DOUBLE)
+
+query I nosort
+SELECT COUNT(*) FROM sys.functions WHERE name = 'gf8048'
+----
+0
+
+-- also exercise lookup by name without a signature
+statement ok
+CREATE OR REPLACE GROUP FILTER FUNCTION gf8048(a1 INTEGER, a2 INTEGER, a3
INTEGER, a4 INTEGER, a5 DOUBLE) EXTERNAL NAME txtsim.maxlevenshtein
+
+statement ok
+DROP GROUP FILTER FUNCTION gf8048
+
+query I nosort
+SELECT COUNT(*) FROM sys.functions WHERE name = 'gf8048'
+----
+0
diff --git a/sql/test/BugTracker-2026/Tests/All
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -196,7 +196,7 @@ KNOWNFAIL?8009-numeric-range-nulls-last-
KNOWNFAIL?8010-first_value-last_value-partition-range-bug
8013-triple-same-predicate-bug
8014-rel_bin-exp_bin-assert-failure
-KNOWNFAIL?8015-join-subquery-NULL-bug
+8015-join-subquery-NULL-bug
KNOWNFAIL?8017-create-where-exists-select-acos-bug
8018-rel2bin_select-assert-failure
8019-rel_bin-exp_bin-assert-failure
@@ -215,6 +215,7 @@ KNOWNFAIL?8030-inner-join-group-by-bug
8037-alter-table-decimal
8031-simplify-count-too-simple
8046-simplify-fk-join-bug
+8048-group-filter-function-match
8054-correlated-not-notequal
8056-date-generator
8059-aggr-on-pipeline-local-string-col-causes-nulls
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]