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 parse bug #2353

Open
diwu01 opened this issue Dec 18, 2024 · 0 comments
Open

Sql parse bug #2353

diwu01 opened this issue Dec 18, 2024 · 0 comments

Comments

@diwu01
Copy link

diwu01 commented Dec 18, 2024

version: 1.0.0-rc.3
SQL:SELECT * FROM ( with bqljzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap, dy_fin_account_period ap1, account_fiscal_year ay where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap1.fiscal_year_id=ay.id and ap1.fiscal_year_id=ap.fiscal_year_id and ap.date_from<=ap1.date_from and ap1.id=$PERIOD_ID$), sqljzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap1, account_fiscal_year ay1, account_fiscal_year ay, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap1.fiscal_year_id=ay1.id and ap.fiscal_year_id=ay.id and ap1.id=$PERIOD_ID$ and ay.date_from=ay1.date_from- INTERVAL '1 year' and ap.date_from<=ap1.date_from- INTERVAL '1 year'), bqzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap.id=$PERIOD_ID$ ), sqzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap1, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap.date_from=ap1.date_from- INTERVAL '1 month' and ap1.id=$PERIOD_ID$ ) select round(((bqljzsr.amount-sqljzsr.amount)/sqljzsr.amount)*100,2) as rate,'总收入同比' as type from bqljzsr,sqljzsr union all select round(((bqzsr.amount-sqzsr.amount)/sqzsr.amount)*100,2) as rate,'总收入环比' as type from bqzsr,sqzsr ) AS "DATART_VTABLE" OFFSET 0 ROWS FETCH NEXT 1000 ROWS ONLY
DB: POSTGRESQL
EXCEPTION:org.apache.calcite.sql.parser.SqlParseException: Encountered "and" at line 1, column 988.
Was expecting one of:
"DAY" ...
"DAYS" ...
"HOUR" ...
"HOURS" ...
"MINUTE" ...
"MINUTES" ...
"MONTH" ...
"MONTHS" ...
"SECOND" ...
"SECONDS" ...
"YEAR" ...
"YEARS" ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant