Changeset: 273b2ca25abd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/273b2ca25abd
Modified Files:
        monetdb5/modules/mal/txtsim.c
        sql/test/BugTracker-2024/Tests/All
Branch: Aug2024
Log Message:

Merge with Dec2023 branch.


diffs (66 lines):

diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -203,8 +203,10 @@ levenshtein(int *res, const char *x, con
        xlen = UTF8_strlen(x);
        ylen = UTF8_strlen(y);
 
-       if (xlen == ylen && (strcmp(x, y) == 0))
+       if (xlen == ylen && (strcmp(x, y) == 0)) {
+               *res = 0;
                return MAL_SUCCEED;
+       }
 
        column = GDKmalloc((xlen + 1) * sizeof(unsigned int));
        if (column == NULL)
diff --git a/sql/test/BugTracker-2024/Tests/7541-levenshtein.test 
b/sql/test/BugTracker-2024/Tests/7541-levenshtein.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7541-levenshtein.test
@@ -0,0 +1,38 @@
+statement ok
+CREATE TABLE t0 (c0 BOOLEAN)
+
+statement ok
+CREATE TABLE t1 (c1 INT)
+
+statement ok
+INSERT INTO t1(c1) VALUES (1)
+
+statement ok
+INSERT INTO t0(c0) VALUES (false)
+
+statement ok
+INSERT INTO t0(c0) VALUES (true)
+
+query II rowsort
+SELECT * FROM t1 LEFT  JOIN t0 ON LEVENSHTEIN(t0.c0, true)
+----
+1
+0
+
+query II rowsort
+SELECT * FROM t1 LEFT  JOIN t0 ON LEVENSHTEIN(t0.c0, true) WHERE t0.c0 UNION 
ALL SELECT * FROM t1 LEFT  JOIN t0 ON LEVENSHTEIN(t0.c0, true) WHERE (NOT 
t0.c0) UNION ALL SELECT * FROM t1 LEFT  JOIN t0 ON LEVENSHTEIN(t0.c0, true) 
WHERE ((t0.c0) IS NULL)
+----
+1
+0
+
+query I rowsort
+SELECT LEVENSHTEIN(true, true)
+----
+0
+
+query I rowsort
+SELECT LEVENSHTEIN(t0.c0, true) FROM t0
+----
+0
+4
+
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -67,3 +67,4 @@ 7538-reduce-cast
 7539-is-distinct-from
 7537-prepare_stmt_with_dropped_table
 7536-mclient-forgets-to-flush
+7541-levenshtein
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to