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

doris对select中的字段进行了常量折叠 对于grouping中和grouping sets中的字段没有进行常量折叠 [Bug] #30109

Open
2 of 3 tasks
FrankZhang996 opened this issue Jan 18, 2024 · 0 comments

Comments

@FrankZhang996
Copy link

Search before asking

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

Version

1.2.5-rc01

What's Wrong?

doris对select中的字段进行了常量折叠 对于grouping中和grouping sets中的字段没有进行常量折叠 [Bug]
以下语法会报错:
SELECT
(
CASE

		WHEN to_date ( DAY ) <= CURRENT_DATE ()- 1 AND to_date ( DAY ) >= CURRENT_DATE ()- 7 THEN
		'本周' 
		WHEN to_date ( DAY ) <= CURRENT_DATE ()- 8 AND to_date ( DAY ) >= CURRENT_DATE ()- 14 THEN
		'上周' 
	END 
	),
	grouping (
	CASE
			
			WHEN to_date ( DAY ) <= CURRENT_DATE ()- 1 AND to_date ( DAY ) >= CURRENT_DATE ()- 7 THEN
			'本周' 
			WHEN to_date ( DAY ) <= CURRENT_DATE ()- 8 AND to_date ( DAY ) >= CURRENT_DATE ()- 14 THEN
			'上周' 
		END 
		),
		count( `apv_apply_no` ) 
	FROM
		bolt_202401041830aa9462b1be4dd8a02fa65ab1bbcd78 
	GROUP BY
		grouping sets ((
			CASE
					WHEN to_date ( DAY ) <= CURRENT_DATE ()- 1 AND to_date ( DAY ) >= CURRENT_DATE ()- 7 THEN
					'本周' 
					WHEN to_date ( DAY ) <= CURRENT_DATE ()- 8 AND to_date ( DAY ) >= CURRENT_DATE ()- 14 THEN
					'上周' 
			END 
),())

报错信息
detailMessage = select list expression not produced by aggregation output (missing from GROUP BY clause?): (CASE WHEN to_date(DAY) <= '2024-01-17 00:00:00' AND to_date(DAY) >= '2024-01-11 00:00:00' THEN '本周' WHEN to_date(DAY) <= '2024-01-10 00:00:00' AND to_date(DAY) >= '2024-01-04 00:00:00' THEN '上周' END)

What You Expected?

grouping中和grouping sets中的字段也进行常量折叠

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

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