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] 会话结果最后的sql没能替换成功,导致出错 #1377

Open
3 tasks done
baiying319 opened this issue Jul 9, 2024 · 0 comments
Open
3 tasks done

[Bug] 会话结果最后的sql没能替换成功,导致出错 #1377

baiying319 opened this issue Jul 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@baiying319
Copy link

Search before asking

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

Version

截止2024年7月8号的master代码

What's Wrong?

我的会话问题:2023年每月订单金额的增长趋势图
结果:有时候sql 解析成功,有时候最终sql没能解析成功
image
image
而且两个groupby
SELECT
DATE_FORMAT (数据日期, '%Y-%m'),
SUM(结算播放量)
FROM
艺人库
WHERE
elsAccount = 307000
AND YEAR (数据日期) = 2023
GROUP BY
DATE_FORMAT (数据日期, '%Y-%m')
ORDER BY
DATE_FORMAT (数据日期, '%Y-%m')

还有其他sql报错:2023年每月订单金额增长幅度
我发现触发的关键字是:增长幅度
image
修正sql

SELECT
  MONTH (数据日期),
  (
    SUM(含税总金额) - LAG (SUM(含税总金额)) OVER (
      ORDER BY
        MONTH (数据日期)
    )
  ) / LAG (SUM(含税总金额)) OVER (
    ORDER BY
      MONTH (数据日期)
  ) AS 含税总金额增长率,
  (
    SUM(未税总金额) - LAG (SUM(未税总金额)) OVER (
      ORDER BY
        MONTH (数据日期)
    )
  ) / LAG (SUM(未税总金额)) OVER (
    ORDER BY
      MONTH (数据日期)
  ) AS 未税总金额增长率
FROM
  订单头指标
WHERE
  elsAccount = '307000'
  AND (
    数据日期 >= '2023-07-09'
    AND 数据日期 <= '2024-07-09'
  )
GROUP BY
  MONTH (数据日期)

What You Expected?

同一个问题不出现sql问题

How to Reproduce?

触发关键词:每月金额增长趋势图、每月金额增长幅度之类的
大模型:deepseek-chat
部署环境:k8s ,java17,mysql

Anything Else?

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@baiying319 baiying319 added the bug Something isn't working label Jul 9, 2024
@mainmainer mainmainer self-assigned this Jul 9, 2024
@mainmainer mainmainer removed their assignment Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants