Changeset: dffad86740de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dffad86740de
Modified Files:
        sql/backends/monet5/copy.c
        sql/backends/monet5/copy_convert.c
        sql/backends/monet5/rel_copy.c
Branch: default
Log Message:

small optimizations of csv loader


diffs (73 lines):

diff --git a/sql/backends/monet5/copy.c b/sql/backends/monet5/copy.c
--- a/sql/backends/monet5/copy.c
+++ b/sql/backends/monet5/copy.c
@@ -582,7 +582,6 @@ COPYsplitlines(Client cntxt, MalBlkPtr m
        if (!r->error && !r->done && r->offset) {
                lng skipped = COPYskiplines(r, p->wid);
                r->offset -= (BUN)skipped;
-               //r->linecount += skipped; ??
        }
 
        lng line_count = 0;
diff --git a/sql/backends/monet5/copy_convert.c 
b/sql/backends/monet5/copy_convert.c
--- a/sql/backends/monet5/copy_convert.c
+++ b/sql/backends/monet5/copy_convert.c
@@ -76,9 +76,6 @@ COPYparse_generic(Client cntxt, MalBlkPt
 
                if (is_int_nil(offset)) {
                        to_insert = nil_ptr;
-               } else if (!checkUTF8(src, NULL)) {
-                       ok = copy_report_error(&errors, (lng) i, -1, 
"incorrectly encoded UTF-8");
-                       to_insert = nil_ptr;
                } else {
                        ssize_t len = BATatoms[tpe].atomFromStr(ma, src, 
&buffer_len, &buffer, false);
                        if (len >= 0) {
@@ -328,10 +325,7 @@ COPYparse_string(Client cntxt, MalBlkPtr
        errors.r = r;
 
        const char *start = (char*)r->bs->buf[p->wid];
-       size_t nil_offset = 0;//r->bs->sz[p->wid]+2;
-       /*
-       parsed_bat = COLnew(0, TYPE_str, BATcount(offsets_bat), TRANSIENT);
-               */
+       size_t nil_offset = 0;
        parsed_bat = string_sharing_bat(BATcount(offsets_bat), start);
        if (!parsed_bat)
                bailout(fname, SQLSTATE(HY013) MAL_MALLOC_FAIL);
@@ -343,7 +337,6 @@ COPYparse_string(Client cntxt, MalBlkPtr
        for (BUN i = 0; i < n; i++) {
                gdk_return ok;
                int offset = offsetp[i];
-               //const void *to_insert = str_nil;
 
                if (is_int_nil(offset)) {
                        ok = GDK_SUCCEED;
@@ -360,7 +353,6 @@ COPYparse_string(Client cntxt, MalBlkPtr
                                ok = copy_report_error(&errors, (lng) i, -1, 
"field too long, max length is %d", colwidth);
                        } else {
                                ok = GDK_SUCCEED;
-                               //to_insert = src;
                        }
                }
                if (ok != GDK_SUCCEED) {
@@ -370,8 +362,6 @@ COPYparse_string(Client cntxt, MalBlkPtr
                        else
                                ok = GDK_SUCCEED;
                }
-               //if (bunfastapp_nocheck(parsed_bat, to_insert) != GDK_SUCCEED)
-               //      bailout("copy.parse_generic", GDK_EXCEPTION);
                offsetr[i] = offset;
        }
 
diff --git a/sql/backends/monet5/rel_copy.c b/sql/backends/monet5/rel_copy.c
--- a/sql/backends/monet5/rel_copy.c
+++ b/sql/backends/monet5/rel_copy.c
@@ -271,7 +271,7 @@ exp2bin_copyparpipe(backend *be, sql_exp
                                q = pushStr(mb, q, dec_skip);
                                pushInstruction(mb, q);
 
-               } else if (type->eclass == EC_STRING) {
+               } else if (type->eclass == EC_STRING || type->eclass == 
EC_CHAR) {
                                q = newStmt(mb, "copy", "parse_string");
                                q = pushArgument(mb, q, our_block);
                                q = pushArgument(mb, q, var_indices);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to