Changeset: e305add05c0f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e305add05c0f
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        monetdb5/modules/mal/pcre.c
        sql/backends/monet5/rel_bin.c
        sql/test/BugTracker-2020/Tests/values-like-join.Bug-6954.stable.out
        sql/test/SQLancer/Tests/sqlancer04.sql
        sql/test/SQLancer/Tests/sqlancer04.stable.out
        sql/test/miscellaneous/Tests/simple_plans.stable.out
Branch: Oct2020
Log Message:

Make sure inputs for filter joins are columns (alike other joins). This 
requires the 'escape' parameter at pcre join to be a column


diffs (truncated from 351 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -621,8 +621,8 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "ilike",        "command algebra.ilike(X_1:str, X_2:str, 
X_3:str):bit ",        "PCREilike3;",  ""      ]
 [ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, 
X_7:bit):bat[:oid] ",  "ILIKEjoin1;",  ""      ]
 [ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",     "ILIKEjoin;",   ""      ]
-[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ", "ILIKEjoin_esc1;",      ""      ]
-[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    "ILIKEjoin_esc;",       ""      ]
+[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",   "ILIKEjoin_esc1;",      ""      ]
+[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:str], X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",      "ILIKEjoin_esc;",       ""      
]
 [ "algebra",   "ilikeselect",  "command algebra.ilikeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ",      "PCRElikeselect1;", 
    ""      ]
 [ "algebra",   "ilikeselect",  "command algebra.ilikeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ",       "PCRElikeselect4;",     ""  
    ]
 [ "algebra",   "intersect",    "command algebra.intersect(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:bit, 
X_7:lng):bat[:oid] ",      "ALGintersect;",        ""      ]
@@ -634,8 +634,8 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "like", "command algebra.like(X_1:str, X_2:str, X_3:str):bit ", 
"PCRElike3;",   ""      ]
 [ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, 
X_7:bit):bat[:oid] ",   "LIKEjoin1;",   ""      ]
 [ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",      "LIKEjoin;",    ""      ]
-[ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",  "LIKEjoin_esc1;",       ""      ]
-[ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",     "LIKEjoin_esc;",        ""      ]
+[ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",    "LIKEjoin_esc1;",       ""      ]
+[ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:str], X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",       "LIKEjoin_esc;",        ""     
 ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit, X_6:bit):bat[:oid] ",      
"PCRElikeselect2;",     ""      ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ",       
"PCRElikeselect3;",     ""      ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ",        "PCRElikeselect5;",     "" 
     ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -734,8 +734,8 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "ilike",        "command algebra.ilike(X_1:str, X_2:str, 
X_3:str):bit ",        "PCREilike3;",  ""      ]
 [ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, 
X_7:bit):bat[:oid] ",  "ILIKEjoin1;",  ""      ]
 [ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",     "ILIKEjoin;",   ""      ]
-[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ", "ILIKEjoin_esc1;",      ""      ]
-[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    "ILIKEjoin_esc;",       ""      ]
+[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",   "ILIKEjoin_esc1;",      ""      ]
+[ "algebra",   "ilikejoin",    "command algebra.ilikejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:str], X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",      "ILIKEjoin_esc;",       ""      
]
 [ "algebra",   "ilikeselect",  "command algebra.ilikeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ",      "PCRElikeselect1;", 
    ""      ]
 [ "algebra",   "ilikeselect",  "command algebra.ilikeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ",       "PCRElikeselect4;",     ""  
    ]
 [ "algebra",   "intersect",    "command algebra.intersect(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:bit, 
X_7:lng):bat[:oid] ",      "ALGintersect;",        ""      ]
@@ -747,8 +747,8 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "like", "command algebra.like(X_1:str, X_2:str, X_3:str):bit ", 
"PCRElike3;",   ""      ]
 [ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, 
X_7:bit):bat[:oid] ",   "LIKEjoin1;",   ""      ]
 [ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",      "LIKEjoin;",    ""      ]
-[ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",  "LIKEjoin_esc1;",       ""      ]
-[ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",     "LIKEjoin_esc;",        ""      ]
+[ "algebra",   "likejoin",     "command algebra.likejoin(X_1:bat[:str], 
X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, 
X_8:bit):bat[:oid] ",    "LIKEjoin_esc1;",       ""      ]
+[ "algebra",   "likejoin",     "command algebra.likejoin(X_2:bat[:str], 
X_3:bat[:str], X_4:bat[:str], X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, 
X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",       "LIKEjoin_esc;",        ""     
 ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit, X_6:bit):bat[:oid] ",      
"PCRElikeselect2;",     ""      ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ",       
"PCRElikeselect3;",     ""      ]
 [ "algebra",   "likeselect",   "command algebra.likeselect(X_1:bat[:str], 
X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ",        "PCRElikeselect5;",     "" 
     ]
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -2334,16 +2334,18 @@ bailout:
 }
 
 static str
-PCREjoin(bat *r1, bat *r2, bat lid, bat rid, bat slid, bat srid, const char 
*esc, bool caseignore, bool anti)
+PCREjoin(bat *r1, bat *r2, bat lid, bat rid, bat slid, bat srid, bat elid, 
bool caseignore, bool anti)
 {
-       BAT *left = NULL, *right = NULL, *candleft = NULL, *candright = NULL;
+       BAT *left = NULL, *right = NULL, *escape = NULL, *candleft = NULL, 
*candright = NULL;
        BAT *result1 = NULL, *result2 = NULL;
-       char *msg = MAL_SUCCEED;
+       char *msg = MAL_SUCCEED, *esc = "";
 
        if ((left = BATdescriptor(lid)) == NULL)
                goto fail;
        if ((right = BATdescriptor(rid)) == NULL)
                goto fail;
+       if (!is_bat_nil(elid) && (escape = BATdescriptor(elid)) == NULL)
+               goto fail;
        if (!is_bat_nil(slid) && (candleft = BATdescriptor(slid)) == NULL)
                goto fail;
        if (!is_bat_nil(srid) && (candright = BATdescriptor(srid)) == NULL)
@@ -2369,6 +2371,13 @@ PCREjoin(bat *r1, bat *r2, bat lid, bat 
                result2->trevsorted = true;
                result2->tseqbase = 0;
        }
+       if (escape) {
+               if (BATcount(escape) != 1) {
+                       msg = createException(MAL, "pcre.join", SQLSTATE(42000) 
"At the moment, only one value is allowed for the escape input at pcre join");
+                       goto fail;
+               }
+               esc = BUNtvar(bat_iterator(escape), 0);
+       }
        msg = pcrejoin(result1, result2, left, right, candleft, candright, esc, 
caseignore, anti);
        if (msg)
                goto fail;
@@ -2380,6 +2389,8 @@ PCREjoin(bat *r1, bat *r2, bat lid, bat 
        }
        BBPunfix(left->batCacheid);
        BBPunfix(right->batCacheid);
+       if (escape)
+               BBPunfix(escape->batCacheid);
        if (candleft)
                BBPunfix(candleft->batCacheid);
        if (candright)
@@ -2391,6 +2402,8 @@ PCREjoin(bat *r1, bat *r2, bat lid, bat 
                BBPunfix(left->batCacheid);
        if (right)
                BBPunfix(right->batCacheid);
+       if (escape)
+               BBPunfix(escape->batCacheid);
        if (candleft)
                BBPunfix(candleft->batCacheid);
        if (candright)
@@ -2405,19 +2418,19 @@ PCREjoin(bat *r1, bat *r2, bat lid, bat 
 }
 
 static str
-LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, 
const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, 
const bit *anti)
+LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat 
*elid, const bat *slid, const bat *srid, const bit *nil_matches, const lng 
*estimate, const bit *anti)
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
*esc, 0, *anti);
+       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
elid ? *elid : 0, 0, *anti);
 }
 
 static str
-LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const 
bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const 
bit *anti)
+LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const bat *elid, const 
bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const 
bit *anti)
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, *esc, 0, *anti);
+       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, elid ? *elid : 0, 0, *anti);
 }
 
 static str
@@ -2425,7 +2438,7 @@ LIKEjoin(bat *r1, bat *r2, const bat *li
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
"", 0, *anti);
+       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
0, 0, *anti);
 }
 
 static str
@@ -2433,23 +2446,23 @@ LIKEjoin1(bat *r1, const bat *lid, const
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, "", 0, *anti);
+       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, 0, 0, *anti);
 }
 
 static str
-ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str 
*esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng 
*estimate, const bit *anti)
+ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat 
*elid, const bat *slid, const bat *srid, const bit *nil_matches, const lng 
*estimate, const bit *anti)
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
*esc, 1, *anti);
+       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
elid ? *elid : 0, 1, *anti);
 }
 
 static str
-ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const 
bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const 
bit *anti)
+ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const bat *elid, const 
bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const 
bit *anti)
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, *esc, 1, *anti);
+       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, elid ? *elid : 0, 1, *anti);
 }
 
 static str
@@ -2457,7 +2470,7 @@ ILIKEjoin(bat *r1, bat *r2, const bat *l
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
"", 1, *anti);
+       return PCREjoin(r1, r2, *lid, *rid, slid ? *slid : 0, srid ? *srid : 0, 
0, 1, *anti);
 }
 
 static str
@@ -2465,7 +2478,7 @@ ILIKEjoin1(bat *r1, const bat *lid, cons
 {
        (void) nil_matches;
        (void) estimate;
-       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, "", 1, *anti);
+       return PCREjoin(r1, NULL, *lid, *rid, slid ? *slid : 0, srid ? *srid : 
0, 0, 1, *anti);
 }
 
 #include "mel.h"
@@ -2522,10 +2535,10 @@ mel_func pcre_init_funcs[] = {
  command("algebra", "ilikeselect", PCRElikeselect1, false, "", args(1,6, 
batarg("",oid),batarg("b",str),batarg("cand",oid),arg("pat",str),arg("esc",str),arg("anti",bit))),
  command("algebra", "likeselect", PCRElikeselect5, false, "", args(1,5, 
batarg("",oid),batarg("b",str),batarg("cand",oid),arg("pat",str),arg("anti",bit))),
  command("algebra", "ilikeselect", PCRElikeselect4, false, "", args(1,5, 
batarg("",oid),batarg("b",str),batarg("cand",oid),arg("pat",str),arg("anti",bit))),
- command("algebra", "likejoin", LIKEjoin_esc, false, "Join the string bat L 
with the pattern bat R\nwith optional candidate lists SL and SR using pattern 
escape string ESC\nand doing a case sensitive match.\nThe result is two aligned 
bats with oids of matching rows.", args(2,10, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),arg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
- command("algebra", "likejoin", LIKEjoin_esc1, false, "The same as 
LIKEjoin_esc, but only produce one output", 
args(1,9,batarg("",oid),batarg("l",str),batarg("r",str),arg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),
 arg("anti",bit))),
- command("algebra", "ilikejoin", ILIKEjoin_esc, false, "Join the string bat L 
with the pattern bat R\nwith optional candidate lists SL and SR using pattern 
escape string ESC\nand doing a case insensitive match.\nThe result is two 
aligned bats with oids of matching rows.", args(2,10, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),arg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
- command("algebra", "ilikejoin", ILIKEjoin_esc1, false, "The same as 
ILIKEjoin_esc, but only produce one output", args(1,9, 
batarg("",oid),batarg("l",str),batarg("r",str),arg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
+ command("algebra", "likejoin", LIKEjoin_esc, false, "Join the string bat L 
with the pattern bat R\nwith optional candidate lists SL and SR using pattern 
escape string ESC\nand doing a case sensitive match.\nThe result is two aligned 
bats with oids of matching rows.", args(2,10, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),batarg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
+ command("algebra", "likejoin", LIKEjoin_esc1, false, "The same as 
LIKEjoin_esc, but only produce one output", 
args(1,9,batarg("",oid),batarg("l",str),batarg("r",str),batarg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),
 arg("anti",bit))),
+ command("algebra", "ilikejoin", ILIKEjoin_esc, false, "Join the string bat L 
with the pattern bat R\nwith optional candidate lists SL and SR using pattern 
escape string ESC\nand doing a case insensitive match.\nThe result is two 
aligned bats with oids of matching rows.", args(2,10, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),batarg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
+ command("algebra", "ilikejoin", ILIKEjoin_esc1, false, "The same as 
ILIKEjoin_esc, but only produce one output", args(1,9, 
batarg("",oid),batarg("l",str),batarg("r",str),batarg("esc",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
  command("algebra", "likejoin", LIKEjoin, false, "", args(2,9, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
  command("algebra", "likejoin", LIKEjoin1, false, "", args(1,8, 
batarg("",oid),batarg("l",str),batarg("r",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
  command("algebra", "ilikejoin", ILIKEjoin, false, "", args(2,9, 
batarg("",oid),batarg("",oid),batarg("l",str),batarg("r",str),batarg("sl",oid),batarg("sr",oid),arg("nil_matches",bit),arg("estimate",lng),arg("anti",bit))),
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
@@ -1213,6 +1213,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
                        if (left && right && (exps_card(e->r) != CARD_ATOM || 
!exps_are_atoms(e->r))) {
                                sql_subfunc *f = e->f;
+                               for (node *n = l->op4.lval->h ; n ; n = n->next)
+                                       n->data = column(be, n->data);
+                               for (node *n = r->op4.lval->h ; n ; n = n->next)
+                                       n->data = column(be, n->data);
                                return stmt_genjoin(be, l, r, f, is_anti(e), 
swapped);
                        }
                        assert(!swapped);
diff --git 
a/sql/test/BugTracker-2020/Tests/values-like-join.Bug-6954.stable.out 
b/sql/test/BugTracker-2020/Tests/values-like-join.Bug-6954.stable.out
--- a/sql/test/BugTracker-2020/Tests/values-like-join.Bug-6954.stable.out
+++ b/sql/test/BugTracker-2020/Tests/values-like-join.Bug-6954.stable.out
@@ -22,20 +22,21 @@ project (
 % clob # type
 % 200 # length
 function user.main():void;
-    X_1:void := querylog.define("explain select 1 from (values (\\'one\\'), 
(\\'two\\')) as l(s), (values (\\'three\\'), (\\'four\\')) as r(s) where l.s 
like r.s;":str, "sequential_pipe":str, 23:int);
-    X_33:bat[:str] := bat.pack(".%7":str);
-    X_34:bat[:str] := bat.pack("%7":str);
-    X_35:bat[:str] := bat.pack("tinyint":str);
-    X_36:bat[:int] := bat.pack(1:int);
-    X_37:bat[:int] := bat.pack(0:int);
+    X_1:void := querylog.define("explain select 1 from (values (\\'one\\'), 
(\\'two\\')) as l(s), (values (\\'three\\'), (\\'four\\')) as r(s) where l.s 
like r.s;":str, "sequential_pipe":str, 24:int);
+    X_34:bat[:str] := bat.pack(".%7":str);
+    X_35:bat[:str] := bat.pack("%7":str);
+    X_36:bat[:str] := bat.pack("tinyint":str);
+    X_37:bat[:int] := bat.pack(1:int);
+    X_38:bat[:int] := bat.pack(0:int);
     X_9:bat[:str] := bat.new(nil:str);
     X_11:bat[:str] := bat.appendBulk(X_9:bat[:str], true:bit, "one":str, 
"two":str);
     X_17:bat[:str] := bat.new(nil:str);
     X_18:bat[:str] := bat.appendBulk(X_17:bat[:str], true:bit, "three":str, 
"four":str);
-    X_21:bat[:oid] := algebra.likejoin(X_11:bat[:str], X_18:bat[:str], "":str, 
nil:BAT, nil:BAT, true:bit, nil:lng, false:bit);
-    X_27:bat[:str] := algebra.projection(X_21:bat[:oid], X_11:bat[:str]);
-    X_31:bat[:bte] := algebra.project(X_27:bat[:str], 1:bte);
-    sql.resultSet(X_33:bat[:str], X_34:bat[:str], X_35:bat[:str], 
X_36:bat[:int], X_37:bat[:int], X_31:bat[:bte]);
+    X_21:bat[:str] := bat.single("":str);
+    X_22:bat[:oid] := algebra.likejoin(X_11:bat[:str], X_18:bat[:str], 
X_21:bat[:str], nil:BAT, nil:BAT, true:bit, nil:lng, false:bit);
+    X_28:bat[:str] := algebra.projection(X_22:bat[:oid], X_11:bat[:str]);
+    X_32:bat[:bte] := algebra.project(X_28:bat[:str], 1:bte);
+    sql.resultSet(X_34:bat[:str], X_35:bat[:str], X_36:bat[:str], 
X_37:bat[:int], X_38:bat[:int], X_32:bat[:bte]);
 end user.main;
 #inline               actions= 0 time=1 usec 
 #remap                actions= 0 time=1 usec 
diff --git a/sql/test/SQLancer/Tests/sqlancer04.sql 
b/sql/test/SQLancer/Tests/sqlancer04.sql
--- a/sql/test/SQLancer/Tests/sqlancer04.sql
+++ b/sql/test/SQLancer/Tests/sqlancer04.sql
@@ -358,7 +358,7 @@ create view v3(vc0, vc1) as (select dist
 with check option;
 
 create view v7(vc0, vc1, vc2) as (values (1307331776, 
((0.8065742163429374)||(0.1829829)),
-((floor(23898.0))-(cast(16268 as double)))), (least(cast(r'' as bigint), 
ifthenelse(true, 7769,
+((floor(23898.0))-(cast(16268 as double)))), (least(cast(r'1' as bigint), 
ifthenelse(true, 7769,
 0.52628413232100446084160694226738996803760528564453125)), 2092106435, case 
when ((((((((r'TRUE')or(true)))and(false)))
 or(false)))and(false)) then pi() when false then sql_max(10246889, 
0.038412724) else cast(1556011470 as bigint) end))
 with check option;
@@ -377,6 +377,8 @@ create view v43(vc0, vc1) as (select dis
 0.94514286975825123615635448004468344151973724365234375 then 0.8788786 end as 
bigint), null
 where ((-1975284152)<=(17772))) with check option;
 
+SELECT 1 FROM v7, v43 WHERE v7.vc1 ILIKE v43.vc1;
+
 SELECT median(ALL least(+ 
(0.26910993823565487748084024133277125656604766845703125),
 ((0.5744001734384440727154697015066631138324737548828125)&(-1283341470)))), 
CASE WHEN NOT (FALSE) THEN
 least(-650735786, -1123683253) ELSE 1414135574 END FROM v7, v38, v43 RIGHT 
OUTER JOIN 
diff --git a/sql/test/SQLancer/Tests/sqlancer04.stable.out 
b/sql/test/SQLancer/Tests/sqlancer04.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer04.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer04.stable.out
@@ -454,6 +454,40 @@ stdout of test 'sqlancer04` in directory
 % 1 # length
 [ 8    ]
 #ROLLBACK;
+#START TRANSACTION;
+#create view v3(vc0, vc1) as (select distinct r'', cast(cast(-1197336362 as 
int) as decimal) where greatest(false, true))
+#with check option;
+#create view v7(vc0, vc1, vc2) as (values (1307331776, 
((0.8065742163429374)||(0.1829829)),
+#((floor(23898.0))-(cast(16268 as double)))), (least(cast(r'1' as bigint), 
ifthenelse(true, 7769,
+#0.52628413232100446084160694226738996803760528564453125)), 2092106435, case 
when ((((((((r'TRUE')or(true)))and(false)))
+#or(false)))and(false)) then pi() when false then sql_max(10246889, 
0.038412724) else cast(1556011470 as bigint) end))
+#with check option;
+#create view v28(vc0, vc1, vc2) as (values (-595506138, 
((nullif(-1.09922038E8, 24510))*(coalesce(-1802237644,
+#0.7125421032644879, 662707145))), "week"(greatest(timestamp '1970-01-11 
12:58:57', timestamp '1969-12-24 00:21:39'))))
+#with check option;
+#create view v32(vc0, vc1) as (values (cast(-330282362 as bigint), 
((((674023637)||(-1856487129)))<=(case -1983844154
+#when 122 then 11 when 1381635703 then -367942232 when -1208650057 then 
713851705 else 0.40289348 end))),
+#(sql_max(((10)>>(18833)), - (-1088048958)), (not (true)) = true));
+#create view v38(vc0) as (select all cast(cast(11149 as bigint) as real) where 
"isauuid"(r'0.962687263902831'));
+#create view v43(vc0, vc1) as (select distinct cast(case 
0.635420284843984273237538218381814658641815185546875 when
+#0.94514286975825123615635448004468344151973724365234375 then 0.8788786 end as 
bigint), null
+#where ((-1975284152)<=(17772))) with check option;
+#SELECT 1 FROM v7, v43 WHERE v7.vc1 ILIKE v43.vc1;
+% .%15 # table_name
+% %15 # name
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to