Changeset: 11613fabc70f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=11613fabc70f
Modified Files:
        gdk/gdk_bbp.c
        monetdb5/modules/mal/tablet.c
        sql/test/copy/Tests/int_parse.stable.err
        sql/test/copy/Tests/int_parse.stable.out
        sql/test/copy/Tests/int_parse_best.stable.out
        sql/test/pg_regress/Tests/strings.stable.err.int128
        sql/test/pg_regress/Tests/strings.stable.out
Branch: Jul2015
Log Message:

fixed handling of NULL as ''.


diffs (264 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3530,6 +3530,10 @@ BBPsync(int cnt, bat *subcommit)
                        backup_dir = backup_subdir = 0;
                        (void) GDKremovedir(0, DELDIR);
                        (void) BBPprepare(0);   /* (try to) remove DELDIR and 
set up new BAKDIR */
+                       if (backup_files > 1) {
+                               PERFDEBUG fprintf(stderr, "%d\n", backup_files);
+                               backup_files = 1;
+                       }
                }
        }
        PERFDEBUG fprintf(stderr, "#BBPsync (ready time %d)\n", (t0 = GDKms()) 
- t1);
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -969,7 +969,7 @@ SQLload_parse_line(READERtask *task, int
        char *line = task->lines[task->cur][idx];
        Tablet *as = task->as;
        Column *fmt = as->format;
-       int error = 0, skip;
+       int error = 0;
        str errline = 0;
 
 #ifdef _DEBUG_TABLET_
@@ -982,10 +982,8 @@ SQLload_parse_line(READERtask *task, int
        if (task->quote || task->seplen != 1) {
                for (i = 0; i < as->nr_attrs; i++) {
                        task->fields[i][idx] = line;
-                       skip = 0;
                        /* recognize fields starting with a quote, keep them */
                        if (*line == task->quote) {
-                               skip = 1;
 #ifdef _DEBUG_TABLET_
                                mnstr_printf(GDKout, "before #1 %s\n", s = 
line);
 #endif
@@ -1032,7 +1030,7 @@ SQLload_parse_line(READERtask *task, int
                  endoffieldcheck:
                        ;
                        /* check for user defined NULL string */
-                       if (!skip && fmt->nullstr && task->fields[i][idx] && 
strncasecmp(task->fields[i][idx], fmt->nullstr, fmt->null_length + 1) == 0)
+                       if (!fmt->skip && fmt->nullstr && task->fields[i][idx] 
&& strncasecmp(task->fields[i][idx], fmt->nullstr, fmt->null_length + 1) == 0)
                                task->fields[i][idx] = 0;
                }
 #ifdef _DEBUG_TABLET_
diff --git a/sql/test/copy/Tests/int_parse.stable.err 
b/sql/test/copy/Tests/int_parse.stable.err
--- a/sql/test/copy/Tests/int_parse.stable.err
+++ b/sql/test/copy/Tests/int_parse.stable.err
@@ -30,17 +30,13 @@ stderr of test 'int_parse` in directory 
 # 11:23:33 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-4649" "--port=31080"
 # 11:23:33 >  
 
-MAPI  = (monetdb) /var/tmp/mtest-18609/.s.monetdb.32538
-QUERY = copy 1 records into t_int from stdin USING DELIMITERS ',','\n','\"' 
NULL AS '';
-        ""
-ERROR = !Failed to import table line 1 field 1 'int' expected in ''
-MAPI  = (monetdb) /var/tmp/mtest-18609/.s.monetdb.32538
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = copy 3 records into t_int from stdin USING DELIMITERS ',','\n','\"' 
NULL AS '';
         0
         5.1
         9
 ERROR = !Failed to import table line 2 field 1 'int' expected in '5.1'
-MAPI  = (monetdb) /var/tmp/mtest-18609/.s.monetdb.32538
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = copy 5 records into t_int from stdin delimiters ',','\n' NULL as '';
         1
         nil
diff --git a/sql/test/copy/Tests/int_parse.stable.out 
b/sql/test/copy/Tests/int_parse.stable.out
--- a/sql/test/copy/Tests/int_parse.stable.out
+++ b/sql/test/copy/Tests/int_parse.stable.out
@@ -25,13 +25,17 @@ Ready.
 # 13:54:35 >  
 
 #create table t_int(i int);
+#copy 1 records into t_int from stdin USING DELIMITERS ',','\n','\"' NULL AS 
'';
+#""
+[ 1    ]
 #select * from t_int;
 % sys.t_int # table_name
 % i # name
 % int # type
 % 1 # length
+[ NULL ]
 #delete from t_int;
-[ 0    ]
+[ 1    ]
 #copy 2 records into t_int from stdin USING DELIMITERS ',','\n','\"' NULL AS 
'';
 #3.00
 #-4.0000
diff --git a/sql/test/copy/Tests/int_parse_best.stable.out 
b/sql/test/copy/Tests/int_parse_best.stable.out
--- a/sql/test/copy/Tests/int_parse_best.stable.out
+++ b/sql/test/copy/Tests/int_parse_best.stable.out
@@ -62,20 +62,20 @@ Ready.
 #create table t_int(i int);
 #copy 1 records into t_int from stdin USING DELIMITERS ',','\n','\"' NULL AS 
'' best effort;
 #""
-[ 0    ]
+[ 1    ]
 #select * from t_int;
 % sys.t_int # table_name
 % i # name
 % int # type
 % 1 # length
+[ NULL ]
 #select * from sys.rejects;
 % .rejects,    .rejects,       .rejects,       .rejects # table_name
 % rowid,       fldid,  message,        input # name
 % bigint,      int,    clob,   clob # type
-% 1,   1,      14,     1 # length
-[ 1,   1,      "'int' expected",       "\n"    ]
+% 1,   1,      0,      0 # length
 #delete from t_int;
-[ 0    ]
+[ 1    ]
 #copy 2 records into t_int from stdin USING DELIMITERS ',','\n','\"' NULL AS 
'' best effort;
 #3.00
 #-4.0000
diff --git a/sql/test/pg_regress/Tests/strings.stable.err.int128 
b/sql/test/pg_regress/Tests/strings.stable.err.int128
--- a/sql/test/pg_regress/Tests/strings.stable.err.int128
+++ b/sql/test/pg_regress/Tests/strings.stable.err.int128
@@ -29,70 +29,58 @@ stderr of test 'strings` in directory 's
 # 17:11:19 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-1142" "--port=38959"
 # 17:11:19 >  
 
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM 'a#"(b_d)#"%' FOR '#') AS "bcd";
 ERROR = !conversion of string 'a#"(b_d)#"%' to type int failed.
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM '#"(b_d)#"%' FOR '#') IS NULL AS 
"True";
 ERROR = !conversion of string '#"(b_d)#"%' to type int failed.
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM '(b|c)' FOR NULL) IS NULL AS "True";
 ERROR = !syntax error, unexpected sqlNULL in: "select substring('abcdefg' from 
'(b|c)' for null"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING(NULL FROM '(b|c)' FOR '#') IS NULL AS "True";
 ERROR = !syntax error, unexpected sqlNULL in: "select substring(null"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM NULL FOR '#') IS NULL AS "True";
 ERROR = !syntax error, unexpected sqlNULL in: "select substring('abcdefg' from 
null"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM 'c.e') AS "cde";
 ERROR = !conversion of string 'c.e' to type int failed.
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT SUBSTRING('abcdefg' FROM 'b(.*)f') AS "cde";
 ERROR = !conversion of string 'b(.*)f' to type int failed.
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
 ERROR = !syntax error, unexpected IDENT, expecting ')' or ',' in: "select 
overlay('abcdef' placing"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5) AS "yabadaba";
 ERROR = !syntax error, unexpected IDENT, expecting ')' or ',' in: "select 
overlay('yabadoo' placing"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5 FOR 0) AS "yabadabadoo";
 ERROR = !syntax error, unexpected IDENT, expecting ')' or ',' in: "select 
overlay('yabadoo' placing"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = SELECT OVERLAY('babosa' PLACING 'ubb' FROM 2 FOR 4) AS "bubba";
 ERROR = !syntax error, unexpected IDENT, expecting ')' or ',' in: "select 
overlay('babosa' placing"
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = insert into toasttest 
values(decode(repeat('1234567890',10000),'escape'));
 ERROR = !SELECT: no such binary operator 'decode(char,char)'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = insert into toasttest 
values(decode(repeat('1234567890',10000),'escape'));
 ERROR = !SELECT: no such binary operator 'decode(char,char)'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = insert into toasttest 
values(decode(repeat('1234567890',10000),'escape'));
 ERROR = !SELECT: no such binary operator 'decode(char,char)'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = insert into toasttest 
values(decode(repeat('1234567890',10000),'escape'));
 ERROR = !SELECT: no such binary operator 'decode(char,char)'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = select split_part('joeuser@mydatabase','@',0) AS "an error";
-ERROR = !SELECT: no such operator 'split_part'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
-QUERY = select split_part('joeuser@mydatabase','@',1) AS "joeuser";
-ERROR = !SELECT: no such operator 'split_part'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
-QUERY = select split_part('joeuser@mydatabase','@',2) AS "mydatabase";
-ERROR = !SELECT: no such operator 'split_part'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
-QUERY = select split_part('joeuser@mydatabase','@',3) AS "empty string";
-ERROR = !SELECT: no such operator 'split_part'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
-QUERY = select split_part('@joeuser@mydatabase@','@',2) AS "joeuser";
-ERROR = !SELECT: no such operator 'split_part'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+ERROR = !field position must be greater than zero
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = select to_hex(256*256*256 - 1) AS "ffffff";
 ERROR = !SELECT: no such unary operator 'to_hex(hugeint)'
-MAPI  = (monetdb) /var/tmp/mtest-29915/.s.monetdb.37487
+MAPI  = (monetdb) /var/tmp/mtest-8167/.s.monetdb.37816
 QUERY = select to_hex(cast(256 as bigint)*cast(256 as bigint)*cast(256 as 
bigint)*cast(256 as bigint) - 1) AS "ffffffff";
 ERROR = !SELECT: no such unary operator 'to_hex(hugeint)'
 
diff --git a/sql/test/pg_regress/Tests/strings.stable.out 
b/sql/test/pg_regress/Tests/strings.stable.out
--- a/sql/test/pg_regress/Tests/strings.stable.out
+++ b/sql/test/pg_regress/Tests/strings.stable.out
@@ -689,24 +689,48 @@ Ready.
 % char # type
 % 0 # length
 [ "yaoo" ]
+#select split_part('joeuser@mydatabase','@',1) AS "joeuser";
+% .L # table_name
+% joeuser # name
+% char # type
+% 18 # length
+[ "joeuser"    ]
 #select substring('joeuser@mydatabase', 0, locate('@','joeuser@mydatabase', 0) 
-1) AS "joeuser";
 % .L # table_name
 % joeuser # name
 % char # type
 % 18 # length
 [ "joeuser"    ]
+#select split_part('joeuser@mydatabase','@',2) AS "mydatabase";
+% .L # table_name
+% mydatabase # name
+% char # type
+% 18 # length
+[ "mydatabase" ]
 #select substring('joeuser@mydatabase', locate('@','joeuser@mydatabase', 0) 
+1) AS "mydatabase";
 % .L # table_name
 % mydatabase # name
 % char # type
 % 18 # length
 [ "mydatabase" ]
+#select split_part('joeuser@mydatabase','@',3) AS "empty string";
+% .L # table_name
+% empty string # name
+% char # type
+% 18 # length
+[ ""   ]
 #select substring('joeuser@mydatabase', locate('@','joeuser@mydatabase', 1) 
+1, locate('@','joeuser@mydatabase', 2) -1) AS "empty string";
 % .L # table_name
 % empty string # name
 % char # type
 % 18 # length
 [ "mydatab"    ]
+#select split_part('@joeuser@mydatabase@','@',2) AS "joeuser";
+% .L # table_name
+% joeuser # name
+% char # type
+% 18 # length
+[ "joeuser"    ]
 #select substring('@joeuser@mydatabase@', locate('@','@joeuser@mydatabase@', 
0) +1, locate('@','@joeuser@mydatabase@', 1) -1) AS "joeuser";
 % .L # table_name
 % joeuser # name
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to