Changeset: 8b4b9abeb20e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b4b9abeb20e Modified Files: gdk/gdk_calc.c sql/backends/monet5/sql_statement.c Branch: Oct2020 Log Message:
When converting from a trivial SQL type into a clob, use the cheaper BATconvert call instead of SQLstr_cast. Also at BATconvert, a sorted integer column may not be sorted as a string diffs (42 lines): diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -14075,7 +14075,7 @@ BATconvert(BAT *b, BAT *s, int tp, bool bn->tnil = nils != 0; bn->tnonil = nils == 0; - if ((bn->ttype != TYPE_bit && b->ttype != TYPE_str) || + if ((bn->ttype != TYPE_str && bn->ttype != TYPE_bit && b->ttype != TYPE_str) || BATcount(bn) < 2) { bn->tsorted = nils == 0 && b->tsorted; bn->trevsorted = nils == 0 && b->trevsorted; 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 @@ -3051,6 +3051,8 @@ tail_set_type(stmt *st, sql_subtype *t) } } +#define trivial_string_conversion(x) ((x) == EC_BIT || (x) == EC_CHAR || (x) == EC_STRING || (x) == EC_NUM || (x) == EC_POS || (x) == EC_FLT) + stmt * stmt_convert(backend *be, stmt *v, stmt *sel, sql_subtype *f, sql_subtype *t) { @@ -3118,7 +3120,7 @@ stmt_convert(backend *be, stmt *v, stmt } /* convert to string is complex, we need full type info and mvc for the timezone */ - if (EC_VARCHAR(t->type->eclass) && !(f->type->eclass == EC_STRING && t->digits == 0)) { + if (EC_VARCHAR(t->type->eclass) && !(trivial_string_conversion(f->type->eclass) && t->digits == 0)) { q = pushInt(mb, q, f->type->eclass); q = pushInt(mb, q, f->digits); q = pushInt(mb, q, f->scale); @@ -3141,7 +3143,7 @@ stmt_convert(backend *be, stmt *v, stmt q = pushInt(mb, q, t->scale); } /* convert to string, give error on to large strings */ - if (EC_VARCHAR(t->type->eclass) && !(f->type->eclass == EC_STRING && t->digits == 0)) + if (EC_VARCHAR(t->type->eclass) && !(trivial_string_conversion(f->type->eclass) && t->digits == 0)) q = pushInt(mb, q, t->digits); /* convert a string to a time(stamp) with time zone */ if (EC_VARCHAR(f->type->eclass) && EC_TEMP_TZ(t->type->eclass)) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list