Changeset: 31ec78deab09 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=31ec78deab09
Modified Files:
gdk/gdk_calc.c
monetdb5/modules/atoms/batxml.mal
monetdb5/modules/atoms/mtime.c
monetdb5/modules/kernel/algebra.mx
monetdb5/modules/kernel/batstr.c
monetdb5/modules/kernel/group.mx
monetdb5/modules/mal/pcre.mal
monetdb5/optimizer/opt_centipede.c
monetdb5/optimizer/opt_cluster.c
monetdb5/optimizer/opt_dictionary.c
monetdb5/optimizer/opt_groups.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_origin.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
sql/backends/monet5/UDF/Tests/udf-fuse.stable.out
sql/backends/monet5/UDF/Tests/udf-reverse.stable.out
sql/backends/monet5/sql.mx
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_user.c
sql/common/sql_types.c
sql/scripts/09_like.sql
sql/server/Makefile.ag
sql/server/bin_optimizer.c
sql/server/rel_bin.c
sql/server/rel_bin.h
sql/server/rel_optimizer.c
sql/server/sql_rel2bin.c
sql/server/sql_rel2bin.h
sql/server/sql_statement.c
sql/server/sql_statement.h
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
sql/storage/bat/bat_table.c
sql/storage/bat/bat_utils.c
sql/storage/restrict/restrict_storage.c
sql/storage/restrict/restrict_table.c
sql/storage/sql_storage.h
sql/test/BugTracker-2009/Tests/POWER_vs_prod.SF-2596114.stable.out
sql/test/BugTracker-2009/Tests/explain_gives_crash.SF-2741829.stable.out
sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out
sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out
sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.stable.out
sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
sql/test/BugTracker-2011/Tests/func_iter_vs_bulk.Bug-2826.stable.out
sql/test/BugTracker-2012/Tests/correlated_groupby_in_selection.Bug-3011.stable.out
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/insert_not_exists.SF-1380287.sql
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
sql/test/Dependencies/Tests/Dependencies.stable.out
sql/test/Tests/coalesce.stable.err
sql/test/Tests/setoptimizer.stable.out
sql/test/Tests/systemfunctions.stable.out
sql/test/Tests/trace.stable.out
sql/test/leaks/Tests/check0.stable.out
sql/test/leaks/Tests/check1.stable.out
sql/test/leaks/Tests/check2.stable.out
sql/test/leaks/Tests/check3.stable.out
sql/test/leaks/Tests/check4.stable.out
sql/test/leaks/Tests/check5.stable.out
sql/test/sql_xml/Tests/funcs.sql
Branch: default
Log Message:
big step towards single unary tables...
The sql frontend is now using the new subselect and friends. Next
step is to created new join versions which also return void head bats.
diffs (truncated from 10393 to 300 lines):
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -9657,8 +9657,13 @@ BATconvert(BAT *b, BAT *s, int tp, int a
bn->T->nil = nils != 0;
bn->T->nonil = nils == 0;
- bn->T->sorted = nils == 0 && b->T->sorted;
- bn->T->revsorted = nils == 0 && b->T->revsorted;
+ if (b->T->type != TYPE_str || BATcount(bn) < 2 ) {
+ bn->T->sorted = nils == 0 && b->T->sorted;
+ bn->T->revsorted = nils == 0 && b->T->revsorted;
+ } else {
+ bn->T->sorted = 0;
+ bn->T->revsorted = 0;
+ }
bn->T->key = (b->T->key & 1) && nils <= 1;
return bn;
diff --git a/monetdb5/modules/atoms/batxml.mal
b/monetdb5/modules/atoms/batxml.mal
--- a/monetdb5/modules/atoms/batxml.mal
+++ b/monetdb5/modules/atoms/batxml.mal
@@ -87,8 +87,8 @@ command xml.isdocument(val:bat[:oid,:str
address BATXMLisdocument
comment "Validate the string as a XML document.";
-command xml.subaggr(val:bat[:oid,:xml], skip_nils:int) :bat[:oid,:xml]
-address AGGRxml
+command xml.aggr(val:bat[:oid,:xml]):xml
+address BATXMLgroup
comment "Aggregate the XML values.";
command xml.subaggr(val:bat[:oid,:xml],g:bat[:oid,:oid],e:bat[:oid,:any_1],
skip_nils:int) :bat[:oid,:xml]
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -2842,19 +2842,28 @@ MTIMEdate_extract_year_bulk(int *ret, in
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdate", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.year", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdate_extract_year(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.year", "inserting value failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -2880,19 +2889,28 @@ MTIMEdate_extract_month_bulk(int *ret, i
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdate", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.month", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdate_extract_month(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.month", "inserting value failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -2918,19 +2936,28 @@ MTIMEdate_extract_day_bulk(int *ret, int
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdate", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.day", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdate_extract_day(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.day", "inserting value failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -2956,19 +2983,28 @@ MTIMEdaytime_extract_hours_bulk(int *ret
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdaytime", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.hours", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdaytime_extract_hours(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.hours", "inserting value failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -2994,19 +3030,28 @@ MTIMEdaytime_extract_minutes_bulk(int *r
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdaytime", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.minutes", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdaytime_extract_minutes(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.minutes", "inserting value
failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -3032,19 +3077,28 @@ MTIMEdaytime_extract_seconds_bulk(int *r
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdaytime", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.seconds", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdaytime_extract_seconds(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.seconds", "inserting value
failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -3070,19 +3124,28 @@ MTIMEdaytime_extract_sql_seconds_bulk(in
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdaytime", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.sql_seconds", "memory allocation failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdaytime_extract_sql_seconds(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.sql_seconds", "inserting value
failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
@@ -3108,19 +3171,28 @@ MTIMEdaytime_extract_milliseconds_bulk(i
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bbp.getdaytime", "Cannot access descriptor");
- bn = BATnew(BAThtype(b), TYPE_int, BATcount(b));
+ bn = BATnew(TYPE_void, TYPE_int, BATcount(b));
if (bn == NULL)
throw(MAL, "batmtime.milliseconds", "memory allocation
failure");
+ BATseqbase(bn, 0);
bi = bat_iterator(b);
BATloop(b, p, q) {
d = *(date *) BUNtail(bi, p);
MTIMEdaytime_extract_milliseconds(&v, &d);
- if (BUNfastins(bn, BUNhead(bi, p), &v) == NULL) {
+ if (BUNappend(bn, &v, FALSE) == NULL) {
BBPunfix(bn->batCacheid);
throw(MAL, "batmtime.milliseconds", "inserting value
failed");
}
}
+
+ if (b->htype != bn->htype) {
+ BAT *r = VIEWcreate(b,bn);
+
+ BBPreleaseref(bn->batCacheid);
+ bn = r;
+ }
+
bn->H->nonil = b->H->nonil;
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
diff --git a/monetdb5/modules/kernel/algebra.mx
b/monetdb5/modules/kernel/algebra.mx
--- a/monetdb5/modules/kernel/algebra.mx
+++ b/monetdb5/modules/kernel/algebra.mx
@@ -241,7 +241,7 @@ command topN( b:bat[:any_1,:any_2], top:
address ALGtopN
comment "Trim all but the top N tuples.";
-command groupby(b:bat[:any_1,:wrd]) :bat[:any_1,:oid]
+command groupby(gids:bat[:oid,:oid], cnts:bat[:oid,:wrd]) :bat[:oid,:oid]
address ALGgroupby
comment "Produces a new BAT with groups identified by the head column. The
result contains tail times the head value, ie the tail contains the result
group sizes.";
@@ -1048,7 +1048,7 @@ algebra_export str ALGmax_@1(@1* res, in
algebra_export str ALGminany(ptr result, int *bid);
algebra_export str ALGmaxany(ptr result, int *bid);
algebra_export str ALGtopN(int *res, int *bid, lng *top);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list