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

Serveral internal errors found in nightly build #12009

Open
2 tasks done
fuboat opened this issue May 11, 2024 · 2 comments
Open
2 tasks done

Serveral internal errors found in nightly build #12009

fuboat opened this issue May 11, 2024 · 2 comments

Comments

@fuboat
Copy link

fuboat commented May 11, 2024

What happens?

I found several internal errors in the nightly build.

Maybe they are not bugs or flaws. I just list them here.

To Reproduce

All PoCs except PoC No.6 can be reproduced on both the release cli binary v0.10.2 (duckdb_cli-linux-amd64) and the nightly build in python.

PoC No.1:

-- INTERNAL Error: Calling StringValue::Get on a NULL value
SELECT CURRENT_SETTING(CAST(NULL AS TEXT));

PoC No.2:

-- INTERNAL Error: JSON path cannot be NULL
SELECT JSON_EXTRACT_PATH('{"a":2,"c":[4,5,{"f":7}]}', [NULL, '$.a']);

PoC No.3, maybe related to issue #12004 :

-- Invalid Error: std::bad_alloc
SELECT LIST_RESIZE([1, 2, 3], 999999999999999999);

PoC No.4:

-- INTERNAL Error: Unrecognized expression type in logical operator visitor
SELECT LIST_TRANSFORM(NULL, x -> UNNEST(x));

PoC No.5:

-- INTERNAL Error: Attempted to dereference unique_ptr that is NULL!
SELECT LIST_ZIP('');

PoC No.6:

-- INTERNAL Error: Unimplemented type for value access
SELECT MAP_CONCAT(MAP([1], NULL), NULL);
SELECT MAP_CONCAT(MAP([1], NULL), NULL);

PoC No.7:

-- INTERNAL Error: Calling ListValue::GetChildren on a NULL value
SELECT APPROX_QUANTILE(42, CAST(NULL AS INT[]));

PoC No.8:

-- INTERNAL Error: Calling GetValueInternal on a value that is NULL
SELECT 'A', 'B' ORDER BY NULL COLLATE NOCASE;

PoC No.9, maybe related to issue #12008 :

-- INTERNAL Error: Unimplemented type for value access
SELECT [LIST_WHERE([NULL], [TRUE, TRUE, TRUE])];

PoC No.10:

-- INTERNAL Error: Unimplemented type for UNNEST
SELECT UNNEST([ARRAY_VALUE('1', NULL)]);

PoC No.11:

-- INTERNAL Error: Unrecognized expression type in logical operator visitor
SELECT [LOWER(REGEXP_SPLIT_TO_TABLE(s, ' ')) FOR s IN ['a=1', 'b=2', 'c=3']];

Note that PoC No.6 can only be reproduced on the nightly build in python with the following code:

import duckdb
c = duckdb.connect()
c.execute("SELECT MAP_CONCAT(MAP([1], NULL), NULL);")
c.execute("SELECT MAP_CONCAT(MAP([1], NULL), NULL);")

Output:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> r = c.execute("SELECT [LIST_WHERE(['abc'], [TRUE, FALSE, TRUE, TRUE, TRUE, TRUE])]")
KeyboardInterrupt
>>> import duckdb
>>> c = duckdb.connect()
>>> c.execute("SELECT MAP_CONCAT(MAP([1], NULL), NULL);")
<duckdb.duckdb.DuckDBPyConnection object at 0x7f9e62fd0d70>
>>> c.execute("SELECT MAP_CONCAT(MAP([1], NULL), NULL);")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
duckdb.duckdb.InternalException: INTERNAL Error: Unimplemented type for value access
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/dev/internal_errors
>>> 

Other PoCs can be reproduced on both the release cli binary v0.10.2 and the nightly build in python.

OS:

Ubuntu 22.04 x64

DuckDB Version:

v0.10.2 or nightly build (v0.10.3-dev848)

DuckDB Client:

cli (0.10.2) or Python (nightly build)

Full Name:

Jingzhou Fu

Affiliation:

Wingtecher Lab of Tsinghua University

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@Maxxen
Copy link
Member

Maxxen commented May 11, 2024

Thanks for finding these bugs and reporting this issue!

Just curious, do you find these through normal duckdb usage or are these the result of some sort of automatic testing/fuzzing?

@fuboat
Copy link
Author

fuboat commented May 11, 2024

Thanks for finding these bugs and reporting this issue!

Just curious, do you find these through normal duckdb usage or are these the result of some sort of automatic testing/fuzzing?

Hello! They are discovered by my in-developing DBMS testing framework.

hawkfish added a commit to hawkfish/duckdb that referenced this issue May 12, 2024
Make sure the quantile number list is not itself NULL.

fixes: duckdblabs/duckdb-internal#2021
Mytherin added a commit that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants