Changeset: 32d8c9110131 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32d8c9110131
Modified Files:
monetdb5/modules/kernel/mmath.c
monetdb5/modules/mal/txtsim.c
sql/backends/monet5/sql.c
sql/common/sql_types.c
sql/jdbc/tests/Tests/Test_PSsomeamount.timeout
sql/server/rel_select.c
sql/server/sql_atom.c
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/miscellaneous/Tests/simple_selects.sql
sql/test/miscellaneous/Tests/simple_selects.stable.err
sql/test/miscellaneous/Tests/simple_selects.stable.out
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.err
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:
Merged with linear-hashing
diffs (truncated from 746 to 300 lines):
diff --git a/monetdb5/modules/kernel/mmath.c b/monetdb5/modules/kernel/mmath.c
--- a/monetdb5/modules/kernel/mmath.c
+++ b/monetdb5/modules/kernel/mmath.c
@@ -312,4 +312,3 @@ MATHpi(dbl *pi)
*pi = 3.14159265358979323846;
return MAL_SUCCEED;
}
-
diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -107,6 +107,11 @@ levenshtein_impl(int *result, str *S, st
int sz; /* number of cells in matrix */
int diag2 = 0, cost2 = 0;
+ if (strNil(*S) || strNil(*T)) {
+ *result = int_nil;
+ return MAL_SUCCEED;
+ }
+
/* Step 1 */
n = (int) strlen(s); /* 64bit: assume strings are less than 2 GB */
m = (int) strlen(t);
@@ -812,6 +817,11 @@ fstrcmp_impl(dbl *ret, str *S1, str *S2,
static int *fdiag_buf;
static size_t fdiag_max;
+ if (strNil(*S1) || strNil(*S2) || is_dbl_nil(*minimum)) {
+ *ret = dbl_nil;
+ return MAL_SUCCEED;
+ }
+
/* set the info for each string. */
string[0].data = string1;
string[0].data_length = (int) strlen(string1); /* 64bit: assume string
not too long */
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -3544,6 +3544,10 @@ str
second_interval_2_daytime(daytime *res, const lng *s, const int *digits)
{
daytime d;
+ if (is_lng_nil(*s)) {
+ *res = daytime_nil;
+ return MAL_SUCCEED;
+ }
d = daytime_add_usec(daytime_create(0, 0, 0, 0), *s * 1000);
return daytime_2time_daytime(res, &d, digits);
}
@@ -3802,32 +3806,38 @@ str
month_interval(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
int *ret = getArgReference_int(stk, pci, 0);
- int k = digits2ek(*getArgReference_int(stk, pci, 2));
- int r;
+ int k = digits2ek(*getArgReference_int(stk, pci, 2)), r = 0, isnil = 0;
(void) cntxt;
- (void) mb;
+ *ret = int_nil;
switch (getArgType(mb, pci, 1)) {
case TYPE_bte:
r = stk->stk[getArg(pci, 1)].val.btval;
+ isnil = (stk->stk[getArg(pci, 1)].val.btval == bte_nil);
break;
case TYPE_sht:
r = stk->stk[getArg(pci, 1)].val.shval;
+ isnil = (stk->stk[getArg(pci, 1)].val.shval == sht_nil);
break;
case TYPE_int:
r = stk->stk[getArg(pci, 1)].val.ival;
+ isnil = (stk->stk[getArg(pci, 1)].val.ival == int_nil);
break;
case TYPE_lng:
r = (int) stk->stk[getArg(pci, 1)].val.lval;
+ isnil = (stk->stk[getArg(pci, 1)].val.lval == lng_nil);
break;
#ifdef HAVE_HGE
case TYPE_hge:
r = (int) stk->stk[getArg(pci, 1)].val.hval;
+ isnil = (stk->stk[getArg(pci, 1)].val.hval == hge_nil);
break;
#endif
default:
throw(ILLARG, "calc.month_interval", SQLSTATE(42000) "Illegal
argument");
}
+ if (isnil)
+ return MAL_SUCCEED;
switch (k) {
case iyear:
r *= 12;
@@ -4131,7 +4141,6 @@ sql_rt_credentials_wrap(Client cntxt, Ma
return msg;
}
-
str
sql_querylog_catalog(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
@@ -4443,7 +4452,6 @@ vacuum(Client cntxt, MalBlkPtr mb, MalSt
return MAL_SUCCEED;
}
-
i = 0;
bids[i] = 0;
for (o = t->columns.set->h; o; o = o->next, i++) {
@@ -4613,7 +4621,6 @@ SQLdrop_hash(Client cntxt, MalBlkPtr mb,
return MAL_SUCCEED;
}
-
/* after an update on the optimizer catalog, we have to change
* the internal optimizer pipe line administration
* The minimal and default pipelines may not be changed.
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
@@ -103,8 +103,8 @@ static int convert_matrix[EC_MAX][EC_MAX
/* EC_BLOB */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* EC_POS */ { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
/* EC_NUM */ { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
-/* EC_MONTH*/ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0 },
-/* EC_SEC*/ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0 },
+/* EC_MONTH*/ { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0 },
+/* EC_SEC*/ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
/* EC_DEC */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 },
/* EC_FLT */ { 0, 0, 0, 1, 1, 0, 1, 1, 0, 3, 1, 1, 0, 0, 0, 0, 0 },
/* EC_TIME */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 },
diff --git a/sql/jdbc/tests/Tests/Test_PSsomeamount.timeout
b/sql/jdbc/tests/Tests/Test_PSsomeamount.timeout
--- a/sql/jdbc/tests/Tests/Test_PSsomeamount.timeout
+++ b/sql/jdbc/tests/Tests/Test_PSsomeamount.timeout
@@ -1,1 +1,1 @@
-80
+2
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1284,8 +1284,6 @@ exp_fix_scale(mvc *sql, sql_subtype *ct,
return e;
}
-
-
static int
rel_binop_check_types(mvc *sql, sql_rel *rel, sql_exp *ls, sql_exp *rs, int
upcast)
{
@@ -4185,10 +4183,20 @@ rel_order_by_column_exp(sql_query *query
p->l = r;
if (e && p) {
e = rel_project_add_exp(sql, p, e);
+ for (node *n = p->exps->h ; n ; n = n->next) {
+ sql_exp *ee = n->data;
+
+ if (ee->card > r->card) {
+ if (exp_name(ee))
+ return sql_error(sql, ERR_GROUPBY,
SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s' in query results
without an aggregate function", exp_name(ee));
+ else
+ return sql_error(sql, ERR_GROUPBY,
SQLSTATE(42000) "SELECT: cannot use non GROUP BY column in query results
without an aggregate function");
+ }
+ }
return e;
}
if (e && r && is_project(r->op)) {
- sql_exp * found = exps_find_exp(r->exps, e);
+ sql_exp *found = exps_find_exp(r->exps, e);
if (!found) {
append(r->exps, e);
@@ -4270,14 +4278,14 @@ rel_order_by(sql_query *query, sql_rel *
return sql_error(sql, 02,
SQLSTATE(42000) "order not of type SQL_COLUMN");
}
} else if (e && exp_card(e) > rel->card) {
- if (e && exp_name(e)) {
+ if (exp_name(e)) {
return sql_error(sql,
ERR_GROUPBY, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s' in
query results without an aggregate function", exp_name(e));
} else {
return sql_error(sql,
ERR_GROUPBY, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column in query
results without an aggregate function");
}
}
if (e && rel && is_project(rel->op)) {
- sql_exp * found =
exps_find_exp(rel->exps, e);
+ sql_exp *found =
exps_find_exp(rel->exps, e);
if (!found) {
append(rel->exps, e);
diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -598,7 +598,7 @@ atom_num_digits( atom *a )
#endif
unsigned int inlen = 1;
- switch(a->tpe.type->localtype) {
+ switch (a->tpe.type->localtype) {
case TYPE_bte:
v = a->data.val.btval;
break;
@@ -646,7 +646,7 @@ atom_cast(sql_allocator *sa, atom *a, sq
if (at->type->eclass == EC_NUM && tp->type->eclass == EC_NUM &&
at->type->localtype <= tp->type->localtype) {
/* cast numerics */
- switch( tp->type->localtype) {
+ switch ( tp->type->localtype) {
case TYPE_bte:
if (at->type->localtype != TYPE_bte)
return 0;
@@ -712,7 +712,7 @@ atom_cast(sql_allocator *sa, atom *a, sq
lng mul = 1, div = 0, rnd = 0;
#endif
/* cast numerics */
- switch( tp->type->localtype) {
+ switch (tp->type->localtype) {
case TYPE_bte:
if (at->type->localtype != TYPE_bte)
return 0;
@@ -970,7 +970,7 @@ atom_cast(sql_allocator *sa, atom *a, sq
lng mul = 1;
#endif
/* cast numerics */
- switch( tp->type->localtype) {
+ switch (tp->type->localtype) {
case TYPE_bte:
if (at->type->localtype != TYPE_bte)
return 0;
@@ -1086,7 +1086,7 @@ atom_cast(sql_allocator *sa, atom *a, sq
size_t len = 0;
ssize_t res = 0;
/* cast decimals to doubles */
- switch( at->type->localtype) {
+ switch (at->type->localtype) {
case TYPE_bte:
dec = a->data.val.btval;
break;
@@ -1155,9 +1155,11 @@ atom_cast(sql_allocator *sa, atom *a, sq
}
int
-atom_neg( atom *a )
+atom_neg(atom *a)
{
ValRecord dst;
+ if (a->isnull)
+ return 0;
VALempty(&dst);
dst.vtype = a->data.vtype;
if (VARcalcnegate(&dst, &a->data) != GDK_SUCCEED)
@@ -1188,9 +1190,8 @@ atom_add(atom *a1, atom *a2)
{
ValRecord dst;
- if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass !=
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale))
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype !=
a2->tpe.type->localtype) {
+ if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass !=
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale))
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype !=
a2->tpe.type->localtype)
return NULL;
- }
if (a1->tpe.type->localtype < a2->tpe.type->localtype ||
(a1->tpe.type->localtype == a2->tpe.type->localtype &&
a1->tpe.digits < a2->tpe.digits)) {
@@ -1215,9 +1216,8 @@ atom_sub(atom *a1, atom *a2)
{
ValRecord dst;
- if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass !=
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale))
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype !=
a2->tpe.type->localtype) {
+ if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass !=
EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale))
|| a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype !=
a2->tpe.type->localtype)
return NULL;
- }
if (a1->tpe.type->localtype < a2->tpe.type->localtype ||
(a1->tpe.type->localtype == a2->tpe.type->localtype &&
a1->tpe.digits < a2->tpe.digits))
@@ -1285,7 +1285,7 @@ atom_mul(atom *a1, atom *a2)
}
int
-atom_inc( atom *a )
+atom_inc(atom *a)
{
ValRecord dst;
@@ -1302,11 +1302,11 @@ atom_inc( atom *a )
}
int
-atom_is_zero( atom *a )
+atom_is_zero(atom *a)
{
if (a->isnull)
return 0;
- switch(a->tpe.type->localtype) {
+ switch (a->tpe.type->localtype) {
case TYPE_bte:
return a->data.val.btval == 0;
case TYPE_sht:
@@ -1330,11 +1330,11 @@ atom_is_zero( atom *a )
}
int
-atom_is_true( atom *a )
+atom_is_true(atom *a)
{
if (a->isnull)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list