Changeset: f287b734e603 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f287b734e603
Added Files:
sql/test/BugTracker-2017/Tests/real-power.Bug-6228.sql
sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.err
sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.out
Modified Files:
monetdb5/optimizer/opt_support.c
sql/backends/monet5/Tests/All
sql/backends/monet5/Tests/pyloader06.stable.out
sql/backends/monet5/Tests/pyloader07.stable.out
sql/backends/monet5/UDF/pyapi/emit.c
sql/backends/monet5/sql_scenario.c
sql/server/rel_exp.c
sql/test/BugTracker-2017/Tests/All
Branch: default
Log Message:
Merge with Dec2016 branch.
diffs (251 lines):
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -143,8 +143,10 @@ optimizeMALBlock(Client cntxt, MalBlkPtr
msg = (str) (*p->fcn) (cntxt, mb, 0, p);
if (msg) {
str place = getExceptionPlace(msg);
- msg=
createException(getExceptionType(msg), place, "%s", getExceptionMessage(msg));
+ str nmsg=
createException(getExceptionType(msg), place, "%s", getExceptionMessage(msg));
GDKfree(place);
+ GDKfree(msg);
+ msg = nmsg;
goto wrapup;
}
if (cntxt->mode == FINISHCLIENT)
diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All
--- a/sql/backends/monet5/Tests/All
+++ b/sql/backends/monet5/Tests/All
@@ -61,6 +61,7 @@ HAVE_LIBPY?pyloader04
HAVE_LIBPY?pyloader05
HAVE_LIBPY?pyloader06
HAVE_LIBPY?pyloader07
+HAVE_LIBPY?pyloader08
HAVE_LIBPY?createorreplace
diff --git a/sql/backends/monet5/Tests/pyloader06.stable.out
b/sql/backends/monet5/Tests/pyloader06.stable.out
--- a/sql/backends/monet5/Tests/pyloader06.stable.out
+++ b/sql/backends/monet5/Tests/pyloader06.stable.out
@@ -73,7 +73,7 @@ Ready.
#SELECT * FROM pyloader06table;
% sys.pyloader06table, sys.pyloader06table, sys.pyloader06table # table_name
% a, c, b # name
-% int, int, int # type
+% bigint, bigint, bigint # type
% 1, 1, 1 # length
[ 1, 3, 2 ]
#ROLLBACK;
diff --git a/sql/backends/monet5/Tests/pyloader07.stable.out
b/sql/backends/monet5/Tests/pyloader07.stable.out
--- a/sql/backends/monet5/Tests/pyloader07.stable.out
+++ b/sql/backends/monet5/Tests/pyloader07.stable.out
@@ -69,7 +69,7 @@ Ready.
#SELECT * FROM pyloader07table;
% sys.pyloader07table, sys.pyloader07table # table_name
% s, t # name
-% int, int # type
+% bigint, bigint # type
% 2, 2 # length
[ 33, 42 ]
#DROP TABLE pyloader07table;
diff --git a/sql/backends/monet5/UDF/pyapi/emit.c
b/sql/backends/monet5/UDF/pyapi/emit.c
--- a/sql/backends/monet5/UDF/pyapi/emit.c
+++ b/sql/backends/monet5/UDF/pyapi/emit.c
@@ -142,7 +142,22 @@ PyEmit_Emit(PyEmitObject *self, PyObject
}
if (!found) {
// unrecognized column, create the column in the table
- self->cols[self->ncols].b = COLnew(0, TYPE_int, 0, TRANSIENT);
+ // first infer the type from the value
+ // we use NumPy for this by creating an array from the object
+ // without specifying the type
+ PyObject* value = PyDict_GetItem(args, key);
+ PyObject* array = PyArray_FromAny(value, NULL, 0, 0,
NPY_ARRAY_CARRAY | NPY_ARRAY_FORCECAST, NULL);
+ PyArray_Descr* array_type = NULL;
+ int bat_type = TYPE_int;
+ if (!array) {
+ PyErr_Format(PyExc_TypeError, "Failed to create NumPy
array.");
+ return NULL;
+ }
+ array_type = (PyArray_Descr*)
PyArray_DESCR((PyArrayObject*)array);
+ bat_type = PyType_ToBat(array_type->type_num);
+ Py_DECREF(array);
+
+ self->cols[self->ncols].b = COLnew(0, bat_type, 0, TRANSIENT);
self->cols[self->ncols].name = GDKstrdup(val);
if (self->nvals > 0) {
// insert NULL values up until the current entry
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1146,7 +1146,7 @@ SQLparser(Client c)
/* in case we had produced a non-cachable plan, the optimizer
should be called */
if (opt ) {
- str msg = SQLoptimizeQuery(c, c->curprg->def);
+ msg = SQLoptimizeQuery(c, c->curprg->def);
if (msg != MAL_SUCCEED) {
sqlcleanup(m, err);
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -319,7 +319,7 @@ exp_atom_flt(sql_allocator *sa, flt f)
{
sql_subtype it;
- sql_find_subtype(&it, "double", 24, 0);
+ sql_find_subtype(&it, "real", 24, 0);
return exp_atom(sa, atom_float(sa, &it, (dbl)f ));
}
diff --git a/sql/test/BugTracker-2017/Tests/All
b/sql/test/BugTracker-2017/Tests/All
--- a/sql/test/BugTracker-2017/Tests/All
+++ b/sql/test/BugTracker-2017/Tests/All
@@ -29,3 +29,4 @@ prepare.Bug-6133
null-quantile.Bug-6218
sqlsmith.Bug-6216
sqlsmith.Bug-6217
+real-power.Bug-6228
diff --git a/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.sql
b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.sql
@@ -0,0 +1,7 @@
+start transaction;
+
+create table rt (x real);
+insert into rt values (2.1);
+select x*x from rt;
+
+rollback;
diff --git a/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.err
b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.err
@@ -0,0 +1,36 @@
+stderr of test 'real-power.Bug-6228` in directory 'sql/test/BugTracker-2017`
itself:
+
+
+# 16:50:41 >
+# 16:50:41 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34063" "--set"
"mapi_usock=/var/tmp/mtest-15026/.s.monetdb.34063" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017"
"--set" "embedded_r=yes" "--set" "embedded_py=true"
+# 16:50:41 >
+
+# builtin opt gdk_dbpath = /ufs/sjoerd/Monet-stable/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 = 34063
+# cmdline opt mapi_usock = /var/tmp/mtest-15026/.s.monetdb.34063
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath =
/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017
+# cmdline opt embedded_r = yes
+# cmdline opt embedded_py = true
+# cmdline opt gdk_debug = 536870922
+
+# 16:50:41 >
+# 16:50:41 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-15026" "--port=34063"
+# 16:50:41 >
+
+
+# 16:50:42 >
+# 16:50:42 > "Done."
+# 16:50:42 >
+
diff --git a/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.out
b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/real-power.Bug-6228.stable.out
@@ -0,0 +1,84 @@
+stdout of test 'real-power.Bug-6228` in directory 'sql/test/BugTracker-2017`
itself:
+
+
+# 16:50:41 >
+# 16:50:41 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34063" "--set"
"mapi_usock=/var/tmp/mtest-15026/.s.monetdb.34063" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017"
"--set" "embedded_r=yes" "--set" "embedded_py=true"
+# 16:50:41 >
+
+# MonetDB 5 server v11.25.8 (hg id: c961e87717e5+)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2017', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:34063/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-15026/.s.monetdb.34063
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/Python module loaded
+# MonetDB/R 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_geom.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_gsl.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_lidar.sql
+# loading sql script: 75_shp.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: 85_bam.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 16:50:41 >
+# 16:50:41 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-15026" "--port=34063"
+# 16:50:41 >
+
+#start transaction;
+#create table rt (x real);
+#insert into rt values (2.1);
+[ 1 ]
+#select x*x from rt;
+% sys.L2 # table_name
+% L2 # name
+% real # type
+% 15 # length
+[ 4.41 ]
+#rollback;
+
+# 16:50:42 >
+# 16:50:42 > "Done."
+# 16:50:42 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list