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

Using 'with' keyword with table returning function crashes monetdb #6444

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2017-10-24 14:37:02 +0200
From: @rkoopmanschap
To: SQL devs <>
Version: 11.27.5 (Jul2017-SP1)
CC: @njnes

Last updated: 2017-12-14 14:46:04 +0100

Comment 25784

Date: 2017-10-24 14:37:02 +0200
From: @rkoopmanschap

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Build Identifier:

The code below crashes, it seems to be caused by using 'with' in combination with a table returning function.

Reproducible: Always

Steps to Reproduce:

-- Run the following code, make sure python UDFs are enabled:

-- Create input table
CREATE TABLE test_table(x STRING, y STRING, z STRING);
INSERT INTO test_table VALUES ('test value 1', 'test value 2', 'test value 3');

-- Create test function
CREATE FUNCTION test_function(x STRING, y STRING, z STRING) RETURNS TABLE(a STRING, b STRING, c FLOAT) LANGUAGE PYTHON {
result = dict()
result['a'] = ['test value a']
result['b'] = ['test value b']
result['c'] = [3]

 return result

};

-- Failing query
CREATE TABLE results_table AS (
WITH test_table_tmp AS (
SELECT * FROM test_table
)
SELECT * FROM test_function(test_table_tmp.x, test_table_tmp.y, test_table_tmp.z)
);

SELECT * FROM results_table;

Actual Results:

MonetDB crashes on linux and hangs on a mac.

Expected Results:

+--------------+--------------+--------------------------+
| a | b | c |
+==============+==============+==========================+
| test value a | test value b | 3 |
+--------------+--------------+--------------------------+
1 tuple (1.324ms)

A possible workaround for this would be to change the query to:

CREATE TABLE results_table AS (
SELECT * FROM test_function( (select x, y, z FROM test_table ) )
);

This query does work and returns the correct results. The failing query should be equivalent however.

Comment 25799

Date: 2017-10-25 11:24:14 +0200
From: MonetDB Mercurial Repository <>

Changeset 813fd7d13da9 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=813fd7d13da9

Changeset description:

fixed crash in bug #6444

Comment 25800

Date: 2017-10-25 11:25:21 +0200
From: @njnes

fixed crash, so we now get an error. But the 2 queries are not equivalent

Comment 25803

Date: 2017-10-26 07:56:36 +0200
From: MonetDB Mercurial Repository <>

Changeset 5e59ce515a5b made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=5e59ce515a5b

Changeset description:

fixed bugs 6444, 6445

Comment 25808

Date: 2017-10-26 14:21:34 +0200
From: MonetDB Mercurial Repository <>

Changeset d245a7b07594 made by Richard Koopmanschap richard.koopmanschap@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=d245a7b07594

Changeset description:

Added tests for bug #6444 and 6448

Comment 25810

Date: 2017-10-26 15:41:08 +0200
From: MonetDB Mercurial Repository <>

Changeset 96ff384f1c07 made by Richard Koopmanschap richard.koopmanschap@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=96ff384f1c07

Changeset description:

Added tests for bugs 6444 and 6448
@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants