Changeset: e1b031ca0ddd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e1b031ca0ddd
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
monetdb5/modules/mal/pp_algebra.c
sql/backends/monet5/bin_partition_by_slice.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_pp_statement.c
sql/backends/monet5/sql_pp_statement.h
Branch: pp_hashjoin
Log Message:
removed 'pipeline ptr' from algebra.unique and renamed to ialgebra.unique
diffs (268 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
@@ -3838,16 +3838,6 @@ unique
command algebra.unique(X_0:bat[:any_1], X_1:bat[:oid]):bat[:oid]
ALGunique
Select all unique values from the tail of the first input. 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
that was selected. The output BAT is sorted on the tail value. The second
input BAT is a list of candidates.
-algebra
-unique
-command algebra.unique(X_0:ptr, X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid])
(X_4:bat[:oid], X_5:bat[:any_1])
-LALGgroup_unique
-Unique rows per group.
-algebra
-unique
-command algebra.unique(X_0:ptr, X_1:bat[:any_1], X_2:bat[:oid])
(X_3:bat[:oid], X_4:bat[:any_1])
-LALGunique
-Unique rows.
bat
append
command bat.append(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid],
X_3:bit):bat[:any_1]
@@ -48493,6 +48483,16 @@ projection
command ialgebra.projection(X_0:bat[:oid], X_1:bat[:any_1]):bat[:any_1]
LALGproject
Project.
+ialgebra
+unique
+command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid])
(X_3:bat[:oid], X_4:bat[:any_1])
+LALGgroup_unique
+Unique rows per group.
+ialgebra
+unique
+command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid]) (X_2:bat[:oid],
X_3:bat[:any_1])
+LALGunique
+Unique rows.
igroup
group
command igroup.group(X_0:bat[:oid], X_1:bat[:any_2], X_2:bat[:any_1])
(X_3:bat[:oid], X_4:bat[:any_1])
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
@@ -3278,16 +3278,6 @@ unique
command algebra.unique(X_0:bat[:any_1], X_1:bat[:oid]):bat[:oid]
ALGunique
Select all unique values from the tail of the first input. 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
that was selected. The output BAT is sorted on the tail value. The second
input BAT is a list of candidates.
-algebra
-unique
-command algebra.unique(X_0:ptr, X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid])
(X_4:bat[:oid], X_5:bat[:any_1])
-LALGgroup_unique
-Unique rows per group.
-algebra
-unique
-command algebra.unique(X_0:ptr, X_1:bat[:any_1], X_2:bat[:oid])
(X_3:bat[:oid], X_4:bat[:any_1])
-LALGunique
-Unique rows.
bat
append
command bat.append(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid],
X_3:bit):bat[:any_1]
@@ -36733,6 +36723,16 @@ projection
command ialgebra.projection(X_0:bat[:oid], X_1:bat[:any_1]):bat[:any_1]
LALGproject
Project.
+ialgebra
+unique
+command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid])
(X_3:bat[:oid], X_4:bat[:any_1])
+LALGgroup_unique
+Unique rows per group.
+ialgebra
+unique
+command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid]) (X_2:bat[:oid],
X_3:bat[:any_1])
+LALGunique
+Unique rows.
igroup
group
command igroup.group(X_0:bat[:oid], X_1:bat[:any_2], X_2:bat[:any_1])
(X_3:bat[:oid], X_4:bat[:any_1])
diff --git a/monetdb5/modules/mal/pp_algebra.c
b/monetdb5/modules/mal/pp_algebra.c
--- a/monetdb5/modules/mal/pp_algebra.c
+++ b/monetdb5/modules/mal/pp_algebra.c
@@ -1032,10 +1032,10 @@ LOCKEDAGGRnull(Client ctx, bat *result,
)
static str
-LALGunique(Client ctx, bat *rid, bat *uid, const ptr *H, bat *bid, bat *sid)
+LALGunique(Client ctx, bat *rid, bat *uid, bat *bid, bat *sid)
{
(void)ctx;
- Pipeline *p = (Pipeline*)*H;
+ Pipeline *p = pipeline_get_thread_private_pipeline();
assert(!is_bat_nil(*uid));
str err = NULL;
assert(is_bat_nil(*sid)); /* no cands jet */
@@ -1045,7 +1045,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
BAT *u = BATdescriptor(*uid);
BAT *b = BATdescriptor(*bid);
if (u == NULL || b == NULL) {
- err = createException(MAL, "pp algebra.unique", SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
+ err = createException(MAL, "ialgebra.unique", SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
goto error;
}
@@ -1062,7 +1062,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
h->allocators =
(allocator**)GDKzalloc(p->p->nr_workers*sizeof(allocator*));
if (!h->allocators) {
pipeline_unlock(p);
- err = createException(MAL, "pp algebra.(group
)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ err = createException(MAL,
"ialgebra.(group_)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto error;
} else
h->nr_allocators = p->p->nr_workers;
@@ -1074,7 +1074,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
snprintf(name, sizeof(name), "pp%d", p->wid);
h->allocators[p->wid] = create_allocator(name, false);
if (!h->allocators[p->wid]) {
- err = createException(MAL, "pp algebra.(group
)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ err = createException(MAL,
"ialgebra.(group_)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto error;
}
}
@@ -1108,7 +1108,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
BAT *g = COLnew(0, TYPE_oid, cnt, TRANSIENT);
if (g == NULL) {
- err = createException(MAL, "pp algebra.unique",
MAL_MALLOC_FAIL);
+ err = createException(MAL, "ialgebra.unique",
MAL_MALLOC_FAIL);
goto error;
}
if (cnt && !err) {
@@ -1143,7 +1143,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
}
h->processed += cnt;
ht_deactivate(h);
- TIMEOUT_CHECK(qry_ctx, err = createException(SQL, "pp
algebra.unique", RUNTIME_QRY_TIMEOUT));
+ TIMEOUT_CHECK(qry_ctx, err = createException(SQL,
"ialgebra.unique", RUNTIME_QRY_TIMEOUT));
}
if (err) {
BBPunfix(g->batCacheid);
@@ -1283,10 +1283,10 @@ LALGunique(Client ctx, bat *rid, bat *ui
)
static str
-LALGgroup_unique(Client ctx, bat *rid, bat *uid, const ptr *H, bat *bid, bat
*sid, bat *Gid)
+LALGgroup_unique(Client ctx, bat *rid, bat *uid, bat *bid, bat *sid, bat *Gid)
{
(void)ctx;
- Pipeline *p = (Pipeline*)*H;
+ Pipeline *p = pipeline_get_thread_private_pipeline();
assert(!is_bat_nil(*uid));
str err = NULL;
assert(is_bat_nil(*sid)); /* no cands jet */
@@ -1297,7 +1297,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
BAT *G = BATdescriptor(*Gid);
BAT *b = BATdescriptor(*bid);
if (u == NULL || G == NULL || b == NULL) {
- err = createException(MAL, "pp algebra.(group_)unique",
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
+ err = createException(MAL, "ialgebra.(group_)unique",
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
goto error;
}
@@ -1314,7 +1314,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
h->allocators =
(allocator**)GDKzalloc(p->p->nr_workers*sizeof(allocator*));
if (!h->allocators) {
pipeline_unlock(p);
- err = createException(MAL, "pp algebra.(group
)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ err = createException(MAL,
"ialgebra.(group_)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto error;
} else
h->nr_allocators = p->p->nr_workers;
@@ -1326,7 +1326,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
snprintf(name, sizeof(name), "pp%d", p->wid);
h->allocators[p->wid] = create_allocator(name, false);
if (!h->allocators[p->wid]) {
- err = createException(MAL, "pp algebra.(group
)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ err = createException(MAL,
"ialgebra.(group_)unique", SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto error;
}
}
@@ -1359,7 +1359,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
BAT *ng = COLnew(0, TYPE_oid, cnt, TRANSIENT);
if (ng == NULL) {
- err = createException(MAL, "pp algebra.(group_)unique",
MAL_MALLOC_FAIL);
+ err = createException(MAL, "ialgebra.(group_)unique",
MAL_MALLOC_FAIL);
goto error;
}
if (cnt && !err) {
@@ -1397,7 +1397,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
gaunique(str,const char *)
}
ht_deactivate(h);
- TIMEOUT_CHECK(qry_ctx, err = createException(SQL, "pp
algebra.(group_)unique", RUNTIME_QRY_TIMEOUT));
+ TIMEOUT_CHECK(qry_ctx, err = createException(SQL,
"ialgebra.(group_)unique", RUNTIME_QRY_TIMEOUT));
}
if (err) {
BBPunfix(ng->batCacheid);
@@ -4914,8 +4914,8 @@ static mel_func pp_algebra_init_funcs[]
command("ialgebra", "projection", LALGproject, false, "Project.",
args(1,3, batargany("",1), batarg("gid", oid), batargany("b",1))),
/* COUNT DISTINCT: globle / grouped */
- command("algebra", "unique", LALGunique, false, "Unique rows.",
args(2,5, batarg("gid", oid), batargany("",1), arg("pipeline", ptr),
batargany("b",1), batarg("s",oid))),
- command("algebra", "unique", LALGgroup_unique, false, "Unique rows per
group.", args(2,6, batarg("ngid", oid), batargany("",1), arg("pipeline", ptr),
batargany("b",1), batarg("s",oid), batarg("gid",oid))),
+ command("ialgebra", "unique", LALGunique, false, "Unique rows.",
args(2,4, batarg("gid", oid), batargany("",1), batargany("b",1),
batarg("s",oid))),
+ command("ialgebra", "unique", LALGgroup_unique, false, "Unique rows per
group.", args(2,5, batarg("ngid", oid), batargany("",1), batargany("b",1),
batarg("s",oid), batarg("gid",oid))),
/********** Grouped aggregates **********/
command("aggr", "min", LALGmin, false, "Min per group.",
args(1,5, batargany("",1), batarg("gid", oid), batargany("", 1),
arg("pipeline", ptr), batarg("pid", oid))),
diff --git a/sql/backends/monet5/bin_partition_by_slice.c
b/sql/backends/monet5/bin_partition_by_slice.c
--- a/sql/backends/monet5/bin_partition_by_slice.c
+++ b/sql/backends/monet5/bin_partition_by_slice.c
@@ -1066,7 +1066,7 @@ rel2bin_groupby_pp(backend *be, sql_rel
}
if (prev) {
assert(m);
- stmt *u = stmt_unique_sharedout(be,
m->data, prev->shared);
+ stmt *u = stmt_ialgebra_unique(be,
m->data, prev->shared);
if (u == NULL)
return NULL;
if (pgrp)
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
@@ -1903,7 +1903,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
stmt *a = l->h->data;
stmt *u;
if (e->shared) {
- u = stmt_unique_sharedout(be, a,
e->shared);
+ u = stmt_ialgebra_unique(be, a,
e->shared);
if (u == NULL)
return NULL;
if (grp)
diff --git a/sql/backends/monet5/sql_pp_statement.c
b/sql/backends/monet5/sql_pp_statement.c
--- a/sql/backends/monet5/sql_pp_statement.c
+++ b/sql/backends/monet5/sql_pp_statement.c
@@ -339,7 +339,7 @@ stmt_limit_partitioned(backend *be, stmt
/* output: shared bat var id, must always be a positive number */
stmt *
-stmt_unique_sharedout(backend *be, stmt *s, int output)
+stmt_ialgebra_unique(backend *be, stmt *s, int output)
{
MalBlkPtr mb = be->mb;
InstrPtr q = NULL;
@@ -347,14 +347,13 @@ stmt_unique_sharedout(backend *be, stmt
if (s->nr < 0)
return NULL;
- q = newStmt(mb, algebraRef, uniqueRef);
+ q = newStmt(mb, ialgebraRef, uniqueRef);
if(!q)
return NULL;
assert(output > 0);
q = pushReturn(mb, q, output);
q->inout = 1;
- q = pushArgument(mb, q, be->pipeline);
q = pushArgument(mb, q, s->nr);
q = pushNilBat(mb, q); /* candidate list */
pushInstruction(mb, q);
diff --git a/sql/backends/monet5/sql_pp_statement.h
b/sql/backends/monet5/sql_pp_statement.h
--- a/sql/backends/monet5/sql_pp_statement.h
+++ b/sql/backends/monet5/sql_pp_statement.h
@@ -42,7 +42,7 @@ extern stmt *stmt_pp_aggr(backend *be, s
extern stmt *stmt_group_partitioned(backend *be, stmt *op1, stmt *grp, stmt
*ext, stmt *cnt);
extern stmt *stmt_limit_partitioned(backend *sa, stmt *c, stmt *piv, stmt
*gid, stmt *offset, stmt *limit);
-extern stmt *stmt_unique_sharedout(backend *be, stmt *op1, int output);
+extern stmt *stmt_ialgebra_unique(backend *be, stmt *op1, int output);
extern stmt *stmt_slice(backend *be, stmt *col, stmt *limit);
extern stmt *stmt_nth_slice(backend *be, stmt *col, bool hash);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]