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

bug: Query instance crashed due to stack overflow #15578

Open
1 of 2 tasks
yufan022 opened this issue May 20, 2024 · 7 comments
Open
1 of 2 tasks

bug: Query instance crashed due to stack overflow #15578

yufan022 opened this issue May 20, 2024 · 7 comments
Labels
C-bug Category: something isn't working

Comments

@yufan022
Copy link
Contributor

yufan022 commented May 20, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

all version

What's Wrong?

Just found the Query node will suddenly crash, after investigation, it was caused by a SQL.

echo '{"foo": "bar"}' | curl -u${USER} -p${PASSWORD}: '0.0.0.0:8124/?query=INSERT%20INTO%20test%20FORMAT%20JSONEachRow' --data-binary @-
Databend HTTP
    listened at 0.0.0.0:8000
    usage:  curl -u${USER} -p${PASSWORD}: --request POST '0.0.0.0:8000/v1/query/' --header 'Content-Type: application/json' --data-raw '{"sql": "SELECT avg(number) FROM numbers(100000000)"}'


thread 'mysql-query-executor' has overflowed its stack
fatal runtime error: stack overflow

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

stack overflow caused by many where conditions.

Caused by:

WHERE 1 = 1 AND (
(timestamp = 'xx' AND type = 'xx' AND id = 'xx') 
OR (timestamp = 'xx' AND type = 'xx' AND id = 'xx') 
OR ...... 
OR .... );

How to Reproduce?

CREATE TABLE `t1` (
  `id` VARCHAR NULL,
  `timestamp` TIMESTAMP NULL,
  `type` VARCHAR NULL
);
SELECT * FROM t1 WHERE 1 = 1 AND ((timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx'));

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@yufan022 yufan022 added the C-bug Category: something isn't working label May 20, 2024
@yufan022 yufan022 changed the title bug: Query crashed due to stack overflow bug: Query instance crashed due to stack overflow May 20, 2024
@yufan022
Copy link
Contributor Author

yufan022 commented May 20, 2024

pub async fn resolve(&mut self, expr: &Expr) -> Result<Box<(ScalarExpr, DataType)>> {
if let Some(scalar) = self.bind_context.srfs.get(&expr.to_string()) {
if !matches!(self.bind_context.expr_context, ExprContext::SelectClause) {
return Err(ErrorCode::SemanticError(
"set-returning functions are only allowed in SELECT clause",
)
.set_span(expr.span()));
}
// Found a SRF, return it directly.
// See `Binder::bind_project_set` for more details.
return Ok(Box::new((scalar.clone(), scalar.data_type()?)));
}
let box (scalar, data_type): Box<(ScalarExpr, DataType)> = match expr {
Expr::ColumnRef {
span,
column:
ColumnRef {
database,
table,
column: ident,
},
} => {
let database = database
.as_ref()
.map(|ident| normalize_identifier(ident, self.name_resolution_ctx).name);
let table = table
.as_ref()
.map(|ident| normalize_identifier(ident, self.name_resolution_ctx).name);
let result = match ident {
ColumnID::Name(ident) => {
let column = normalize_identifier(ident, self.name_resolution_ctx);
self.bind_context.resolve_name(
database.as_deref(),
table.as_deref(),
&column,
self.aliases,
self.name_resolution_ctx,
)?
}
ColumnID::Position(pos) => self.bind_context.search_column_position(
pos.span,
database.as_deref(),
table.as_deref(),
pos.pos,
)?,
};
let (scalar, data_type) = match result {
NameResolutionResult::Column(column) => {
if let Some(virtual_computed_expr) = column.virtual_computed_expr {
let sql_tokens = tokenize_sql(virtual_computed_expr.as_str())?;
let expr = parse_expr(&sql_tokens, self.dialect)?;
return self.resolve(&expr).await;
} else {
let data_type = *column.data_type.clone();
(
BoundColumnRef {
span: *span,
column,
}
.into(),
data_type,
)
}
}
NameResolutionResult::InternalColumn(column) => {
// add internal column binding into `BindContext`
let column = self.bind_context.add_internal_column_binding(
&column,
self.metadata.clone(),
true,
)?;
if let Some(virtual_computed_expr) = column.virtual_computed_expr {
let sql_tokens = tokenize_sql(virtual_computed_expr.as_str())?;
let expr = parse_expr(&sql_tokens, self.dialect)?;
return self.resolve(&expr).await;
} else {
let data_type = *column.data_type.clone();
(
BoundColumnRef {
span: *span,
column,
}
.into(),
data_type,
)
}
}
NameResolutionResult::Alias { scalar, .. } => {
(scalar.clone(), scalar.data_type()?)
}
};
Box::new((scalar, data_type))
}
Expr::IsNull {
span, expr, not, ..
} => {
let args = &[expr.as_ref()];
if *not {
self.resolve_function(*span, "is_not_null", vec![], args)
.await?
} else {
self.resolve_function(*span, "is_null", vec![], args)
.await?
}
}
Expr::IsDistinctFrom {
span,
left,
right,
not,
} => {
let left_null_expr = Box::new(Expr::IsNull {
span: *span,
expr: left.clone(),
not: false,
});
let right_null_expr = Box::new(Expr::IsNull {
span: *span,
expr: right.clone(),
not: false,
});
let op = if *not {
BinaryOperator::Eq
} else {
BinaryOperator::NotEq
};
let (scalar, _) = *self
.resolve_function(*span, "if", vec![], &[
&Expr::BinaryOp {
span: *span,
op: BinaryOperator::And,
left: left_null_expr.clone(),
right: right_null_expr.clone(),
},
&Expr::Literal {
span: *span,
value: Literal::Boolean(*not),
},
&Expr::BinaryOp {
span: *span,
op: BinaryOperator::Or,
left: left_null_expr.clone(),
right: right_null_expr.clone(),
},
&Expr::Literal {
span: *span,
value: Literal::Boolean(!*not),
},
&Expr::BinaryOp {
span: *span,
op,
left: left.clone(),
right: right.clone(),
},
])
.await?;
self.resolve_scalar_function_call(*span, "assume_not_null", vec![], vec![scalar])?
}
Expr::InList {
span,
expr,
list,
not,
..
} => {
if list.len() >= self.ctx.get_settings().get_inlist_to_join_threshold()? {
if *not {
return self
.resolve_unary_op(*span, &UnaryOperator::Not, &Expr::InList {
span: *span,
expr: expr.clone(),
list: list.clone(),
not: false,
})
.await;
}
return self.convert_inlist_to_subquery(expr, list).await;
}
let get_max_inlist_to_or = self.ctx.get_settings().get_max_inlist_to_or()? as usize;
if list.len() > get_max_inlist_to_or && list.iter().all(satisfy_contain_func) {
let array_expr = Expr::Array {
span: *span,
exprs: list.clone(),
};
// Deduplicate the array.
let array_expr = Expr::FunctionCall {
span: *span,
func: ASTFunctionCall {
name: Identifier::from_name(*span, "array_distinct"),
args: vec![array_expr],
params: vec![],
window: None,
lambda: None,
distinct: false,
},
};
let args = vec![&array_expr, expr.as_ref()];
if *not {
self.resolve_unary_op(*span, &UnaryOperator::Not, &Expr::FunctionCall {
span: *span,
func: ASTFunctionCall {
distinct: false,
name: Identifier::from_name(*span, "contains"),
args: args.iter().copied().cloned().collect(),
params: vec![],
window: None,
lambda: None,
},
})
.await?
} else {
self.resolve_function(*span, "contains", vec![], &args)
.await?
}
} else {
let mut result = list
.iter()
.map(|e| Expr::BinaryOp {
span: *span,
op: BinaryOperator::Eq,
left: expr.clone(),
right: Box::new(e.clone()),
})
.fold(None, |mut acc, e| {
match acc.as_mut() {
None => acc = Some(e),
Some(acc) => {
*acc = Expr::BinaryOp {
span: *span,
op: BinaryOperator::Or,
left: Box::new(acc.clone()),
right: Box::new(e),
}
}
}
acc
})
.unwrap();
if *not {
result = Expr::UnaryOp {
span: *span,
op: UnaryOperator::Not,
expr: Box::new(result),
};
}
self.resolve(&result).await?
}
}
Expr::Between {
span,
expr,
low,
high,
not,
..
} => {
if !*not {
// Rewrite `expr BETWEEN low AND high`
// into `expr >= low AND expr <= high`
let (ge_func, _left_type) = *self
.resolve_binary_op(*span, &BinaryOperator::Gte, expr.as_ref(), low.as_ref())
.await?;
let (le_func, _right_type) = *self
.resolve_binary_op(
*span,
&BinaryOperator::Lte,
expr.as_ref(),
high.as_ref(),
)
.await?;
self.resolve_scalar_function_call(*span, "and", vec![], vec![
ge_func.clone(),
le_func.clone(),
])?
} else {
// Rewrite `expr NOT BETWEEN low AND high`
// into `expr < low OR expr > high`
let (lt_func, _left_type) = *self
.resolve_binary_op(*span, &BinaryOperator::Lt, expr.as_ref(), low.as_ref())
.await?;
let (gt_func, _right_type) = *self
.resolve_binary_op(*span, &BinaryOperator::Gt, expr.as_ref(), high.as_ref())
.await?;
self.resolve_scalar_function_call(*span, "or", vec![], vec![lt_func, gt_func])?
}
}
Expr::BinaryOp {
span,
op,
left,
right,
..
} => {
if let Expr::Subquery {
subquery,
modifier: Some(subquery_modifier),
..
} = &**right
{
match subquery_modifier {
SubqueryModifier::Any | SubqueryModifier::Some => {
let comparison_op = ComparisonOp::try_from(op)?;
self.resolve_subquery(
SubqueryType::Any,
subquery,
Some(*left.clone()),
Some(comparison_op),
)
.await?
}
SubqueryModifier::All => {
let contrary_op = op.to_contrary()?;
let rewritten_subquery = Expr::Subquery {
span: right.span(),
modifier: Some(SubqueryModifier::Any),
subquery: (*subquery).clone(),
};
self.resolve_unary_op(*span, &UnaryOperator::Not, &Expr::BinaryOp {
span: *span,
op: contrary_op,
left: (*left).clone(),
right: Box::new(rewritten_subquery),
})
.await?
}
}
} else {
self.resolve_binary_op(*span, op, left.as_ref(), right.as_ref())
.await?
}
}
Expr::JsonOp {
span,
op,
left,
right,
} => {
let func_name = op.to_func_name();
self.resolve_function(*span, func_name.as_str(), vec![], &[left, right])
.await?
}
Expr::UnaryOp { span, op, expr, .. } => {
self.resolve_unary_op(*span, op, expr.as_ref()).await?
}
Expr::Cast {
expr, target_type, ..
} => {
let box (scalar, data_type) = self.resolve(expr).await?;
if target_type == &TypeName::Variant {
if let Some(result) = self
.resolve_cast_to_variant(expr.span(), &data_type, &scalar, false)
.await
{
return result;
}
}
let raw_expr = RawExpr::Cast {
span: expr.span(),
is_try: false,
expr: Box::new(scalar.as_raw_expr()),
dest_type: DataType::from(&resolve_type_name(target_type, true)?),
};
let registry = &BUILTIN_FUNCTIONS;
let checked_expr = type_check::check(&raw_expr, registry)?;
if let Some(constant) = self.try_fold_constant(&checked_expr) {
return Ok(constant);
}
// if the source type is nullable, cast target type should also be nullable.
let target_type = if data_type.is_nullable_or_null() {
checked_expr.data_type().wrap_nullable()
} else {
checked_expr.data_type().clone()
};
Box::new((
CastExpr {
span: expr.span(),
is_try: false,
argument: Box::new(scalar),
target_type: Box::new(target_type.clone()),
}
.into(),
target_type,
))
}
Expr::TryCast {
expr, target_type, ..
} => {
let box (scalar, data_type) = self.resolve(expr).await?;
if target_type == &TypeName::Variant {
if let Some(result) = self
.resolve_cast_to_variant(expr.span(), &data_type, &scalar, true)
.await
{
return result;
}
}
let raw_expr = RawExpr::Cast {
span: expr.span(),
is_try: true,
expr: Box::new(scalar.as_raw_expr()),
dest_type: DataType::from(&resolve_type_name(target_type, true)?),
};
let registry = &BUILTIN_FUNCTIONS;
let checked_expr = type_check::check(&raw_expr, registry)?;
if let Some(constant) = self.try_fold_constant(&checked_expr) {
return Ok(constant);
}
Box::new((
CastExpr {
span: expr.span(),
is_try: true,
argument: Box::new(scalar),
target_type: Box::new(checked_expr.data_type().clone()),
}
.into(),
checked_expr.data_type().clone(),
))
}
Expr::Case {
span,
operand,
conditions,
results,
else_result,
} => {
let mut arguments = Vec::with_capacity(conditions.len() * 2 + 1);
for (c, r) in conditions.iter().zip(results.iter()) {
match operand {
Some(operand) => {
// compare case operand with each conditions until one of them is equal
let equal_expr = Expr::FunctionCall {
span: *span,
func: ASTFunctionCall {
distinct: false,
name: Identifier::from_name(*span, "eq"),
args: vec![*operand.clone(), c.clone()],
params: vec![],
window: None,
lambda: None,
},
};
arguments.push(equal_expr)
}
None => arguments.push(c.clone()),
}
arguments.push(r.clone());
}
let null_arg = Expr::Literal {
span: None,
value: Literal::Null,
};
if let Some(expr) = else_result {
arguments.push(*expr.clone());
} else {
arguments.push(null_arg)
}
let args_ref: Vec<&Expr> = arguments.iter().collect();
self.resolve_function(*span, "if", vec![], &args_ref)
.await?
}
Expr::Substring {
span,
expr,
substring_from,
substring_for,
..
} => {
let mut arguments = vec![expr.as_ref(), substring_from.as_ref()];
if let Some(substring_for) = substring_for {
arguments.push(substring_for.as_ref());
}
self.resolve_function(*span, "substring", vec![], &arguments)
.await?
}
Expr::Literal { span, value } => self.resolve_literal(*span, value)?,
Expr::FunctionCall {
span,
func:
ASTFunctionCall {
distinct,
name,
args,
params,
window,
lambda,
},
} => {
let func_name = normalize_identifier(name, self.name_resolution_ctx).to_string();
let func_name = func_name.as_str();
if !is_builtin_function(func_name)
&& !Self::all_sugar_functions().contains(&func_name)
{
if let Some(udf) = self.resolve_udf(*span, func_name, args).await? {
return Ok(udf);
} else {
// Function not found, try to find and suggest similar function name.
let all_funcs = BUILTIN_FUNCTIONS
.all_function_names()
.into_iter()
.chain(AggregateFunctionFactory::instance().registered_names())
.chain(GENERAL_WINDOW_FUNCTIONS.iter().cloned().map(str::to_string))
.chain(GENERAL_LAMBDA_FUNCTIONS.iter().cloned().map(str::to_string))
.chain(GENERAL_SEARCH_FUNCTIONS.iter().cloned().map(str::to_string))
.chain(
Self::all_sugar_functions()
.iter()
.cloned()
.map(str::to_string),
);
let mut engine: SimSearch<String> = SimSearch::new();
for func_name in all_funcs {
engine.insert(func_name.clone(), &func_name);
}
let possible_funcs = engine
.search(func_name)
.iter()
.map(|name| format!("'{name}'"))
.collect::<Vec<_>>();
if possible_funcs.is_empty() {
return Err(ErrorCode::UnknownFunction(format!(
"no function matches the given name: {func_name}"
))
.set_span(*span));
} else {
return Err(ErrorCode::UnknownFunction(format!(
"no function matches the given name: '{func_name}', do you mean {}?",
possible_funcs.join(", ")
))
.set_span(*span));
}
}
}
// check window function legal
if window.is_some()
&& !AggregateFunctionFactory::instance().contains(func_name)
&& !GENERAL_WINDOW_FUNCTIONS.contains(&func_name)
{
return Err(ErrorCode::SemanticError(
"only window and aggregate functions allowed in window syntax",
)
.set_span(*span));
}
// check lambda function legal
if lambda.is_some() && !GENERAL_LAMBDA_FUNCTIONS.contains(&func_name) {
return Err(ErrorCode::SemanticError(
"only lambda functions allowed in lambda syntax",
)
.set_span(*span));
}
let args: Vec<&Expr> = args.iter().collect();
// Check assumptions if it is a set returning function
if BUILTIN_FUNCTIONS
.get_property(func_name)
.map(|property| property.kind == FunctionKind::SRF)
.unwrap_or(false)
{
if matches!(
self.bind_context.expr_context,
ExprContext::InSetReturningFunction
) {
return Err(ErrorCode::SemanticError(
"set-returning functions cannot be nested".to_string(),
)
.set_span(*span));
}
if self.in_window_function {
return Err(ErrorCode::SemanticError(
"set-returning functions cannot be used in window spec",
)
.set_span(*span));
}
if !matches!(self.bind_context.expr_context, ExprContext::SelectClause) {
return Err(ErrorCode::SemanticError(
"set-returning functions can only be used in SELECT".to_string(),
)
.set_span(*span));
}
// Should have been handled with `BindContext::srfs`
return Err(ErrorCode::Internal("Logical error, there is a bug!"));
}
if GENERAL_WINDOW_FUNCTIONS.contains(&func_name) {
// general window function
if window.is_none() {
return Err(ErrorCode::SemanticError(format!(
"window function {func_name} can only be used in window clause"
))
.set_span(*span));
}
let func = self
.resolve_general_window_function(*span, func_name, &args)
.await?;
let window = window.as_ref().unwrap();
let display_name = format!("{:#}", expr);
self.resolve_window(*span, display_name, window, func)
.await?
} else if AggregateFunctionFactory::instance().contains(func_name) {
let mut new_params = Vec::with_capacity(params.len());
for param in params {
let box (scalar, _data_type) = self.resolve(param).await?;
let expr = scalar.as_expr()?;
let (expr, _) =
ConstantFolder::fold(&expr, &self.func_ctx, &BUILTIN_FUNCTIONS);
let constant = expr
.into_constant()
.map_err(|_| {
ErrorCode::SemanticError(format!(
"invalid parameter {param} for aggregate function, expected constant",
))
.set_span(*span)
})?
.1;
new_params.push(constant);
}
let in_window = self.in_window_function;
self.in_window_function = self.in_window_function || window.is_some();
let in_aggregate_function = self.in_aggregate_function;
let (new_agg_func, data_type) = self
.resolve_aggregate_function(
*span, func_name, expr, *distinct, new_params, &args,
)
.await?;
self.in_window_function = in_window;
self.in_aggregate_function = in_aggregate_function;
if let Some(window) = window {
// aggregate window function
let display_name = format!("{:#}", expr);
let func = WindowFuncType::Aggregate(new_agg_func);
self.resolve_window(*span, display_name, window, func)
.await?
} else {
// aggregate function
Box::new((new_agg_func.into(), data_type))
}
} else if GENERAL_LAMBDA_FUNCTIONS.contains(&func_name) {
if lambda.is_none() {
return Err(ErrorCode::SemanticError(format!(
"function {func_name} must have a lambda expression",
))
.set_span(*span));
}
let lambda = lambda.as_ref().unwrap();
self.resolve_lambda_function(*span, func_name, &args, lambda)
.await?
} else if GENERAL_SEARCH_FUNCTIONS.contains(&func_name) {
match func_name {
"score" => {
self.resolve_score_search_function(*span, func_name, &args)
.await?
}
"match" => {
self.resolve_match_search_function(*span, func_name, &args)
.await?
}
"query" => {
self.resolve_query_search_function(*span, func_name, &args)
.await?
}
_ => unreachable!(),
}
} else if ASYNC_FUNCTIONS.contains(&func_name) {
let catalog = self.ctx.get_default_catalog()?;
let tenant = self.ctx.get_tenant();
let async_func =
resolve_async_function(*span, tenant, catalog, func_name, &args).await?;
let data_type = async_func.return_type.as_ref().clone();
Box::new((async_func.into(), data_type))
} else {
// Scalar function
let mut new_params: Vec<Scalar> = Vec::with_capacity(params.len());
for param in params {
let box (scalar, _data_type) = self.resolve(param).await?;
let expr = scalar.as_expr()?;
let (expr, _) =
ConstantFolder::fold(&expr, &self.func_ctx, &BUILTIN_FUNCTIONS);
let constant = expr
.into_constant()
.map_err(|_| {
ErrorCode::SemanticError(format!(
"invalid parameter {param} for scalar function, expected constant",
))
.set_span(*span)
})?
.1;
new_params.push(constant);
}
self.resolve_function(*span, func_name, new_params, &args)
.await?
}
}
Expr::CountAll { span, window } => {
let (new_agg_func, data_type) = self
.resolve_aggregate_function(*span, "count", expr, false, vec![], &[])
.await?;
if let Some(window) = window {
// aggregate window function
let display_name = format!("{:#}", expr);
let func = WindowFuncType::Aggregate(new_agg_func);
self.resolve_window(*span, display_name, window, func)
.await?
} else {
// aggregate function
Box::new((new_agg_func.into(), data_type))
}
}
Expr::Exists { subquery, not, .. } => {
self.resolve_subquery(
if !*not {
SubqueryType::Exists
} else {
SubqueryType::NotExists
},
subquery,
None,
None,
)
.await?
}
Expr::Subquery { subquery, .. } => {
self.resolve_subquery(SubqueryType::Scalar, subquery, None, None)
.await?
}
Expr::InSubquery {
subquery,
not,
expr,
span,
} => {
// Not in subquery will be transformed to not(Expr = Any(...))
if *not {
return self
.resolve_unary_op(*span, &UnaryOperator::Not, &Expr::InSubquery {
subquery: subquery.clone(),
not: false,
expr: expr.clone(),
span: *span,
})
.await;
}
// InSubquery will be transformed to Expr = Any(...)
self.resolve_subquery(
SubqueryType::Any,
subquery,
Some(*expr.clone()),
Some(ComparisonOp::Equal),
)
.await?
}
expr @ Expr::MapAccess { .. } => {
let mut expr = expr;
let mut paths = VecDeque::new();
while let Expr::MapAccess {
span,
expr: inner_expr,
accessor,
} = expr
{
expr = &**inner_expr;
let path = match accessor {
MapAccessor::Bracket {
key: box Expr::Literal { value, .. },
} => {
if !matches!(value, Literal::UInt64(_) | Literal::String(_)) {
return Err(ErrorCode::SemanticError(format!(
"Unsupported accessor: {:?}",
value
))
.set_span(*span));
}
value.clone()
}
MapAccessor::Colon { key } => Literal::String(key.name.clone()),
MapAccessor::DotNumber { key } => Literal::UInt64(*key),
_ => {
return Err(ErrorCode::SemanticError(format!(
"Unsupported accessor: {:?}",
accessor
))
.set_span(*span));
}
};
paths.push_front((*span, path));
}
self.resolve_map_access(expr, paths).await?
}
Expr::Extract {
span, kind, expr, ..
} => self.resolve_extract_expr(*span, kind, expr).await?,
Expr::DatePart {
span, kind, expr, ..
} => self.resolve_extract_expr(*span, kind, expr).await?,
Expr::Interval { span, .. } => {
return Err(ErrorCode::SemanticError(
"Unsupported interval expression yet".to_string(),
)
.set_span(*span));
}
Expr::DateAdd {
span,
unit,
interval,
date,
..
} => self.resolve_date_add(*span, unit, interval, date).await?,
Expr::DateSub {
span,
unit,
interval,
date,
..
} => {
self.resolve_date_add(
*span,
unit,
&Expr::UnaryOp {
span: *span,
op: UnaryOperator::Minus,
expr: interval.clone(),
},
date,
)
.await?
}
Expr::DateTrunc {
span, unit, date, ..
} => self.resolve_date_trunc(*span, date, unit).await?,
Expr::Trim {
span,
expr,
trim_where,
..
} => self.resolve_trim_function(*span, expr, trim_where).await?,
Expr::Array { span, exprs, .. } => self.resolve_array(*span, exprs).await?,
Expr::Position {
substr_expr,
str_expr,
span,
..
} => {
self.resolve_function(*span, "locate", vec![], &[
substr_expr.as_ref(),
str_expr.as_ref(),
])
.await?
}
Expr::Map { span, kvs, .. } => self.resolve_map(*span, kvs).await?,
Expr::Tuple { span, exprs, .. } => self.resolve_tuple(*span, exprs).await?,
Expr::Hole { .. } => unreachable!("hole is impossible in trivial query"),
};
Ok(Box::new((scalar, data_type)))
}

I think it's caused by too much recursive calls.

@yufan022
Copy link
Contributor Author

yufan022 commented May 20, 2024

Any good ideas?

@BohuTANG
Copy link
Member

It seems happens a stack overflow when parsing, would like to ping @andylokandy regarding this issue.

@yufan022
Copy link
Contributor Author

yufan022 commented Jun 6, 2024

IN('xx','xx') has the same problem

@andylokandy
Copy link
Collaborator

I suggest enlarging the stack size. Currently, it's 2MB in release build and 20MB in debug build. We can enlarge the release build to 20MB.

@yufan022
Copy link
Contributor Author

yufan022 commented Jun 6, 2024

Tuning in local mac

@yufan022
Copy link
Contributor Author

yufan022 commented Jun 6, 2024

SELECT * FROM t1 WHERE 1 = 1 AND ((timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '3' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '1' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx') OR (timestamp = '2024-05-05 18:05:20' AND type = '2' AND id = 'xx'));

Only thread_stack_size(50 * 1024 * 1024) the SQL can be executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants