Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Function call bug #4035

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

SQL Function call bug #4035

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2016-07-06 15:22:33 +0200
From: @PedroTadim
To: SQL devs <>
Version: 11.23.3 (Jun2016)

Last updated: 2016-07-22 09:56:16 +0200

Comment 22238

Date: 2016-07-06 15:22:33 +0200
From: @PedroTadim

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36
Build Identifier:

Created a SQL function that uses geospatial extension to make a geographic to Cartesian coordinates conversion.

Reproducible: Always

Steps to Reproduce:

CREATE FUNCTION geographic_to_cartesian(lat FLOAT, lon FLOAT) RETURNS POINT /* convert geographic coordinates to Cartesian while creating a point */
BEGIN
DECLARE deg_to_rad FLOAT, lat_rad FLOAT, lon_rad FLOAT, aux1 FLOAT, aux2 FLOAT;
SET deg_to_rad = pi() / 180;
SET lat_rad = lat * deg_to_rad;
SET lon_rad = lon * deg_to_rad;
SET aux1 = sys.cos(lat_rad);
SET aux2 = 6371 * aux1;
RETURN sys.st_makepoint(aux2 * sys.cos(lon_rad), aux2 * sys.sin(lon_rad), 6371 * sys.sin(lat_rad));
END;

CREATE TABLE test_table (lat FLOAT, lon FLOAT);

SELECT geographic_to_cartesian(lat, lon) AS calc_point FROM test_table;

Actual Results:

The client crashes.

Expected Results:

The query result, a table with a single column showing the results of the function call.

The client breaks after performing the select query, and the log message:

2016-07-06 13:54:35 ERR iotdb[15513]: mserver5: ../../gdk/gdk.h:2494: BBPcheck: Assertion `x > 0' failed.

I reproduced it on the default branch, and it happens whatever the table has rows on it or not.

Comment 22239

Date: 2016-07-06 16:47:34 +0200
From: @sjoerdmullender

It looks like the geom.MakePoint implementation is called but interpreted as if it is batgeom.MakePoint. This means that the return value is interpreted incorrectly as BAT id, and that causes the crash.

Comment 22243

Date: 2016-07-11 16:46:58 +0200
From: MonetDB Mercurial Repository <>

Changeset ae042233e063 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=ae042233e063

Changeset description:

Fix and test for bug #4035.
When testing whether a bulk version exists of a MAL function, the
MAL function body needs to be zapped.

Comment 22244

Date: 2016-07-11 17:36:49 +0200
From: @sjoerdmullender

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant