Changeset: d500db812b8d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d500db812b8d
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
monetdb5/mal/mal_interpreter.c
monetdb5/modules/mal/pp_algebra.c
monetdb5/modules/mal/pp_hash.c
monetdb5/modules/mal/pp_slicer.c
monetdb5/optimizer/opt_mitosis.c
sql/backends/monet5/bin_partition.c
sql/backends/monet5/bin_partition_by_slice.c
sql/backends/monet5/bin_partition_by_value.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/rel_physical.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_pp_statement.c
sql/backends/monet5/sql_pp_statement.h
sql/backends/monet5/sql_statement.c
sql/storage/bat/bat_storage.c
sql/storage/objectset.c
sql/storage/sql_catalog.c
sql/storage/sql_storage.h
sql/test/FeatureRequests/Tests/All
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-query.test
Branch: pp_hashjoin
Log Message:
in case of pipeline partition in fixed sized chunks
diffs (truncated from 1109 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
@@ -48058,6 +48058,11 @@ sum
unsafe pattern lockedaggr.sum(X_0:ptr, X_1:any_1):bat[:any_1]
LOCKEDAGGRsum1
sum values into bat (bat has value, update), using the bat lock
+lockedaggr
+sum_no_nil
+unsafe pattern lockedaggr.sum_no_nil(X_0:ptr, X_1:any_1):bat[:any_1]
+LOCKEDAGGRsum_no_nil1
+sum values into bat (bat has value, update), using the bat lock
lockedalgebra
projection
command lockedalgebra.projection(X_0:ptr, X_1:bat[:oid],
X_2:bat[:any_1]):bat[:any_1]
@@ -49520,7 +49525,7 @@ OAHASHnprobe_single
Probe the `key`-s in the hash table. For a not-matched key, return its OID in
the 'key' column and the slot ID in the hash table
oahash
nth_slice
-command oahash.nth_slice(X_0:int) (X_1:bat[:oid], X_2:bat[:any_1])
+command oahash.nth_slice(X_0:bat[:any_1], X_1:int):bat[:oid]
OAHASHnth_slice
Get the nth slice of this hashtable.
oahash
@@ -50285,7 +50290,7 @@ SLICERno_slices
Returns the number of slices into which the input BAT is to be sliced
slicer
nth_slice
-pattern slicer.nth_slice(X_0:int) (X_1:bat[:any_1], X_2:bat[:any_1])
+pattern slicer.nth_slice(X_0:bat[:any_1], X_1:int):bat[:any_1]
SLICERnth_slice
Return the n-th slice, of SLICE_SIZE rrows, from the input BAT
sop
@@ -50470,6 +50475,16 @@ mvc_bind_wrap
Bind the 'schema.table.column' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
sql
bind
+pattern sql.bind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int)
(X_6:bat[:oid], X_7:bat[:any_1])
+mvc_bind_wrap
+Bind the 'schema.table.column' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
+sql
+bind
+pattern sql.bind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int,
X_5:int):bat[:any_1]
+mvc_bind_wrap
+Bind the 'schema.table.column' BAT partition with access kind:@0 - base
table@1 - inserts@2 - updates
+sql
+bind
pattern sql.bind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int,
X_6:int) (X_7:bat[:oid], X_8:bat[:any_1])
mvc_bind_wrap
Bind the 'schema.table.column' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
@@ -50490,6 +50505,16 @@ mvc_bind_idxbat_wrap
Bind the 'schema.table.index' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
sql
bind_idxbat
+pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int)
(X_6:bat[:oid], X_7:bat[:any_1])
+mvc_bind_idxbat_wrap
+Bind the 'schema.table.index' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
+sql
+bind_idxbat
+pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int,
X_5:int):bat[:any_1]
+mvc_bind_idxbat_wrap
+Bind the 'schema.table.index' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
+sql
+bind_idxbat
pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int,
X_6:int) (X_7:bat[:oid], X_8:bat[:any_1])
mvc_bind_idxbat_wrap
Bind the 'schema.table.index' BAT with access kind:@0 - base table@1 -
inserts@2 - updates
@@ -50775,6 +50800,16 @@ mvc_bind_wrap
(empty)
sql
emptybind
+pattern sql.emptybind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int)
(X_6:bat[:oid], X_7:bat[:any_1])
+mvc_bind_wrap
+(empty)
+sql
+emptybind
+pattern sql.emptybind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int,
X_5:int):bat[:any_1]
+mvc_bind_wrap
+(empty)
+sql
+emptybind
pattern sql.emptybind(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int,
X_6:int) (X_7:bat[:oid], X_8:bat[:any_1])
mvc_bind_wrap
(empty)
@@ -50795,6 +50830,16 @@ mvc_bind_idxbat_wrap
(empty)
sql
emptybindidx
+pattern sql.emptybindidx(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int)
(X_6:bat[:oid], X_7:bat[:any_1])
+mvc_bind_idxbat_wrap
+(empty)
+sql
+emptybindidx
+pattern sql.emptybindidx(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int,
X_5:int):bat[:any_1]
+mvc_bind_idxbat_wrap
+(empty)
+sql
+emptybindidx
pattern sql.emptybindidx(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int,
X_6:int) (X_7:bat[:oid], X_8:bat[:any_1])
mvc_bind_idxbat_wrap
(empty)
@@ -51009,6 +51054,11 @@ unsafe pattern sql.next_value(X_0:str, X
mvc_next_value
return the next value of the sequence
sql
+no_slices
+command sql.no_slices(X_0:str, X_1:str):int
+SQLno_slices
+Return number of slices of table
+sql
normalize_monetdb_url
pattern sql.normalize_monetdb_url(X_0:str):str
SQLnormalize_monetdb_url
@@ -51495,6 +51545,11 @@ SQLtid
Return a column with the valid tuple identifiers associated with the table
sname.tname.
sql
tid
+pattern sql.tid(X_0:int, X_1:str, X_2:str, X_3:int):bat[:oid]
+SQLtid
+Return a slice of the tables tid column, based on fixed partition sizes.
+sql
+tid
pattern sql.tid(X_0:int, X_1:str, X_2:str, X_3:int, X_4:int):bat[:oid]
SQLtid
Return the tables tid column.
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
@@ -37980,7 +37980,7 @@ OAHASHnprobe_single
Probe the `key`-s in the hash table. For a not-matched key, return its OID in
the 'key' column and the slot ID in the hash table
oahash
nth_slice
-command oahash.nth_slice(X_0:int) (X_1:bat[:oid], X_2:bat[:any_1])
+command oahash.nth_slice(X_0:bat[:any_1], X_1:int):bat[:oid]
OAHASHnth_slice
Get the nth slice of this hashtable.
oahash
@@ -38745,7 +38745,7 @@ SLICERno_slices
Returns the number of slices into which the input BAT is to be sliced
slicer
nth_slice
-pattern slicer.nth_slice(X_0:int) (X_1:bat[:any_1], X_2:bat[:any_1])
+pattern slicer.nth_slice(X_0:bat[:any_1], X_1:int):bat[:any_1]
SLICERnth_slice
Return the n-th slice, of SLICE_SIZE rrows, from the input BAT
sop
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -891,7 +891,7 @@ runMALsequence(Client cntxt, MalBlkPtr m
GDKfree(lhs->val.pval);
}
}
- if (ATOMIC_GET(&GDKdebug) & CHECKMASK && exceptionVar <
0) {
+ if (0 && ATOMIC_GET(&GDKdebug) & CHECKMASK &&
exceptionVar < 0) {
BAT *b;
for (int i = 0; i < pci->retc; i++) {
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
@@ -48,6 +48,8 @@
b->tnonil = true;
\
MT_lock_unset(&b->theaplock);
\
} else if (BATcount(b) == 0) {
\
+ if (no_nil)
\
+ val = 0;
\
if (BUNappend(b, &val, true) != GDK_SUCCEED)
\
err = createException(MAL, "lockedaggr." #f,
\
SQLSTATE(HY013) MAL_MALLOC_FAIL);
\
@@ -69,43 +71,16 @@
b->tnonil = true;
\
MT_lock_unset(&b->theaplock);
\
} else if (BATcount(b) == 0) {
\
+ if (no_nil)
\
+ val = 0;
\
if (BUNappend(b, &val, true) != GDK_SUCCEED)
\
err = createException(MAL, "lockedaggr." #f,
\
SQLSTATE(HY013) MAL_MALLOC_FAIL);
\
}
\
}
-#define vaggr(T,CT,f)
\
- if (type == TYPE_##T) {
\
- BATiter bi = bat_iterator(b);
\
- T val = *getArgReference_##T(stk, pci, 2);
\
- const void *nil = ATOMnilptr(type);
\
- int (*cmp)(const void *v1,const void *v2) = ATOMcompare(type);
\
- if (cmp(val,nil) != 0 && BATcount(b)) {
\
- CT t = BUNtvar(&bi, 0);
\
- if (cmp(t,nil) == 0) {
\
- if (BUNreplace(b, 0, val, true) != GDK_SUCCEED)
\
- err = createException(MAL, "2
lockedaggr." #f, \
- SQLSTATE(HY013)
MAL_MALLOC_FAIL); \
- } else
\
- if (f(t, val) == val)
\
- if (BUNreplace(b, 0, val, true) !=
GDK_SUCCEED) \
- err = createException(MAL, "1
lockedaggr." #f, \
- SQLSTATE(HY013)
MAL_MALLOC_FAIL); \
- MT_lock_set(&b->theaplock);
\
- b->tnil = false;
\
- b->tnonil = true;
\
- MT_lock_unset(&b->theaplock);
\
- } else if (BATcount(b) == 0) {
\
- if (BUNappend(b, val, true) != GDK_SUCCEED)
\
- err = createException(MAL, "3 lockedaggr." #f,
\
- SQLSTATE(HY013) MAL_MALLOC_FAIL);
\
- }
\
- bat_iterator_end(&bi);
\
- }
-
static str
-LOCKEDAGGRsum1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+LOCKEDAGGRsum1_(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, bool
no_nil)
{
bat *res = getArgReference_bat(stk, pci, 0);
Pipeline *p = (Pipeline*)*getArgReference_ptr(stk, pci, 1);
@@ -145,6 +120,14 @@ LOCKEDAGGRsum1(Client cntxt, MalBlkPtr m
BBPunfix(b->batCacheid);
}
} else {
+ ptr p = (ptr)ATOMnilptr(type);
+#ifdef HAVE_HGE
+ hge val = 0;
+#else
+ lng val = 0;
+#endif
+ if (no_nil)
+ p = &val;
BAT *b = COLnew(0, type, 1, TRANSIENT);
if (!b || BUNappend(b, p, true) != GDK_SUCCEED)
err = createException(MAL, "lockedaggr.sum",
"Result is not initialized");
@@ -163,6 +146,18 @@ LOCKEDAGGRsum1(Client cntxt, MalBlkPtr m
return MAL_SUCCEED;
}
+static str
+LOCKEDAGGRsum1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+ return LOCKEDAGGRsum1_(cntxt, mb, stk, pci, false);
+}
+
+static str
+LOCKEDAGGRsum_no_nil1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+ return LOCKEDAGGRsum1_(cntxt, mb, stk, pci, true);
+}
+
#define paggr(T,OT,f)
\
if (type == TYPE_##T && b->ttype == TYPE_##OT) {
\
T val = *getArgReference_##T(stk, pci, 2);
\
@@ -689,6 +684,80 @@ LOCKEDAGGRavg(Client cntxt, MalBlkPtr mb
#define vmin(a,b) ((cmp(a,b) < 0)?a:b)
#define vmax(a,b) ((cmp(a,b) > 0)?a:b)
+#undef aggr
+#undef faggr
+#undef vaggr
+
+#define aggr(T,f)
\
+ if (type == TYPE_##T) {
\
+ T val = *getArgReference_##T(stk, pci, 2);
\
+ if (!is_##T##_nil(val) && BATcount(b)) {
\
+ T *t = Tloc(b, 0);
\
+ if (is_##T##_nil(t[0])) {
\
+ t[0] = val;
\
+ } else
\
+ t[0] = f(t[0], val);
\
+ MT_lock_set(&b->theaplock);
\
+ b->tnil = false;
\
+ b->tnonil = true;
\
+ MT_lock_unset(&b->theaplock);
\
+ } else if (BATcount(b) == 0) {
\
+ if (BUNappend(b, &val, true) != GDK_SUCCEED)
\
+ err = createException(MAL, "lockedaggr." #f,
\
+ SQLSTATE(HY013) MAL_MALLOC_FAIL);
\
+ }
\
+ }
+
+#define faggr(T,f)
\
+ if (type == TYPE_##T) {
\
+ T val = *getArgReference_TYPE(stk, pci, 2, T);
\
+ int (*cmp)(const void *v1,const void *v2) = ATOMcompare(type);
\
+ if (!is_##T##_nil(val) && BATcount(b)) {
\
+ T *t = Tloc(b, 0);
\
+ if (is_##T##_nil(t[0])) {
\
+ t[0] = val;
\
+ } else
\
+ t[0] = f(t[0], val);
\
+ MT_lock_set(&b->theaplock);
\
+ b->tnil = false;
\
+ b->tnonil = true;
\
+ MT_lock_unset(&b->theaplock);
\
+ } else if (BATcount(b) == 0) {
\
+ if (BUNappend(b, &val, true) != GDK_SUCCEED)
\
+ err = createException(MAL, "lockedaggr." #f,
\
+ SQLSTATE(HY013) MAL_MALLOC_FAIL);
\
+ }
\
+ }
+
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]