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 execution fails to finish and reports bogus error messages #3842

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

SQL execution fails to finish and reports bogus error messages #3842

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

Comments

@monetdb-team
Copy link

Date: 2015-10-29 07:58:30 +0100
From: darkbluehacker
To: SQL devs <>
Version: 11.21.11 (Jul2015-SP1)
CC: chenkaijiang, darkbluehacker, @mlkersten, @njnes

Last updated: 2016-01-15 11:38:18 +0100

Comment 21418

Date: 2015-10-29 07:58:30 +0100
From: darkbluehacker

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
Build Identifier:

using column of table in user defined fuction will cause execution failure and bogus error message reported.

Reproducible: Always

Steps to Reproduce:

  1. unzip the attached fn_bug.tgz
  2. create tables 'test_fn' and 'chg' using tables.sql
  3. import data in test_fn.out to 'test_fn' table and import data in chg.out to 'chg' table;
  4. create user defined function Get_r using monetdb.udf.sql
  5. select count(*) from test_fn where get_r(c1, '01', '2015-08-31 23:59:59')>1.0;

Actual Results:

get error messages like: Function '..P*' not defined. (NOTE: the function name is bogus and keeps changing every time)

Expected Results:

get the count of the qualified rows.

Comment 21419

Date: 2015-10-29 08:00:57 +0100
From: darkbluehacker

Created attachment 364
sql and data to reproduce the bug

sql and data to reproduce the bug can be found in attached file.

Attached file: fn_bug.tgz (application/x-compressed, 630950 bytes)
Description: sql and data to reproduce the bug

Comment 21477

Date: 2015-11-08 11:01:29 +0100
From: @mlkersten

CREATE INDEX "chg_t_effc_tm" ON "sys"."ods_chg" ("t_effc_tm");

is not defined in the test scripts.

For the trimmed down version (4 tuples in each table) the problem
reported is:

Function 'calc.>=' not defined

This hints at an error in the UDF, which indeed attempts to execute:
X_141:bat[:oid,:bit] := mal.multiplex("calc","<=",X_132,X_140);

X_132 and X_140 are timestamps and the system only supports mtime.<=.

The issue is that this is not properly handled during the optimizer phase,
which leads to calling the default implementation, that throws an error.

Bug added as file BugTracker-2015/Tests/missed-error.Bug-3842.sql

Comment 21506

Date: 2015-11-11 09:22:21 +0100
From: @sjoerdmullender

(In reply to darkbluehacker from comment 0)

get error messages like: Function '..P*' not defined. (NOTE: the function
name is bogus and keeps changing every time)

This part of the bug has been fixed in changeset 982c835b3f2b

Comment 21601

Date: 2015-11-26 15:55:06 +0100
From: Kaijiang <>

Is there any progress on this bug?

Comment 21625

Date: 2015-12-02 07:36:29 +0100
From: Kaijiang <>

According to our debugging, it requires multiplex function "<=" for timestamps. But the function MANIFOLDremapMultiplex is actually a dummy function and thus it reports a function(In reply to Martin Kersten from comment 2)

CREATE INDEX "chg_t_effc_tm" ON "sys"."ods_chg" ("t_effc_tm");

is not defined in the test scripts.

For the trimmed down version (4 tuples in each table) the problem
reported is:

Function 'calc.>=' not defined

This hints at an error in the UDF, which indeed attempts to execute:
X_141:bat[:oid,:bit] := mal.multiplex("calc","<=",X_132,X_140);

X_132 and X_140 are timestamps and the system only supports mtime.<=.

The issue is that this is not properly handled during the optimizer phase,
which leads to calling the default implementation, that throws an error.

Bug added as file BugTracker-2015/Tests/missed-error.Bug-3842.sql

We found that MANIFOLDremapMultiplex is actually a dummy function and thus the 'calc.>=' is not found. But MANIFOLDevaluate (also in manifold.c) seems to have proper implementation of the 'calc.>='.

To fix this bug, can we just function mapping in manifold.mal as below?

pattern mal.multiplex(mod:str,fcn:str,a:any...):any...
address MANIFOLDremapMultiplex; --> address MANIFOLDevaluate

pattern batmal.multiplex(mod:str,fcn:str,a:any...):any...
address MANIFOLDremapMultiplex; --> address MANIFOLDevaluate

Comment 21686

Date: 2015-12-23 10:17:35 +0100
From: @njnes

for sql inline functions the optimization stack wasn't run, this is now fixed.

Comment 21689

Date: 2015-12-23 14:57:58 +0100
From: Kaijiang <>

(In reply to Niels Nes from comment 6)

for sql inline functions the optimization stack wasn't run, this is now
fixed.

Can I get the version with the fix and learn from it?

More, https://www.monetdb.org/bugzilla/show_bug.cgi?id=3882 looks similar to this bug. Could you also check it?

@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