Changeset: f9728448501c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f9728448501c
Branch: persistent_sketches
Log Message:
Merge with default branch.
diffs (truncated from 499 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
@@ -712,6 +712,7 @@ algebra likeselect command algebra.likes
algebra markjoin command algebra.markjoin(X_0:bat[:any_1],
X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng)
(X_6:bat[:oid], X_7:bat[:bit]) ALGmark2join Mark join with candidate
lists
algebra markjoin command algebra.markjoin(X_0:bat[:any_1],
X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng)
(X_6:bat[:oid], X_7:bat[:oid], X_8:bat[:bit]) ALGmark3join Mark join
with candidate lists
algebra markselect command algebra.markselect(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit])
ALGmarkselect Group on group-ids, return aggregated anyequal or allnotequal
+algebra markselect command algebra.markselect(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:bit])
ALGmarkselect2 Return (gid, mark&&pred). If 'aggr', group on gid, return
aggregated (gid, mark&&pred). If 'outer', return a row for each (grouped) gid;
otherwise, return only the rows where mark&&pred != FALSE.
algebra not_like command algebra.not_like(X_0:str, X_1:str,
X_2:str, X_3:bit):bit PCREnotlike (empty)
algebra orderidx command algebra.orderidx(X_0:bat[:any_1],
X_1:bit):bat[:any_1] OIDXorderidx Create an order index
algebra outercrossproduct command
algebra.outercrossproduct(X_0:bat[:any_1], X_1:bat[:any_2], X_2:bat[:oid],
X_3:bat[:oid], X_4:bit) (X_5:bat[:oid], X_6:bat[:oid])
ALGoutercrossproduct3 Compute the outer cross product of both input bats
@@ -729,7 +730,6 @@ algebra select command algebra.select(X_
algebra select command algebra.select(X_0:bat[:any_1], X_1:any_1,
X_2:any_1, X_3:bit, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect1nil
With unknown set, each nil != nil
algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid],
X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect2
Select all head values of the first input BAT for which the tail value is in
range and for which the head value occurs in the tail of the second input BAT.
The first input is a dense-headed BAT, the second input is a dense-headed BAT
with sorted tail, output is a dense-headed BAT with in the tail the head value
of the input BAT for which the tail value is between the values low and high
(inclusive if li respectively hi is set). The output BAT is sorted on the tail
value. If low or high is nil, the boundary is not considered (effectively -
and + infinity). If anti is set, the result is the complement. Nil values in
the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All
non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or
anti=1. Note that the output is suitable as second input for this functi
on.
algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid],
X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit):bat[:oid]
ALGselect2nil With unknown set, each nil != nil
-algebra selectNotFalse command algebra.selectNotFalse(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit])
ALGselectNotFalse Return (gid, mark&&pred), if mark&&pred != FALSE. If
'aggr', group on gid, return aggregated (gid, mark&&pred)
algebra selectNotNil command
algebra.selectNotNil(X_0:bat[:any_1]):bat[:any_1] ALGselectNotNil Select
all not-nil values
algebra semijoin command algebra.semijoin(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)
(X_7:bat[:oid], X_8:bat[:oid]) ALGsemijoin Semi join with candidate
lists
algebra single command algebra.single(X_0:bat[:oid],
X_1:bat[:oid]):bat[:oid] ALGsingle Check for single result ids.
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
@@ -599,6 +599,7 @@ algebra likeselect command algebra.likes
algebra markjoin command algebra.markjoin(X_0:bat[:any_1],
X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng)
(X_6:bat[:oid], X_7:bat[:bit]) ALGmark2join Mark join with candidate
lists
algebra markjoin command algebra.markjoin(X_0:bat[:any_1],
X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng)
(X_6:bat[:oid], X_7:bat[:oid], X_8:bat[:bit]) ALGmark3join Mark join
with candidate lists
algebra markselect command algebra.markselect(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit])
ALGmarkselect Group on group-ids, return aggregated anyequal or allnotequal
+algebra markselect command algebra.markselect(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:bit])
ALGmarkselect2 Return (gid, mark&&pred). If 'aggr', group on gid, return
aggregated (gid, mark&&pred). If 'outer', return a row for each (grouped) gid;
otherwise, return only the rows where mark&&pred != FALSE.
algebra not_like command algebra.not_like(X_0:str, X_1:str,
X_2:str, X_3:bit):bit PCREnotlike (empty)
algebra orderidx command algebra.orderidx(X_0:bat[:any_1],
X_1:bit):bat[:any_1] OIDXorderidx Create an order index
algebra outercrossproduct command
algebra.outercrossproduct(X_0:bat[:any_1], X_1:bat[:any_2], X_2:bat[:oid],
X_3:bat[:oid], X_4:bit) (X_5:bat[:oid], X_6:bat[:oid])
ALGoutercrossproduct3 Compute the outer cross product of both input bats
@@ -616,7 +617,6 @@ algebra select command algebra.select(X_
algebra select command algebra.select(X_0:bat[:any_1], X_1:any_1,
X_2:any_1, X_3:bit, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect1nil
With unknown set, each nil != nil
algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid],
X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect2
Select all head values of the first input BAT for which the tail value is in
range and for which the head value occurs in the tail of the second input BAT.
The first input is a dense-headed BAT, the second input is a dense-headed BAT
with sorted tail, output is a dense-headed BAT with in the tail the head value
of the input BAT for which the tail value is between the values low and high
(inclusive if li respectively hi is set). The output BAT is sorted on the tail
value. If low or high is nil, the boundary is not considered (effectively -
and + infinity). If anti is set, the result is the complement. Nil values in
the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All
non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or
anti=1. Note that the output is suitable as second input for this functi
on.
algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid],
X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit):bat[:oid]
ALGselect2nil With unknown set, each nil != nil
-algebra selectNotFalse command algebra.selectNotFalse(X_0:bat[:oid],
X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit])
ALGselectNotFalse Return (gid, mark&&pred), if mark&&pred != FALSE. If
'aggr', group on gid, return aggregated (gid, mark&&pred)
algebra selectNotNil command
algebra.selectNotNil(X_0:bat[:any_1]):bat[:any_1] ALGselectNotNil Select
all not-nil values
algebra semijoin command algebra.semijoin(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)
(X_7:bat[:oid], X_8:bat[:oid]) ALGsemijoin Semi join with candidate
lists
algebra single command algebra.single(X_0:bat[:oid],
X_1:bat[:oid]):bat[:oid] ALGsingle Check for single result ids.
diff --git a/monetdb5/modules/kernel/algebra.c
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -478,7 +478,7 @@ ALGmarkselect(Client ctx, bat *r1, bat *
}
static str
-ALGselectNotFalse(Client ctx, bat *r1, bat *r2, const bat *gid, const bat
*mark, const bat *pred, const bit *Aggr)
+ALGmarkselect2(Client ctx, bat *r1, bat *r2, const bat *gid, const bat *mark,
const bat *pred, const bit *Aggr, const bit *Outer)
{
(void) ctx;
BAT *g = BATdescriptor(*gid); /* oid */
@@ -486,6 +486,7 @@ ALGselectNotFalse(Client ctx, bat *r1, b
BAT *p = BATdescriptor(*pred); /* bit */
BAT *res1 = NULL, *res2 = NULL;
bit aggr = *Aggr;
+ bit outer = *Outer;
if (!g || !m || !p)
goto error;
@@ -506,7 +507,7 @@ ALGselectNotFalse(Client ctx, bat *r1, b
for (BUN n = 0; n < nr; n++, c++) {
ri1[q] = c;
ri2[q] = (mi[n] == FALSE || pi[n] ==
FALSE)?FALSE:(mi[n] == bit_nil || pi[n] == bit_nil)?bit_nil:TRUE;
- q += (ri2[q] != FALSE); /* filter out the rows
that are surely FALSE */
+ q += ((ri2[q] != FALSE) /* filter out the rows
that are surely FALSE for !outer */ || outer);
}
} else { /* the aggregated variant */
oid *gi = Tloc(g, 0);
@@ -514,7 +515,7 @@ ALGselectNotFalse(Client ctx, bat *r1, b
bit m = (mi[0] == FALSE || pi[0] == FALSE)?FALSE:(mi[0]
== bit_nil || pi[0] == bit_nil)?bit_nil:TRUE;
bool all_unequal = (m == FALSE)?TRUE:FALSE;
for (BUN n = 1; n < nr; n++, c++) {
- if (cur != gi[n] && !all_unequal) {
+ if (cur != gi[n] && (!all_unequal || outer)) {
ri1[q] = c;
ri2[q] = m;
q++;
@@ -525,7 +526,7 @@ ALGselectNotFalse(Client ctx, bat *r1, b
m = (m == FALSE && (mi[n] == FALSE || pi[n] ==
FALSE))?FALSE:(m == bit_nil || mi[n] == bit_nil || pi[n] ==
bit_nil)?bit_nil:TRUE;
all_unequal = all_unequal & (m == FALSE);
}
- if (!all_unequal) {
+ if (!all_unequal || outer) {
ri1[q] = c;
ri2[q] = m;
q++;
@@ -2090,9 +2091,9 @@ static mel_func algebra_init_funcs[] = {
command("algebra", "select", ALGselect2nil, false, "With unknown set, each
nil != nil", args(1,9,
batarg("",oid),batargany("b",1),batarg("s",oid),argany("low",1),argany("high",1),arg("li",bit),arg("hi",bit),arg("anti",bit),arg("unknown",bit))),
command("algebra", "thetaselect", ALGthetaselect2, false, "Select all head
values of the first input BAT for which the tail value obeys the relation value
OP VAL and for which the head value occurs in the tail of the second input BAT.
Input is a dense-headed BAT, output is a dense-headed BAT with in the tail the
head value of the input BAT for which the relationship holds. The output BAT
is sorted on the tail value.", args(1,5,
batarg("",oid),batargany("b",1),batarg("s",oid),argany("val",1),arg("op",str))),
command("algebra", "markselect", ALGmarkselect, false, "Group on group-ids,
return aggregated anyequal or allnotequal", args(2,6, batarg("",oid),
batarg("", bit), batarg("gid",oid), batarg("m", bit), batarg("p", bit),
arg("any", bit))),
+ command("algebra", "markselect", ALGmarkselect2, false, "Return (gid,
mark&&pred). If 'aggr', group on gid, return aggregated (gid, mark&&pred). If
'outer', return a row for each (grouped) gid; otherwise, return only the rows
where mark&&pred != FALSE.", args(2,7, batarg("",oid), batarg("", bit),
batarg("gid", oid), batarg("mark", bit), batarg("pred", bit), arg('aggr',bit),
arg('outer',bit))),
command("algebra", "single", ALGsingle, false, "Check for single result
ids.", args(1,3, batarg("r",oid), batarg("cands", oid), batarg("i", oid))),
command("algebra", "outerselect", ALGouterselect, false, "Per input lid
return at least one row, if none of the predicates (p) hold, return a nil, else
'all' true cases.", args(2,7, batarg("",oid), batarg("", bit), batarg("lid",
oid), batarg("rid", bit), batarg("predicate", bit), arg("any", bit),
arg("single", bit))),
- command("algebra", "selectNotFalse", ALGselectNotFalse, false, "Return (gid,
mark&&pred), if mark&&pred != FALSE. If 'aggr', group on gid, return aggregated
(gid, mark&&pred)", args(2,6, batarg("",oid), batarg("", bit), batarg("gid",
oid), batarg("mark", bit), batarg("pred", bit), arg('aggr',bit))),
command("algebra", "selectNotNil", ALGselectNotNil, false, "Select all
not-nil values", args(1,2, batargany("",1),batargany("b",1))),
command("algebra", "sort", ALGsort11, false, "Returns a copy of the BAT
sorted on tail values. The order is descending if the reverse bit is set. This
is a stable sort if the stable bit is set.", args(1,5,
batargany("",1),batargany("b",1),arg("reverse",bit),arg("nilslast",bit),arg("stable",bit))),
command("algebra", "sort", ALGsort12, false, "Returns a copy of the BAT
sorted on tail values and a BAT that specifies how the input was reordered. The
order is descending if the reverse bit is set. This is a stable sort if the
stable bit is set.", args(2,6,
batargany("",1),batarg("",oid),batargany("b",1),arg("reverse",bit),arg("nilslast",bit),arg("stable",bit))),
diff --git a/sql/backends/monet5/rel_pphash.c b/sql/backends/monet5/rel_pphash.c
--- a/sql/backends/monet5/rel_pphash.c
+++ b/sql/backends/monet5/rel_pphash.c
@@ -651,8 +651,10 @@ rel2bin_oahash_select(backend *be, stmt
static stmt *
rel2bin_oahash_outerselect(backend *be, stmt *sub, list *sexps, sql_rel *rel,
stmt *probed_ids, stmt *hash_ids, stmt **prb_mrk, bool cart, bool mark, bool
manti)
{
- assert (is_outerjoin(rel->op) || !list_empty(rel->attr));
stmt *sel = NULL, *m = prb_mrk?*prb_mrk:NULL;
+ bool is_outerj = is_outerjoin(rel->op);
+
+ assert (is_outerj || !list_empty(rel->attr));
if (hash_ids && cart) {
/* 0 == empty (no matches possible), nil - no match (but has
nil), 1 match */
@@ -673,9 +675,9 @@ rel2bin_oahash_outerselect(backend *be,
if (sel)
lgids = stmt_project(be, sel, lgids);
stmt *outer = NULL;
- if (manti) {
+ if (manti) {// && !is_outerj) {
assert(m); assert(p);
- outer = stmt_selectNotFalse(be, lgids, m, p, !en->next);
+ outer = stmt_markselect2(be, lgids, m, p, !en->next,
is_outerj);
}
else if (en->next || !mark)
outer = stmt_outerselect(be, lgids, m, p, is_any(e),
!en->next && is_single(rel));
@@ -693,14 +695,28 @@ rel2bin_oahash_outerselect(backend *be,
if (prb_mrk)
*prb_mrk = m;
}
- if (manti) { /* do the reverse selection for the anti-joins */
- stmt *u = stmt_unique(be, probed_ids);
- if (!u) return NULL;
- stmt *asel = stmt_tdiff4(be, probed_ids, probed_ids, u, sel);
- if (!asel) return NULL;
- sel = asel;
- stmt *amrk = stmt_const(be, asel, stmt_bool(be, 1));
- *prb_mrk = amrk;
+ if (manti) {
+ if (is_outerj) { /* reverse prb_mrk for outer joins, retain all
probed_ids */
+ assert(prb_mrk && *prb_mrk);
+ InstrPtr q = newStmtArgs(be->mb, batcalcRef, notRef, 1);
+ if (!q) return NULL;
+ q = pushArgument(be->mb, q, (*prb_mrk)->nr);
+ pushInstruction(be->mb, q);
+ stmt *rmrk = stmt_none(be);
+ rmrk->op4.typeval = *sql_fetch_localtype(TYPE_bit);
+ rmrk->nrcols = 2;
+ rmrk->nr = q->argv[0];
+ rmrk->q = q;
+ *prb_mrk = rmrk;
+ } else { /* do the reverse selection for the anti-joins */
+ stmt *u = stmt_unique(be, probed_ids);
+ if (!u) return NULL;
+ stmt *asel = stmt_tdiff4(be, probed_ids, probed_ids, u,
sel);
+ if (!asel) return NULL;
+ sel = asel;
+ stmt *amrk = stmt_const(be, asel, stmt_bool(be, 1));
+ *prb_mrk = amrk;
+ }
}
return sel;
}
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -2308,17 +2308,18 @@ stmt_markselect(backend *be, stmt *g, st
}
stmt *
-stmt_selectNotFalse(backend *be, stmt *g, stmt *m, stmt *p, bool aggr)
+stmt_markselect2(backend *be, stmt *g, stmt *m, stmt *p, bool aggr, bool outer)
{
MalBlkPtr mb = be->mb;
InstrPtr q;
- q = newStmtArgs(mb, algebraRef, putName("selectNotFalse"), 6);
+ q = newStmtArgs(mb, algebraRef, putName("markselect"), 7);
q = pushReturn(mb, q, newTmpVariable(mb, newBatType(TYPE_bit)));
q = pushArgument(mb, q, g->nr); /* group ids */
q = pushArgument(mb, q, m->nr); /* mark flag */
q = pushArgument(mb, q, p->nr); /* predicate */
q = pushBit(mb, q, (aggr)?TRUE:FALSE);
+ q = pushBit(mb, q, (outer)?TRUE:FALSE);
pushInstruction(mb, q);
if (!q)
diff --git a/sql/backends/monet5/sql_statement.h
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -207,8 +207,8 @@ extern stmt *stmt_single(backend *be, st
extern stmt *stmt_outerselect(backend *be, stmt *g, stmt *m, stmt *p, bool
any, bool single);
extern stmt *stmt_thetaselect(backend *be, stmt *op1, stmt *op2, stmt *val,
const char *cmp, sql_subtype *tpe);
extern stmt *stmt_markselect(backend *be, stmt *g, stmt *m, stmt *p, bool any);
+extern stmt *stmt_markselect2(backend *be, stmt *g, stmt *m, stmt *p, bool
aggr, bool outer);
extern stmt *stmt_markjoin(backend *be, stmt *l, stmt *r, bool nil_matches,
bool final);
-extern stmt *stmt_selectNotFalse(backend *be, stmt *g, stmt *m, stmt *p, bool
aggr);
extern stmt *stmt_tunion(backend *be, stmt *op1, stmt *op2);
extern stmt *stmt_tdiff(backend *be, stmt *op1, stmt *op2, stmt *lcand);
diff --git a/sql/backends/monet5/vaults/parquet/pqc_reader.c
b/sql/backends/monet5/vaults/parquet/pqc_reader.c
--- a/sql/backends/monet5/vaults/parquet/pqc_reader.c
+++ b/sql/backends/monet5/vaults/parquet/pqc_reader.c
@@ -1874,10 +1874,10 @@ pqc_add_nil( pqc_reader_t *r, pqc_creade
i -= len;
if (def) {
pos -= w*len;
- memcpy(output+w*i, data+pos, len*w);
+ memmove(output+w*i, data+pos, len*w);
} else {
for(int j = 0; j<len; j++)
- memcpy(output+w*(i+j), nil, w);
+ memmove(output+w*(i+j), nil, w);
}
def = !def;
}
@@ -2003,6 +2003,7 @@ static int64_t
pqc_read_page_chunk( pqc_reader_t *r, pqc_creader_t *cr, void *output /*fixed
sized atom storage */, void *voutput /* var storage */, uint64_t nrows, size_t
*ssize, int *dict)
{
bool swapped = false;
+ (void) swapped;
int64_t pos = cr->pos;
uint64_t orows = nrows;
if (r->pse->precision == 0 && !output)
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -606,12 +606,23 @@ supertype_opt_string(sql_subtype *super,
}
/* with !super_string we follow the sql specification that for
value lists and compare operators all values
* should be string or we cast into the non-string super type */
- } else if ((super_string && (EC_VARCHAR(i->type->eclass) ||
i->type->base.id > r->type->base.id)) ||
- (!super_string && ((EC_VARCHAR(r->type->eclass) &&
i->type->eclass != EC_ANY) || i->type->base.id > r->type->base.id))) {
- lsuper = *i;
- radix = i->type->radix;
- tpe = i->type->base.name;
- eclass = i->type->eclass;
+ } else {
+ bool prefer_i;
+ if (super_string) {
+ prefer_i = EC_VARCHAR(i->type->eclass) ||
i->type->base.id > r->type->base.id;
+ } else if (EC_VARCHAR(r->type->eclass) &&
!EC_VARCHAR(i->type->eclass) && i->type->eclass != EC_ANY) {
+ prefer_i = true; /* prefer non-string over string in
comparisons */
+ } else if (EC_VARCHAR(i->type->eclass) &&
!EC_VARCHAR(r->type->eclass) && r->type->eclass != EC_ANY) {
+ prefer_i = false; /* prefer non-string over string in
comparisons */
+ } else {
+ prefer_i = i->type->base.id > r->type->base.id;
+ }
+ if (prefer_i) {
+ lsuper = *i;
+ radix = i->type->radix;
+ tpe = i->type->base.name;
+ eclass = i->type->eclass;
+ }
}
if (!EC_SCALE(lsuper.type->eclass))
scale = 0; /* reset scale for types without it */
diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -2661,10 +2661,19 @@ rel_push_semijoin_down_or_up(visitor *v,
return rel;
if (right && is_left(lop))
return rel;
- /* Only push down if neither join side is reducing. A select
on the
- * non-chosen side would make the push-up rule immediately undo
this rewrite. */
- if (rel_has_select_tree(ll) || rel_has_select_tree(lr))
- return rel;
+ BUN sj_cnt = get_rel_count(rel), l_cnt = get_rel_count(l);
+ if (sj_cnt != BUN_NONE && l_cnt != BUN_NONE) {
+ /* count-based: only push down when semijoin reduces
the join input. */
+ if (sj_cnt >= l_cnt)
+ return rel;
+ /* A left push with a reducing right side is undone by
the push-up rule. */
+ if (left && rel_has_select_tree(lr))
+ return rel;
+ } else {
+ if (left ? (rel_has_select_tree(ll) ||
rel_has_select_tree(lr))
+ : rel_has_select_tree(lr))
+ return rel;
+ }
list *nsexps = exps_copy(v->sql, rel->exps);
list *nsattr = exps_copy(v->sql, rel->attr);
list *njexps = exps_copy(v->sql, l->exps);
diff --git a/sql/test/BugTracker-2024/Tests/7455-concat_order.test
b/sql/test/BugTracker-2024/Tests/7455-concat_order.test
--- a/sql/test/BugTracker-2024/Tests/7455-concat_order.test
+++ b/sql/test/BugTracker-2024/Tests/7455-concat_order.test
@@ -45,30 +45,31 @@ b
NULL
query I nosort
-SELECT (t0.c0||true BETWEEN v0.c0 AND v0.c0) FROM v0, t0 ORDER BY 1
+SELECT (true BETWEEN v0.c0 AND v0.c0) FROM v0, t0 ORDER BY 1
----
-0
-0
-0
-0
-0
-0
+1
+1
+1
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]