Changeset: c8ee548edc02 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8ee548edc02
Added Files:
sql/test/Tests/bincopycollist-prepare.bat
sql/test/Tests/bincopycollist-prepare.sh
sql/test/Tests/bincopycollist-prepare.stable.err
sql/test/Tests/bincopycollist-prepare.stable.out
sql/test/Tests/bincopycollist.reqtests
sql/test/Tests/bincopycollist.sql.in
sql/test/Tests/bincopycollist.stable.err
sql/test/Tests/bincopycollist.stable.out
Modified Files:
sql/backends/monet5/sql.c
sql/test/Tests/All
Branch: default
Log Message:
Add tests for binary copy into with column list.
diffs (truncated from 311 to 300 lines):
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
@@ -3737,7 +3737,7 @@ mvc_bin_import_table_wrap(Client cntxt,
}
if (init) {
for (i = pci->retc + 2, n = t->columns.set->h; i < pci->argc &&
n; i++, n = n->next) {
- // now that we know the BAT count, we can fill in the
columns for which no parameters were pasesd
+ // now that we know the BAT count, we can fill in the
columns for which no parameters were passed
sql_column *col = n->data;
BAT *c = NULL;
int tpe = col->type.type->localtype;
@@ -3746,6 +3746,7 @@ mvc_bin_import_table_wrap(Client cntxt,
if (strcmp(fname, str_nil) == 0) {
BUN loop = 0;
const void* nil = ATOMnilptr(tpe);
+ // fill the new BAT with NULL values
c = COLnew(0, tpe, cnt, PERSISTENT);
for(loop = 0; loop < cnt; loop++) {
BUNappend(c, nil, 0);
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -1,3 +1,7 @@
+
+bincopycollist-prepare
+bincopycollist
+
HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&HAVE_SHP&HAVE_NETCDF&HAVE_SAMTOOLS?systemfunctions
example
example-queries
diff --git a/sql/test/Tests/bincopycollist-prepare.bat
b/sql/test/Tests/bincopycollist-prepare.bat
new file mode 100755
--- /dev/null
+++ b/sql/test/Tests/bincopycollist-prepare.bat
@@ -0,0 +1,4 @@
+@prompt # $t $g
+@echo on
+
+copy "%TSTSRCDIR%\bincopyint.bin" "%TSTTRGDIR%"
diff --git a/sql/test/Tests/bincopycollist-prepare.sh
b/sql/test/Tests/bincopycollist-prepare.sh
new file mode 100755
--- /dev/null
+++ b/sql/test/Tests/bincopycollist-prepare.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+Mlog -x "cp $TSTSRCDIR/bincopyint.bin $TSTTRGDIR"
diff --git a/sql/test/Tests/bincopycollist-prepare.stable.err
b/sql/test/Tests/bincopycollist-prepare.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist-prepare.stable.err
@@ -0,0 +1,17 @@
+stderr of test 'bincopycollist-prepare` in directory 'sql/test` itself:
+
+
+# 17:03:22 >
+# 17:03:22 > "./bincopycollist-prepare.sh" "bincopycollist-prepare"
+# 17:03:22 >
+
+
+# 17:03:22 >
+# 17:03:22 > cp /Users/myth/Programs/MonetDB/sql/test/Tests/bincopyint.bin
/Users/myth/opt/mTests/sql/test
+# 17:03:22 >
+
+
+# 17:03:22 >
+# 17:03:22 > "Done."
+# 17:03:22 >
+
diff --git a/sql/test/Tests/bincopycollist-prepare.stable.out
b/sql/test/Tests/bincopycollist-prepare.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist-prepare.stable.out
@@ -0,0 +1,17 @@
+stdout of test 'bincopycollist-prepare` in directory 'sql/test` itself:
+
+
+# 17:03:22 >
+# 17:03:22 > "./bincopycollist-prepare.sh" "bincopycollist-prepare"
+# 17:03:22 >
+
+
+# 17:03:22 >
+# 17:03:22 > cp /Users/myth/Programs/MonetDB/sql/test/Tests/bincopyint.bin
/Users/myth/opt/mTests/sql/test
+# 17:03:22 >
+
+
+# 17:03:22 >
+# 17:03:22 > "Done."
+# 17:03:22 >
+
diff --git a/sql/test/Tests/bincopycollist.reqtests
b/sql/test/Tests/bincopycollist.reqtests
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist.reqtests
@@ -0,0 +1,1 @@
+bincopycollist-prepare
diff --git a/sql/test/Tests/bincopycollist.sql.in
b/sql/test/Tests/bincopycollist.sql.in
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist.sql.in
@@ -0,0 +1,29 @@
+START TRANSACTION;
+
+CREATE TABLE intvals (x INTEGER, y INTEGER, z INTEGER);
+
+# pass in all columns
+COPY BINARY INTO intvals (x, y, z) FROM ('$QTSTTRGDIR/bincopyint.bin',
'$QTSTTRGDIR/bincopyint.bin', '$QTSTTRGDIR/bincopyint.bin');
+# pass in partial set of columns
+COPY BINARY INTO intvals (z) FROM ('$QTSTTRGDIR/bincopyint.bin');
+# multiple columns
+COPY BINARY INTO intvals (z, y) FROM ('$QTSTTRGDIR/bincopyint.bin',
'$QTSTTRGDIR/bincopyint.bin');
+SELECT * FROM intvals;
+
+ROLLBACK;
+
+START TRANSACTION;
+CREATE TABLE intvals (x INTEGER, y INTEGER, z INTEGER);
+
+# duplicate columns
+COPY BINARY INTO intvals (x, x) FROM ('$QTSTTRGDIR/bincopyint.bin',
'$QTSTTRGDIR/bincopyint.bin');
+SELECT * FROM intvals;
+ROLLBACK;
+
+
+START TRANSACTION;
+CREATE TABLE intvals (x INTEGER, y INTEGER, z INTEGER);
+
+# unknown columns
+COPY BINARY INTO intvals (a) FROM ('$QTSTTRGDIR/bincopyint.bin');
+ROLLBACK;
diff --git a/sql/test/Tests/bincopycollist.stable.err
b/sql/test/Tests/bincopycollist.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'bincopycollist` in directory 'sql/test` itself:
+
+
+# 17:04:52 >
+# 17:04:52 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34187" "--set"
"mapi_usock=/var/tmp/mtest-69867/.s.monetdb.34187" "--set" "monet_prompt="
"--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_test"
+# 17:04:52 >
+
+# builtin opt gdk_dbpath = /Users/myth/opt/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 34187
+# cmdline opt mapi_usock = /var/tmp/mtest-69867/.s.monetdb.34187
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath = /Users/myth/opt/var/MonetDB/mTests_sql_test
+# cmdline opt gdk_debug = 536870922
+
+# 17:04:52 >
+# 17:04:52 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-69867" "--port=34187"
+# 17:04:52 >
+
+MAPI = (monetdb) /var/tmp/mtest-69867/.s.monetdb.34187
+QUERY = COPY BINARY INTO intvals (a) FROM
('/Users/myth/opt/mTests/sql/test/bincopyint.bin');
+ERROR = !COPY BINARY INTO: no such column 'intvals.a'
+
+# 17:04:53 >
+# 17:04:53 > "Done."
+# 17:04:53 >
+
diff --git a/sql/test/Tests/bincopycollist.stable.out
b/sql/test/Tests/bincopycollist.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/bincopycollist.stable.out
@@ -0,0 +1,132 @@
+stdout of test 'bincopycollist` in directory 'sql/test` itself:
+
+
+# 17:04:52 >
+# 17:04:52 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34187" "--set"
"mapi_usock=/var/tmp/mtest-69867/.s.monetdb.34187" "--set" "monet_prompt="
"--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_test"
+# 17:04:52 >
+
+# MonetDB 5 server v11.24.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test', using 4 threads
+# Compiled for x86_64-apple-darwin15.6.0/64bit with 128bit integers
+# Found 8.000 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2016 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on
mapi:monetdb://dhcp-154.eduroam.cwi.nl:34187/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-69867/.s.monetdb.34187
+# MonetDB/SQL module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+# loading sql script: 09_like.sql
+# loading sql script: 10_math.sql
+# loading sql script: 11_times.sql
+# loading sql script: 12_url.sql
+# loading sql script: 13_date.sql
+# loading sql script: 14_inet.sql
+# loading sql script: 15_querylog.sql
+# loading sql script: 16_tracelog.sql
+# loading sql script: 17_temporal.sql
+# loading sql script: 18_index.sql
+# loading sql script: 20_vacuum.sql
+# loading sql script: 21_dependency_functions.sql
+# loading sql script: 22_clients.sql
+# loading sql script: 23_skyserver.sql
+# loading sql script: 25_debug.sql
+# loading sql script: 26_sysmon.sql
+# loading sql script: 27_rejects.sql
+# loading sql script: 39_analytics.sql
+# loading sql script: 39_analytics_hge.sql
+# loading sql script: 40_json.sql
+# loading sql script: 40_json_hge.sql
+# loading sql script: 41_md5sum.sql
+# loading sql script: 45_uuid.sql
+# loading sql script: 46_profiler.sql
+# loading sql script: 51_sys_schema_extension.sql
+# loading sql script: 72_fits.sql
+# loading sql script: 74_netcdf.sql
+# loading sql script: 75_storagemodel.sql
+# loading sql script: 80_statistics.sql
+# loading sql script: 80_udf.sql
+# loading sql script: 80_udf_hge.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 17:04:52 >
+# 17:04:52 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-69867" "--port=34187"
+# 17:04:52 >
+
+#START TRANSACTION;
+#CREATE TABLE intvals (x INTEGER, y INTEGER, z INTEGER);
+#COPY BINARY INTO intvals (x, y, z) FROM
('/Users/myth/opt/mTests/sql/test/bincopyint.bin',
'/Users/myth/opt/mTests/sql/test/bincopyint.bin',
'/Users/myth/opt/mTests/sql/test/bincopyint.bin');
+[ 10 ]
+#COPY BINARY INTO intvals (z) FROM
('/Users/myth/opt/mTests/sql/test/bincopyint.bin');
+[ 10 ]
+#COPY BINARY INTO intvals (z, y) FROM
('/Users/myth/opt/mTests/sql/test/bincopyint.bin',
'/Users/myth/opt/mTests/sql/test/bincopyint.bin');
+[ 10 ]
+#SELECT * FROM intvals;
+% sys.intvals, sys.intvals, sys.intvals # table_name
+% x, y, z # name
+% int, int, int # type
+% 1, 1, 1 # length
+[ 0, 0, 0 ]
+[ 1, 1, 1 ]
+[ 2, 2, 2 ]
+[ 3, 3, 3 ]
+[ 4, 4, 4 ]
+[ 5, 5, 5 ]
+[ 6, 6, 6 ]
+[ 7, 7, 7 ]
+[ 8, 8, 8 ]
+[ 9, 9, 9 ]
+[ NULL, NULL, 0 ]
+[ NULL, NULL, 1 ]
+[ NULL, NULL, 2 ]
+[ NULL, NULL, 3 ]
+[ NULL, NULL, 4 ]
+[ NULL, NULL, 5 ]
+[ NULL, NULL, 6 ]
+[ NULL, NULL, 7 ]
+[ NULL, NULL, 8 ]
+[ NULL, NULL, 9 ]
+[ NULL, 0, 0 ]
+[ NULL, 1, 1 ]
+[ NULL, 2, 2 ]
+[ NULL, 3, 3 ]
+[ NULL, 4, 4 ]
+[ NULL, 5, 5 ]
+[ NULL, 6, 6 ]
+[ NULL, 7, 7 ]
+[ NULL, 8, 8 ]
+[ NULL, 9, 9 ]
+#ROLLBACK;
+#START TRANSACTION;
+#CREATE TABLE intvals (x INTEGER, y INTEGER, z INTEGER);
+#COPY BINARY INTO intvals (x, x) FROM
('/Users/myth/opt/mTests/sql/test/bincopyint.bin',
'/Users/myth/opt/mTests/sql/test/bincopyint.bin');
+[ 10 ]
+#SELECT * FROM intvals;
+% sys.intvals, sys.intvals, sys.intvals # table_name
+% x, y, z # name
+% int, int, int # type
+% 1, 1, 1 # length
+[ 0, NULL, NULL ]
+[ 1, NULL, NULL ]
+[ 2, NULL, NULL ]
+[ 3, NULL, NULL ]
+[ 4, NULL, NULL ]
+[ 5, NULL, NULL ]
+[ 6, NULL, NULL ]
+[ 7, NULL, NULL ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list