Hey Stefano,
Could you make a reproducible example? The trivial example I made using the UDF you provided does not result in a segfault. This is the example I tested:
CREATE TABLE mytable(i DOUBLE, d DOUBLE);
INSERT INTO mytable VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
CREATE FUNCTION myfunc() RETURNS TABLE(n STRING) LANGUAGE PYTHON_MAP {
res = _conn.execute("SELECT max(d) FROM mytable;")
result = dict()
result['n'] = str(res)
return result
};
SELECT * FROM myfunc();
Which gives the following (expected) result:
+----------------------+
| n |
+======================+
| {'L1': array([ 5.])} |
+----------------------+
Regards,
Mark
----- Original Message -----
From: "Stefano Fioravanzo"
On 06 Jun 2016, at 10:43, Stefan Manegold
wrote: Dear Stefano,
a segfault is always a bug. Please file a bug report via http://bugs.monetdb.org/
Thanks! Stefan
----- On Jun 6, 2016, at 10:38 AM, Stefano Fioravanzo fioravanzos@gmail.com wrote:
Hello,
I am trying to execute a loopback query in embedded python:
CREATE FUNCTION myfunc() RETURNS TABLE(n STRING) LANGUAGE PYTHON { res = _conn.execute("SELECT max(d) FROM mytable;")
result = dict() result['n'] = str(res) return result };
When accessing the object ‘res’, mserver5 outputs ‘segmentation fault’ and exits. I think that the issue is in using the max() function in the query, if I leave that out everything works fine. The function:
CREATE FUNCTION myfunc() RETURNS TABLE(n STRING) LANGUAGE PYTHON { res = _conn.execute("SELECT d FROM mytable;")
result = dict() result['n'] = str(res) return result };
outputs a correct dictionary.
Stefano _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list