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

The sql task reports an error, and the sql parsing is incorrect. #15787

Closed
2 of 3 tasks
xiamud opened this issue Apr 1, 2024 · 2 comments · Fixed by #15833
Closed
2 of 3 tasks

The sql task reports an error, and the sql parsing is incorrect. #15787

xiamud opened this issue Apr 1, 2024 · 2 comments · Fixed by #15833
Assignees
Labels
backend bug Something isn't working

Comments

@xiamud
Copy link

xiamud commented Apr 1, 2024

Search before asking

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

What happened

SQL作业使用oracle数据源类型,sql中使用union all时任务出错。
执行以下sql:
select a,b,c,b-c as d
from
(select 1 as a,2 as b,3 as c from dual)

union all
select 1 as a,2 as b,3 as c,4 as d from dual
通过查询日志,可以看到以上sql被解析为:
SELECT a, b, c, b - c AS d
FROM (
SELECT 1 AS a, 2 AS b, 3 AS c
FROM dual
UNION ALL
SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS d
FROM dual
)

What you expected to happen

正常显示合并结果集

How to reproduce

在SQL任务中执行以下sql:
select a,b,c,b-c as d
from
(select 1 as a,2 as b,3 as c from dual)

union all
select 1 as a,2 as b,3 as c,4 as d from dual

Anything else

No response

Version

3.2.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@xiamud xiamud added bug Something isn't working Waiting for reply Waiting for reply labels Apr 1, 2024
@github-actions github-actions bot changed the title sql任务报错,sql解析的不对 The sql task reports an error, and the sql parsing is incorrect. Apr 1, 2024
Copy link

github-actions bot commented Apr 1, 2024

Search before asking

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

What happened

The SQL job uses the oracle data source type, and the task error occurs when union all is used in sql.
Execute the following sql:
select a,b,c,b-c as d
from
(select 1 as a,2 as b,3 as c from dual)

union all
select 1 as a,2 as b,3 as c,4 as d from dual
By querying the log, you can see that the above sql is parsed as:
SELECT a, b, c, b - c AS d
FROM (
SELECT 1 AS a, 2 AS b, 3 AS c
FROM dual
UNION ALL
SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS d
FROM dual
)

What you expected to happen

Display the merged result set normally

How to reproduce

Execute the following sql in the SQL task:
select a,b,c,b-c as d
from
(select 1 as a,2 as b,3 as c from dual)

union all
select 1 as a,2 as b,3 as c,4 as d from dual

Anything else

No response

Version

3.2.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@SbloodyS SbloodyS added help wanted Extra attention is needed and removed Waiting for reply Waiting for reply labels Apr 2, 2024
@xinxingi
Copy link
Contributor

xinxingi commented Apr 3, 2024

@SbloodyS please assign to me

@SbloodyS SbloodyS added backend and removed help wanted Extra attention is needed labels Apr 11, 2024
xinxingi added a commit to xinxingi/dolphinscheduler that referenced this issue Apr 12, 2024
SbloodyS pushed a commit that referenced this issue Apr 15, 2024
…xceptions in… (#15833)

* Reuse code and solve the problem of complex SQL parsing exceptions in druid, corresponding to issue #15787

* Code Format

* Enhanced adaptability to SQL formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
3 participants